[ITK] [ITK-users] Creating 3D dome using ITK
Francois Budin
francois.budin at kitware.com
Wed May 10 09:54:15 EDT 2017
Hello Sidharta,
Don't forget to move the ellipsoid where you want in space. In the example
that Robert pointed you to [1], it is:
ellipse->SetObjectToParentTransform( transform );
To obtain only haft a dome, you could only create an image that contains
half of your ellipse for "SpatialObjectToImageFilter", and then resize the
image
afterward to match the image size you want.
Hope this helps,
Francois
[1] https://itk.org/Wiki/ITK/Examples/SpatialObjects/EllipseSpatialObject
On Wed, May 10, 2017 at 8:06 AM, sidharta <sidharta.gupta93 at gmail.com>
wrote:
> I tried the EllipseSpatialObject as follows:
>
> int EllipseSpatialObjectToImage(InputImageType::Pointer binaryImage){
>
> typedef itk::EllipseSpatialObject<Dimension> EllipseType;
> EllipseType::Pointer ellipse = EllipseType::New();
>
> ellipse->SetRadius(0.5 / binaryImage->GetSpacing()[0]);
> ellipse->SetDefaultInsideValue(1.0);
> ellipse->SetDefaultOutsideValue(0.0);
>
> typedef itk::SpatialObjectToImageFilter<EllipseType,
> InputImageType>
> SpatialObjectToImageFilterType;
> SpatialObjectToImageFilterType::Pointer filter =
> SpatialObjectToImageFilterType::New();
>
> int d = 1.0 / binaryImage->GetSpacing()[0];
> InputImageType::SizeType size;
> size.Fill(d);
> filter->SetSize(size);
>
> filter->SetInsideValue(255);
> filter->SetOutsideValue(0);
>
> double O[3] = { 0, 0, 0 };
> filter->SetOrigin(O);
> filter->SetInput(ellipse);
>
> filter->Update();
>
> int flag = FileWriter(filter->GetOutput(),
> "C:/Users/api/Desktop/3D_mask_ellipse.mhd");
> if (!flag)
> return EXIT_FAILURE;
> else
> return EXIT_SUCCESS;
> }
> But I get a blank image unfortunately. How would I get hemi-sphere from
> this? Just cropImageFilter?
>
>
> Thank you
> Sidharta
>
>
>
> --
> View this message in context: http://itk-users.7.n7.nabble.
> com/Creating-3D-dome-using-ITK-tp38201p38210.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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20170510/ad806488/attachment.html>
-------------- next part --------------
_____________________________________
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
More information about the Community
mailing list