[Insight-users] SpatialObjectToImageFilter work with Vessels Tubes Spatial objects?

Julien Jomier julien.jomier at kitware.com
Mon Mar 20 10:52:14 EST 2006


Hi Jerome,

Yes the SpatialObjecToImageFilter works with VesselTubesSO.

Couple of things to try:
a) Add an ->Update() at the vesselsToImageFilter or castFilter level.
b) If you don't specify the size of the output image, the bounding box 
of the vessels should be the default size. You can try and see the 
resulting image size. If the size is zero, that means the bounding box 
is not computing correctly somewhere.
c) The SOtoImageFilter works in world coordinates. If you origin and 
size are not defined correctly, the output image might be outside of the 
vessels' bounding box.

Let us know what you find,

Julien

SCHMID, Jerome wrote:
> Hi,
> 
> I generate a spatial object of type vessel tube in my app. When I use 
> the itkSpatialObjectWriter and save it to a meta file for instance it 
> works. However when I use a itk::SpatialObjectToImageFilter filter, my 
> file.vtk for instance is empty, just the header is written.
> 
> Here a snippet of my code:
> 
> vesselsTracingFilter is a filter producing the vessels structure. The 
> output of the filter is an image, currently empty,
> but whose properties spacing, orign and region are correct.
> 
> typedef itk::SpatialObjectToImageFilter< 
> VesselTracingFilter::VesselTubeSpatialType, InputImageType > 
> SpatialObjectToImageFilter;
> 
> typedef itk::RescaleIntensityImageFilter< 
> SpatialObjectToImageFilter::OutputImageType, OutputImageType  >     
> CastFilterType;
> 
> SpatialObjectToImageFilter::Pointer vesselsToImageFilter = 
> SpatialObjectToImageFilter::New();
> vesselsToImageFilter->SetInput( 
> vesselsTracingFilter->GetVessels().GetPointer() );
> vesselsToImageFilter->SetSpacing( 
> vesselsTracingFilter->GetOutput()->GetSpacing() );
> vesselsToImageFilter->SetOrigin( 
> vesselsTracingFilter->GetOutput()->GetOrigin() );
> vesselsToImageFilter->SetSize( 
> vesselsTracingFilter->GetOutput()->GetRequestedRegion().GetSize() );
> 
> CastFilterType::Pointer castFilter = CastFilterType::New();
> castFilter->SetOutputMinimum( 0 );
> castFilter->SetOutputMaximum( 255 );
> castFilter->SetInput( vesselsToImageFilter->GetOutput() );
> 
> writer->SetFileName( outputFilename );
> writer->SetInput( castFilter->GetOutput() );
> 
> 
> try
> {
> writer->Update();
> }
> catch( itk::ExceptionObject & err )
> {
>         std::cerr << "ExceptionObject caught !" << std::endl;
>         std::cerr << err << std::endl;
>         system("pause");
>         return -1;
> }
> 
> 
> Any clues?
> 
> Thanks!
> 
> Best Regards,
> 
> Jerome Schmid
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users



More information about the Insight-users mailing list