[Insight-users] How to create/draw a sphere surface image mask with 26|6 connectivity?
Luis Ibanez
luis.ibanez at kitware.com
Sat Feb 13 15:34:32 EST 2010
Hi Lynx,
You could use the following set of classes
1) itkEllipseSpatialObject
2) itkSpatialObjectToImageFilter
3) itkSimpleContourExtractorImageFilter
With (1) you can create a Sphere of the proper size,
With (2) you can rasterize that sphere into a binary image mask
With (3) you can extract the contour of the binary image mask
The filter (3) allows you to select the "thickness" of
the contour. You do this by adjusting the value of the
neighborhood "Radius" parameter.
----------------
You will find source code guiding examples in
Insight/Examples/Filtering/
SpatialObjectToImage1.cxx
SpatialObjectToImage2.cxx
SpatialObjectToImage3.cxx
and
Insight/Examples/Registration/
ModelToImageRegistration1.cxx
ModelToImageRegistration2.cxx
The basic declarations will look like:
const unsigned int Dimension = 3;
typedef unsigned char MaskPixelType;
typedef itk::Image< MaskPixelType, Dimension > MaskImageType;
typedef itk::EllipseSpatialObject< Dimension > SpatialObjectType;
typedef itk::SpatialObjectToImageFilter<
SpatialObjectType,
MaskImageType
> SpatialObjectToImageFilterType;
This will generate a discrete structure ("aliased").
Anti-aliased versions could be produced in several
different ways, depending on what you plan to do
with the resulting contour.
Some of the options for anti-aliased versions are:
A) Take the aliased contour and pass it as input
to the itk::AntiAliasBinaryImageFilter
B) Use either one of the following distance map filters:
* SignedDanielssonDistanceMapImageFilter
* SignedMaurerDistanceMapImageFilter
Please let us know if you run into any problems,
Thanks
Luis
----------------------------------------------------------------------------
On Sat, Feb 13, 2010 at 6:53 AM, <lynx.abraxas at freenet.de> wrote:
> Hello!
>
>
> I need a 3D mask of a sphere suface once with 26 connectivity, once with 6
> connectivity and once with aliasing (as a weighting mask).
> The mask should be a cube of size NxNxN where N is odd (corresponding to some
> definit physsical size) such that the centre pixel of the cube should be the
> centre of the sphere with a physical radius of 1.
>
> I was thinking of doing it with a for loop over all indices of the mask volume
> but there I don't know how to realize the none aliased cases. The aliasing I
> think could be done by assigning a grey value corresponding to the distance
> from the actual radius-point to the nearest voxel-centre. The grey value
> should be down at zero for a distance bigger than one voxel.
>
> Looking at the docs I found the ellipsoid spacial object but nothing about how
> to "render" that into a 3D image and again no clue how to differentiate the
> three "rendering cases".
>
> How could that be done with ITK or VTK?
> Is there a way to implement also a surface thickness bigger than 1 voxel?
>
> Many thanks for any help or hints.
> Lynx
> _____________________________________
> 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.html
>
> 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://www.itk.org/mailman/listinfo/insight-users
>
More information about the Insight-users
mailing list