Skip to content

Commit 2f6b5ae

Browse files
committed
FindBoundingBoxFeatures: Fix bug where other 2D planes are not considered for XY coords
fixes #985. closes #985 Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
1 parent 10c5c2f commit 2f6b5ae

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

Source/Plugins/Generic/GenericFilters/FindBoundingBoxFeatures.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,23 +331,32 @@ void FindBoundingBoxFeatures::find_boundingboxfeatures2D()
331331
int32_t xPoints = 0, yPoints = 0;
332332
FloatVec3Type spacing;
333333

334+
size_t centroidShift0 = 0;
335+
size_t centroidShift1 = 1;
336+
334337
if(imageGeom->getXPoints() == 1)
335338
{
336339
xPoints = imageGeom->getYPoints();
337340
yPoints = imageGeom->getZPoints();
338341
spacing = imageGeom->getSpacing();
342+
centroidShift0 = 1;
343+
centroidShift1 = 2;
339344
}
340345
if(imageGeom->getYPoints() == 1)
341346
{
342347
xPoints = imageGeom->getXPoints();
343348
yPoints = imageGeom->getZPoints();
344349
spacing = imageGeom->getSpacing();
350+
centroidShift0 = 0;
351+
centroidShift1 = 2;
345352
}
346353
if(imageGeom->getZPoints() == 1)
347354
{
348355
xPoints = imageGeom->getXPoints();
349356
yPoints = imageGeom->getYPoints();
350357
spacing = imageGeom->getSpacing();
358+
centroidShift0 = 0;
359+
centroidShift1 = 1;
351360
}
352361

353362
boundbox[0] = xOrigin;
@@ -362,8 +371,8 @@ void FindBoundingBoxFeatures::find_boundingboxfeatures2D()
362371
sidetomove = 0;
363372
move = 1;
364373
mindist = std::numeric_limits<float>::max();
365-
x = m_Centroids[3 * i];
366-
y = m_Centroids[3 * i + 1];
374+
x = m_Centroids[3 * i + centroidShift0];
375+
y = m_Centroids[3 * i + centroidShift1];
367376
coords[0] = x;
368377
coords[1] = x;
369378
coords[2] = y;

0 commit comments

Comments
 (0)