<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.6944.0">
<TITLE>RE: [Insight-users] SpatialObjectToImageFilter work with Vessels Tubes        Spatial objects? FIXED</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>Hi Julien,<BR>
<BR>
An update at the vesselsToImageFilter fixes the pb, I just cannot figure out why this Update cannot be set at the writer stage. Anyway I won't complain, it works. Thanks!<BR>
<BR>
Best Regards,<BR>
<BR>
Jerome<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: Julien Jomier [<A HREF="mailto:julien.jomier@kitware.com">mailto:julien.jomier@kitware.com</A>]<BR>
Sent: Mon 3/20/2006 11:52 PM<BR>
To: SCHMID, Jerome<BR>
Cc: insight-users@itk.org<BR>
Subject: Re: [Insight-users] SpatialObjectToImageFilter work with Vessels Tubes Spatial objects?<BR>
<BR>
Hi Jerome,<BR>
<BR>
Yes the SpatialObjecToImageFilter works with VesselTubesSO.<BR>
<BR>
Couple of things to try:<BR>
a) Add an ->Update() at the vesselsToImageFilter or castFilter level.<BR>
b) If you don't specify the size of the output image, the bounding box<BR>
of the vessels should be the default size. You can try and see the<BR>
resulting image size. If the size is zero, that means the bounding box<BR>
is not computing correctly somewhere.<BR>
c) The SOtoImageFilter works in world coordinates. If you origin and<BR>
size are not defined correctly, the output image might be outside of the<BR>
vessels' bounding box.<BR>
<BR>
Let us know what you find,<BR>
<BR>
Julien<BR>
<BR>
SCHMID, Jerome wrote:<BR>
> Hi,<BR>
><BR>
> I generate a spatial object of type vessel tube in my app. When I use<BR>
> the itkSpatialObjectWriter and save it to a meta file for instance it<BR>
> works. However when I use a itk::SpatialObjectToImageFilter filter, my<BR>
> file.vtk for instance is empty, just the header is written.<BR>
><BR>
> Here a snippet of my code:<BR>
><BR>
> vesselsTracingFilter is a filter producing the vessels structure. The<BR>
> output of the filter is an image, currently empty,<BR>
> but whose properties spacing, orign and region are correct.<BR>
><BR>
> typedef itk::SpatialObjectToImageFilter<<BR>
> VesselTracingFilter::VesselTubeSpatialType, InputImageType ><BR>
> SpatialObjectToImageFilter;<BR>
><BR>
> typedef itk::RescaleIntensityImageFilter<<BR>
> SpatialObjectToImageFilter::OutputImageType, OutputImageType > <BR>
> CastFilterType;<BR>
><BR>
> SpatialObjectToImageFilter::Pointer vesselsToImageFilter =<BR>
> SpatialObjectToImageFilter::New();<BR>
> vesselsToImageFilter->SetInput(<BR>
> vesselsTracingFilter->GetVessels().GetPointer() );<BR>
> vesselsToImageFilter->SetSpacing(<BR>
> vesselsTracingFilter->GetOutput()->GetSpacing() );<BR>
> vesselsToImageFilter->SetOrigin(<BR>
> vesselsTracingFilter->GetOutput()->GetOrigin() );<BR>
> vesselsToImageFilter->SetSize(<BR>
> vesselsTracingFilter->GetOutput()->GetRequestedRegion().GetSize() );<BR>
><BR>
> CastFilterType::Pointer castFilter = CastFilterType::New();<BR>
> castFilter->SetOutputMinimum( 0 );<BR>
> castFilter->SetOutputMaximum( 255 );<BR>
> castFilter->SetInput( vesselsToImageFilter->GetOutput() );<BR>
><BR>
> writer->SetFileName( outputFilename );<BR>
> writer->SetInput( castFilter->GetOutput() );<BR>
><BR>
><BR>
> try<BR>
> {<BR>
> writer->Update();<BR>
> }<BR>
> catch( itk::ExceptionObject & err )<BR>
> {<BR>
> std::cerr << "ExceptionObject caught !" << std::endl;<BR>
> std::cerr << err << std::endl;<BR>
> system("pause");<BR>
> return -1;<BR>
> }<BR>
><BR>
><BR>
> Any clues?<BR>
><BR>
> Thanks!<BR>
><BR>
> Best Regards,<BR>
><BR>
> Jerome Schmid<BR>
><BR>
><BR>
> ------------------------------------------------------------------------<BR>
><BR>
> _______________________________________________<BR>
> Insight-users mailing list<BR>
> Insight-users@itk.org<BR>
> <A HREF="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</A><BR>
<BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>