[ITK-users] Creating 3D dome using ITK

Richard Beare richard.beare at gmail.com
Wed May 10 07:01:50 EDT 2017


A simple, although not necessarily efficient, way of doing this is to
create an image with a single voxel where you want the centre of the
(hemi)sphere to be, then dilate using the binary dilate filter
(alternatively compute a distance transform them threshold). These two
methods will give you a sphere, and you can then blank the half you don't
want.

Depending on the interface to ITK you are using, you could probably achieve
something similar by generating images containing physical coordinates an
plug those into formula for a sphere.

On Wed, May 10, 2017 at 8:40 PM, Matt McCormick <matt.mccormick at kitware.com>
wrote:

> Hi,
>
> Depending on the code, MY_RADIUS may need to be divided by two.
>
> To avoid difficulties like this, it is better to work in physical
> space versus index space. For more information on how physical space
> works in ITK, see the itk::Image overview in the ITK Software Guide:
>
>   https://itk.org/ITKSoftwareGuide/html/Book1/ITKSoftwareGuide-Book1ch4.
> html#x38-450004.1
>
>
> There is a filter that can be used to anti-alias the mask.  Here is an
> example:
>
>   https://itk.org/ITKExamples/src/Filtering/AntiAlias/
> SmoothBinaryImageBeforeSurfaceExtraction/Documentation.html
>
>
> I hope this helps.
>
> Matt
>
> On Wed, May 10, 2017 at 6:19 AM, sidharta <sidharta.gupta93 at gmail.com>
> wrote:
> > Dear all,
> >
> > I am trying to make a 3D dome (ie; Half Sphere) and then generating a
> binary
> > image out of it. The aim is to use this binary image as a mask in
> > maskFilter. I was able to generate a 2D circular mask, which was straight
> > forward. I used this in a maskFilter and masked the 3D image using
> > slicebysliceFilter.
> >
> > I can think of two ways to do it:
> > 1. Make several masks of decreasing circle radius which ultimately would
> > represent a dome.
> > 2. Make a mask image and assign the values at indices accordingly to get
> a
> > dome mask.
> >
> > The first step seems doable but to my understanding would be an overkill.
> > I am not able to do the second step. Following is the code I tried:
> >
> > float MY_RADIUS = maskRegion.GetSize()[0];
> > MaskIteratorType iterator(maskImage, maskImage->
> GetLargestPossibleRegion());
> > while (!iterator.IsAtEnd())
> >         {
> >                 const InputImageType::IndexType & index =
> iterator.GetIndex();
> >                 std::cout << "Index is " << index;
> >                 float value = (index[0] - centerPoint[0]) * (index[0] -
> centerPoint[0])
> >                         + (index[1] - centerPoint[1]) * (index[1] -
> centerPoint[1]);
> >                 std::cout << "Compare - LHS = " << value << " RHS = " <<
> MY_RADIUS *
> > MY_RADIUS << std::endl;
> >                 if ((index[0] - centerPoint[0]) * (index[0] -
> centerPoint[0])
> >                         + (index[1] - centerPoint[1]) * (index[1] -
> centerPoint[1])
> >                         <= MY_RADIUS * MY_RADIUS)
> >                 {
> >                         iterator.Set(1);
> >                 }
> >                 --MY_RADIUS;
> >                 ++iterator;
> >         }
> >
> > After adding the cout commands I saw that --MY_RADIUS is incorrect. I
> > generated the required sphere using matlab, just to get the values I
> should
> > assign to the pixels.
> >
> > Additionally, I noticed there is a need for anti-aliasing to the mask.
> > Kindly let me know how this can be done iteratively.
> >
> > Thank you!
> >
> >
> >
> > --
> > View this message in context: http://itk-users.7.n7.nabble.
> com/Creating-3D-dome-using-ITK-tp38201.html
> > Sent from the ITK - 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://public.kitware.com/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20170510/4fd2de94/attachment.html>


More information about the Insight-users mailing list