Discussion:
[ITK-users] Recentering Output of fast marching
Andaharoo
2017-06-26 16:39:02 UTC
Permalink
I've been using the fast marching filter to segment out a particular piece of
a 3d image and now I would like to recenter this segmented part. Sometimes
the segmented part can be at the edge of the image which makes it hard to
rotate since it will only rotate around the center. I tried using fast
marchings getOutputOrigin but that doesn't do what I had hoped it would do.
If I were to write it would go something along the lines of this with a
binary image:
for every pixel
if the pixel is 1
if the pixels x val is greater than maxX
maxX = the pixels x val
if the pixels x val is smaller than minX
minX = the pixels x val
Do the same with the y and z and mins
Then after getting the extents I coudl just do (minX + maxX) / 2, (minY +
maxY) / 2, (minZ + maxZ) / 2



--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Recentering-Output-of-fast-marching-tp7590022.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
Matt McCormick
2017-06-26 17:03:52 UTC
Permalink
Hi,

This example shows how to find the bounding box of a binary image:

https://itk.org/Insight/Doxygen/html/Examples_2SpatialObjects_2BoundingBoxFromImageMaskSpatialObject_8cxx-example.html

Hope this helps,
Matt
Post by Andaharoo
I've been using the fast marching filter to segment out a particular piece of
a 3d image and now I would like to recenter this segmented part. Sometimes
the segmented part can be at the edge of the image which makes it hard to
rotate since it will only rotate around the center. I tried using fast
marchings getOutputOrigin but that doesn't do what I had hoped it would do.
If I were to write it would go something along the lines of this with a
for every pixel
if the pixel is 1
if the pixels x val is greater than maxX
maxX = the pixels x val
if the pixels x val is smaller than minX
minX = the pixels x val
Do the same with the y and z and mins
Then after getting the extents I coudl just do (minX + maxX) / 2, (minY +
maxY) / 2, (minZ + maxZ) / 2
--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Recentering-Output-of-fast-marching-tp7590022.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
_____________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
http://www.kitware.com/products/protraining.php
http://www.itk.org/Wiki/ITK_FAQ
http://public.kitware.com/mailman/listinfo/insight-users
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users
Lowekamp, Bradley (NIH/NLM/LHC) [C]
2017-06-26 17:06:13 UTC
Permalink
Hello,

Have you looked at the LabelImageStatisticsImageFilter[1]? This should compute what you describe.

The “GetRegion” methods returns a bounding ImageRegion, for a given label. In your case this would be for the label 1.

Brad

[1]https://itk.org/Doxygen/html/classitk_1_1LabelStatisticsImageFilter.html#aa0de894e901cf64495f5690f77b73efb


On 6/26/17, 12:39 PM, "Andaharoo" <***@live.com> wrote:

I've been using the fast marching filter to segment out a particular piece of
a 3d image and now I would like to recenter this segmented part. Sometimes
the segmented part can be at the edge of the image which makes it hard to
rotate since it will only rotate around the center. I tried using fast
marchings getOutputOrigin but that doesn't do what I had hoped it would do.
If I were to write it would go something along the lines of this with a
binary image:
for every pixel
if the pixel is 1
if the pixels x val is greater than maxX
maxX = the pixels x val
if the pixels x val is smaller than minX
minX = the pixels x val
Do the same with the y and z and mins
Then after getting the extents I coudl just do (minX + maxX) / 2, (minY +
maxY) / 2, (minZ + maxZ) / 2



--
View this message in context: http://itk-insight-users.2283740.n2.nabble.com/Recentering-Output-of-fast-marching-tp7590022.html
Sent from the ITK Insight Users mailing list archive at Nabble.com.
_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/insight-users


_____________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html

Kitware offers ITK Training Courses, for more information visit:
http://www.kitware.com/products/protraining.php

Please keep messages on-topic and check the ITK FAQ at:
http://www.itk.org/Wiki/ITK_FAQ

Follow this link to subscribe/unsubscribe:
http:/

Loading...