[ITK] [ITK-users] Creating 3D dome using ITK
sidharta
sidharta.gupta93 at gmail.com
Wed May 10 13:10:44 EDT 2017
So I tried the following:
int EllipseSpatialObjectToImage(InputImageType::Pointer binaryImage){
typedef itk::EllipseSpatialObject<Dimension> EllipseType;
typedef itk::SpatialObjectToImageFilter<EllipseType, InputImageType>
SpatialObjectToImageFilterType;
SpatialObjectToImageFilterType::Pointer spatialObjectToImageFilter =
SpatialObjectToImageFilterType::New();
InputImageType::SizeType size;
size[0] = 8;
size[1] = 8;
size[2] = 8;
// spatialObjectToImageFilter->SetSize(size); not setting the size
explicitly as by default the filter will calculate the optimum size.
InputImageType::SpacingType spacing;
spacing.Fill(1);
spatialObjectToImageFilter->SetSpacing(spacing);
EllipseType::Pointer ellipse = EllipseType::New();
EllipseType::ArrayType radiusArray;
ellipse->SetRadius(8); // Since I want half of this ellipse, I set the
radius to 8.
// Position the ellipse in the image
typedef EllipseType::TransformType TransformType;
TransformType::Pointer transform = TransformType::New();
transform->SetIdentity();
TransformType::OutputVectorType translation;
TransformType::CenterType center;
translation[0] = 8 * spacing[0]; // Translate so the center of the
"ellipse" is such that it covers the entire image bounds.
translation[1] = 8 * spacing[1];
translation[2] = -8 * spacing[2]; // This is for dome
transform->Translate(translation);
ellipse->SetObjectToParentTransform(transform);
std::cout << "Ellipse bounding box " <<
ellipse->GetBoundingBox()->GetMaximum() << std::endl;
spatialObjectToImageFilter->SetInput(ellipse);
ellipse->SetDefaultInsideValue(255);
ellipse->SetDefaultOutsideValue(0);
spatialObjectToImageFilter->SetUseObjectValue(true);
spatialObjectToImageFilter->SetOutsideValue(0);
spatialObjectToImageFilter->Update();
int flag = FileWriter(spatialObjectToImageFilter->GetOutput(),
"C:/Users/api/Desktop/dome.mhd");
if (!flag)
return EXIT_FAILURE;
return EXIT_SUCCESS;
}
But I don't get what I am intending. Any suggestions?
--
View this message in context: http://itk-users.7.n7.nabble.com/Creating-3D-dome-using-ITK-tp38201p38220.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
More information about the Community
mailing list