<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><DIV>Hello: Lui,</DIV>
<DIV> </DIV>
<DIV>I rebuild the ITK as you suggested. Now the image resulution is correct.</DIV>
<DIV> </DIV>
<DIV>Thanks a lot.</DIV>
<DIV> </DIV>
<DIV>Baoyun<BR></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><BR>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><FONT face=Tahoma size=2>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Luis Ibanez <luis.ibanez@kitware.com><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Baoyun Li <baoyun_li123@yahoo.com><BR><B><SPAN style="FONT-WEIGHT: bold">Cc:</SPAN></B> insight-users@itk.org<BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Wednesday, February 25, 2009 11:11:30 AM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: ITK FastMarching example--help!!!--the resultion of output images are changed to [1 1 1]<BR></FONT><BR><BR>Hi Baoyun,<BR><BR>Yes ITK 3.10 is the release where this bug sneaked in. :-(<BR><BR>You can fix it by yourself by applying the following change:<BR><BR><A href="http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/BasicFilters/itkGradientMagnitudeRecursiveGaussianImageFilter.txx?root=Insight&r1=1.20&r2=1.21&sortby=date" target=_blank
rel=nofollow>http://public.kitware.com/cgi-bin/viewcvs.cgi/Code/BasicFilters/itkGradientMagnitudeRecursiveGaussianImageFilter.txx?root=Insight&r1=1.20&r2=1.21&sortby=date</A><BR><BR><BR>Simply add:<BR><BR> cumulativeImage->CopyInformation(this->GetInput());<BR><BR>to line 216 of the file<BR><BR> Insight/Code/BasicFilters/<BR> itkGradientMagnitudeRecursiveGaussianImageFilter.txx<BR><BR>and rebuild your application.<BR><BR>--<BR><BR>The great advantage of Open Source software is indeed<BR>that you *can* help yourself and help others by fixing <BR>things on your own. :-)<BR><BR><BR>Please let us know if you find any problem,<BR><BR> Thanks<BR><BR> Luis<BR><BR><BR>------------------------------------------------------------------------<BR>
<DIV class=gmail_quote>On Wed, Feb 25, 2009 at 11:52 AM, Baoyun Li <SPAN dir=ltr><<A href="mailto:baoyun_li123@yahoo.com" target=_blank rel=nofollow ymailto="mailto:baoyun_li123@yahoo.com">baoyun_li123@yahoo.com</A>></SPAN> wrote:<BR>
<BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV>Dear Luis:</DIV>
<DIV> </DIV>
<DIV>The ITK version I used 3.10.0. I begin to used it at the end of 2008. Do you think that will be a problem?</DIV>
<DIV> </DIV>
<DIV>I will try CVS version or the new relase, and let you know the result.</DIV>
<DIV> </DIV>
<DIV>Is it possible for myself to fix the problem? Or I have to be very familiar with ITK to solve the problem by myself. You know the later work can not be continues once this kind of thing happend.</DIV>
<DIV> </DIV>
<DIV>Thanks and my best regards</DIV>
<DIV> </DIV><FONT color=#888888>
<DIV>Baoyun</DIV></FONT>
<DIV><BR>
<DIV class=WgoR0d> </DIV></DIV>
<DIV class=WgoR0d></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV class=WgoR0d><BR></DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV class=WgoR0d><FONT face=Tahoma size=2>
<HR SIZE=1>
<B><SPAN style="FONT-WEIGHT: bold">From:</SPAN></B> Luis Ibanez <<A href="mailto:luis.ibanez@kitware.com" target=_blank rel=nofollow ymailto="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</A>><BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> Baoyun Li <<A href="mailto:baoyun_li123@yahoo.com" target=_blank rel=nofollow ymailto="mailto:baoyun_li123@yahoo.com">baoyun_li123@yahoo.com</A>><BR><B><SPAN style="FONT-WEIGHT: bold">Cc:</SPAN></B> <A href="mailto:insight-users@itk.org" target=_blank rel=nofollow ymailto="mailto:insight-users@itk.org">insight-users@itk.org</A><BR><B><SPAN style="FONT-WEIGHT: bold">Sent:</SPAN></B> Wednesday, February 25, 2009 10:43:43 AM<BR><B><SPAN style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: ITK FastMarching example--help!!!--the resultion of output images are changed to [1 1 1]<BR></FONT></DIV>
<DIV>
<DIV></DIV>
<DIV class=Wj3C7c><BR><BR>Hi Baoyun,<BR><BR>What version of ITK are you using ?<BR><BR>In a recent release a bug went into the RecursiveGaussianImageFilter, <BR>that resulted in the spacing information being reset to trivial values.<BR><BR>This has now been fixed in the CVS repository.<BR><BR>Could you please try a CVS checkout of ITK ?<BR><BR>FYI: We will be releasing ITK 3.12 by Monday.<BR><BR>Please let us know what you find,<BR><BR><BR> Thanks<BR><BR><BR> Luis<BR><BR><BR>-----------------------------------------<BR>
<DIV class=gmail_quote>On Wed, Feb 25, 2009 at 11:39 AM, Baoyun Li <SPAN dir=ltr><<A href="mailto:baoyun_li123@yahoo.com" target=_blank rel=nofollow ymailto="mailto:baoyun_li123@yahoo.com">baoyun_li123@yahoo.com</A>></SPAN> wrote:<BR>
<BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0..8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif"><FONT face=Arial>
<DIV>Dear All:</DIV>
<DIV> </DIV>
<DIV>When I run ITK example for fastmarching (see the attached code below), the output image resolution are changed to [1 1 1] begining at sigmoid filter output [writer3->SetFileName("../data/FastMarchingFilterOutput3.hdr")]. But my input resolution is [0.7 0.7 2.5]. The first two output files kept the origianl resolution.</DIV>
<DIV> </DIV>
<DIV>I only changed some arguments of the expmale code and the Dimension to 3. My command aruguments are: FastMarchingImageFilter SE1.hdr out.hdr 1000 1001.</DIV>
<DIV> </DIV>
<DIV>ITK deals images on Physical space, now the spacial resolution of images are changed, so I do not how I can trust the results and cannot continue some works, eg mutiple resoltion processing</DIV>
<DIV> </DIV>
<DIV>Can somebody help me to figure out this problem? Thanks a lot.</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Best regards</DIV>
<DIV> </DIV>
<DIV>Baoyun</DIV>
<DIV><BR><BR>#if defined(_MSC_VER)<BR>#pragma warning ( disable : 4786 )<BR>#endif</DIV>
<DIV>#ifdef __BORLANDC__<BR>#define ITK_LEAN_AND_MEAN<BR>#endif</DIV>
<DIV> </DIV>
<DIV><BR>#include "itkCurvatureAnisotropicDiffusionImageFilter.h"</DIV>
<DIV>#include "itkGradientMagnitudeRecursiveGaussianImageFilter.h"<BR>#include "itkSigmoidImageFilter.h"</DIV>
<DIV>#include "itkImage.h"<BR>#include "itkFastMarchingImageFilter.h"</DIV>
<DIV><BR>// Software Guide : BeginCodeSnippet<BR>#include "itkBinaryThresholdImageFilter.h"</DIV>
<DIV><BR>// Software Guide : BeginCodeSnippet<BR>#include "itkImageFileReader.h"<BR>#include "itkImageFileWriter.h"</DIV>
<DIV>// <BR>#include "itkRescaleIntensityImageFilter.h"</DIV>
<DIV><BR>int main( int argc, char *argv[] )<BR>{<BR> if( argc < 3 )<BR> {<BR> std::cerr << "Missing Parameters " << std::endl;<BR> std::cerr << "Usage: " << argv[0];<BR> std::cerr << " inputImage outputImage seedX seedY";<BR> std::cerr << " Sigma SigmoidAlpha SigmoidBeta TimeThreshold StoppingValue" << std::endl;<BR> return 1;<BR> }</DIV>
<DIV><BR> </DIV>
<DIV> // Software Guide : BeginCodeSnippet<BR> typedef float InternalPixelType;<BR> const unsigned int Dimension = 3;<BR> typedef itk::Image< InternalPixelType, Dimension > InternalImageType;<BR> // Software Guide : EndCodeSnippet</DIV>
<DIV> typedef unsigned char OutputPixelType;<BR> typedef itk::Image< OutputPixelType, Dimension > OutputImageType;<BR> // Software Guide : EndCodeSnippet</DIV>
<DIV> typedef itk::BinaryThresholdImageFilter< InternalImageType, <BR> OutputImageType > ThresholdingFilterType;<BR> ThresholdingFilterType::Pointer thresholder = ThresholdingFilterType::New();<BR> </DIV>
<DIV> const InternalPixelType timeThreshold = atof( argv[3] );<BR> <BR> // Software Guide : BeginCodeSnippet<BR> thresholder->SetLowerThreshold( 0.0 );<BR> thresholder->SetUpperThreshold( timeThreshold );</DIV>
<DIV> thresholder->SetOutsideValue( 0 );<BR> thresholder->SetInsideValue( 255 );<BR> <BR> // Software Guide : BeginCodeSnippet<BR> typedef itk::ImageFileReader< InternalImageType > ReaderType;<BR> typedef itk::ImageFileWriter< OutputImageType > WriterType;<BR> // Software Guide : EndCodeSnippet</DIV>
<DIV><BR> ReaderType::Pointer reader = ReaderType::New();<BR> WriterType::Pointer writer = WriterType::New();</DIV>
<DIV> reader->SetFileName( argv[1] );<BR> writer->SetFileName( argv[2] );</DIV>
<DIV><BR> // The RescaleIntensityImageFilter type is declared below. This filter will<BR> // renormalize image before sending them to writers.<BR> //<BR> typedef itk::RescaleIntensityImageFilter< <BR> InternalImageType, <BR> OutputImageType > CastFilterType;</DIV>
<DIV> typedef itk::CurvatureAnisotropicDiffusionImageFilter< <BR> InternalImageType, <BR> InternalImageType > SmoothingFilterType;<BR> <BR> // Software Guide : BeginCodeSnippet<BR> SmoothingFilterType::Pointer smoothing = SmoothingFilterType::New();<BR> </DIV>
<DIV> // Software Guide : BeginCodeSnippet<BR> typedef itk::GradientMagnitudeRecursiveGaussianImageFilter< <BR> InternalImageType, <BR> InternalImageType > GradientFilterType;</DIV>
<DIV> typedef itk::SigmoidImageFilter< <BR> InternalImageType, <BR> InternalImageType > SigmoidFilterType;<BR> <BR> GradientFilterType::Pointer gradientMagnitude = GradientFilterType::New();<BR> SigmoidFilterType::Pointer sigmoid = SigmoidFilterType::New();<BR> // Software Guide : EndCodeSnippet</DIV>
<DIV> </DIV>
<DIV> // Software Guide : BeginCodeSnippet<BR> sigmoid->SetOutputMinimum( 0.0 );<BR> sigmoid->SetOutputMaximum( 1.0 );<BR> </DIV>
<DIV> // Software Guide : BeginCodeSnippet<BR> typedef itk::FastMarchingImageFilter< InternalImageType, <BR> InternalImageType > FastMarchingFilterType;<BR> </DIV>
<DIV> // Software Guide : BeginCodeSnippet<BR> FastMarchingFilterType::Pointer fastMarching = FastMarchingFilterType::New();<BR> <BR> // Software Guide : BeginCodeSnippet<BR> smoothing->SetInput( reader->GetOutput() );<BR> gradientMagnitude->SetInput( smoothing->GetOutput() );<BR> sigmoid->SetInput( gradientMagnitude->GetOutput() );<BR> fastMarching->SetInput( sigmoid->GetOutput() );<BR> thresholder->SetInput( fastMarching->GetOutput() );<BR> writer->SetInput( thresholder->GetOutput() );<BR> // Software Guide : EndCodeSnippet</DIV>
<DIV><BR> </DIV>
<DIV> // Software Guide : BeginCodeSnippet<BR> smoothing->SetTimeStep( 0.05 );<BR> smoothing->SetNumberOfIterations( 10 );<BR> smoothing->SetConductanceParameter( 9.0 );<BR> // Software Guide : EndCodeSnippet</DIV>
<DIV><BR> </DIV>
<DIV> const double sigma = (float) 2.5;//atof( argv[5] );</DIV>
<DIV> // Software Guide : BeginCodeSnippet<BR> gradientMagnitude->SetSigma( sigma );<BR> // Software Guide : EndCodeSnippet</DIV>
<DIV> </DIV>
<DIV> const double alpha = (float)-0.33;//atof( argv[6] );<BR> const double beta = (float) 0.5;//atof( argv[7] );</DIV>
<DIV><BR> // Software Guide : BeginCodeSnippet<BR> sigmoid->SetAlpha( alpha );<BR> sigmoid->SetBeta( beta );<BR> <BR> <BR> typedef FastMarchingFilterType::NodeContainer NodeContainer;<BR> typedef FastMarchingFilterType::NodeType NodeType;<BR> NodeContainer::Pointer seeds = NodeContainer::New();<BR> // Software Guide : EndCodeSnippet <BR> </DIV>
<DIV> InternalImageType::IndexType seedPosition;<BR> <BR> seedPosition[0] = 131;//atoi( argv[3] );<BR> seedPosition[1] = 273;//atoi( argv[4] );<BR> seedPosition[2] = 36;//atoi( argv[4] );</DIV>
<DIV><BR> <BR> NodeType node;<BR> const double seedValue = 0.0;<BR> <BR> node.SetValue( seedValue );<BR> node.SetIndex( seedPosition );<BR> <BR> seeds->Initialize();<BR> seeds->InsertElement( 0, node );<BR> // Software Guide : EndCodeSnippet </DIV>
<DIV> // Software Guide : BeginCodeSnippet<BR> fastMarching->SetTrialPoints( seeds );<BR> // Software Guide : EndCodeSnippet</DIV>
<DIV><BR> // Here we configure all the writers required to see the intermediate<BR> // outputs of the pipeline. This is added here only for<BR> // pedagogical/debugging purposes. These intermediate output are normaly not<BR> // required. Only the output of the final thresholding filter should be<BR> // relevant. Observing intermediate output is helpful in the process of<BR> // fine tuning the parameters of filters in the pipeline. <BR> //<BR> CastFilterType::Pointer caster1 = CastFilterType::New();<BR> CastFilterType::Pointer caster2 = CastFilterType::New();<BR> CastFilterType::Pointer caster3 = CastFilterType::New();<BR> CastFilterType::Pointer caster4 = CastFilterType::New();</DIV>
<DIV> WriterType::Pointer writer1 = WriterType::New();<BR> WriterType::Pointer writer2 = WriterType::New();<BR> WriterType::Pointer writer3 = WriterType::New();<BR> WriterType::Pointer writer4 = WriterType::New();</DIV>
<DIV> caster1->SetInput( smoothing->GetOutput() );<BR> writer1->SetInput( caster1->GetOutput() );<BR> writer1->SetFileName("../data/FastMarchingFilterOutput1..hdr");<BR> caster1->SetOutputMinimum( 0 );<BR> caster1->SetOutputMaximum( 255 );<BR> writer1->Update();</DIV>
<DIV> caster2->SetInput( gradientMagnitude->GetOutput() );<BR> writer2->SetInput( caster2->GetOutput() );<BR> writer2->SetFileName(".../data/FastMarchingFilterOutput2.hdr");<BR> caster2->SetOutputMinimum( 0 );<BR> caster2->SetOutputMaximum( 255 );<BR> writer2->Update();</DIV>
<DIV> caster3->SetInput( sigmoid->GetOutput() );<BR> writer3->SetInput( caster3->GetOutput() );<BR> writer3->SetFileName("../data/FastMarchingFilterOutput3.hdr");<BR> caster3->SetOutputMinimum( 0 );<BR> caster3->SetOutputMaximum( 255 );<BR> writer3->Update();</DIV>
<DIV> caster4->SetInput( fastMarching->GetOutput() );<BR> writer4->SetInput( caster4->GetOutput() );<BR> writer4->SetFileName("../data/FastMarchingFilterOutput4.hdr");<BR> caster4->SetOutputMinimum( 0 );<BR> caster4->SetOutputMaximum( 255 );</DIV>
<DIV><BR> // Software Guide : BeginLatex<BR> <BR> //<BR> // Software Guide : EndLatex </DIV>
<DIV> // Software Guide : BeginCodeSnippet<BR> fastMarching->SetOutputSize( <BR> reader->GetOutput()->GetBufferedRegion().GetSize() );<BR> // Software Guide : EndCodeSnippet</DIV>
<DIV><BR> <BR> //<BR> // Software Guide : EndLatex </DIV>
<DIV> const double stoppingTime = atof( argv[4] );</DIV>
<DIV> // Software Guide : BeginCodeSnippet<BR> fastMarching->SetStoppingValue( stoppingTime );<BR> // Software Guide : EndCodeSnippet</DIV>
<DIV><BR> </DIV>
<DIV> // Software Guide : BeginCodeSnippet<BR> try<BR> {<BR> writer->Update();<BR> }<BR> catch( itk::ExceptionObject & excep )<BR> {<BR> std::cerr << "Exception caught !" << std::endl;<BR> std::cerr << excep << std::endl;<BR> }<BR> // Software Guide : EndCodeSnippet</DIV>
<DIV><BR> writer4->Update();</DIV>
<DIV><BR> // The following writer type is used to save the output of the<BR> // time-crossing map in a file with appropiate pixel representation. The<BR> // advantage of saving this image in native format is that it can be used<BR> // with a viewer to help determine an appropriate threshold to be used on<BR> // the output of the \code{fastmarching} filter.<BR> //<BR> typedef itk::ImageFileWriter< InternalImageType > InternalWriterType;</DIV>
<DIV> InternalWriterType::Pointer mapWriter = InternalWriterType::New();<BR> mapWriter->SetInput( fastMarching->GetOutput() );<BR> mapWriter->SetFileName("../data/FastMarchingFilterOutput5.hdr");<BR> mapWriter->Update();</DIV>
<DIV> InternalWriterType::Pointer speedWriter = InternalWriterType::New();<BR> speedWriter->SetInput( sigmoid->GetOutput() );<BR> speedWriter->SetFileName("../data/FastMarchingFilterOutput6.hdr");<BR> speedWriter->Update();</DIV>
<DIV> InternalWriterType::Pointer gradientWriter = InternalWriterType::New();<BR> gradientWriter->SetInput( gradientMagnitude->GetOutput() );<BR> gradientWriter->SetFileName("../data/FastMarchingFilterOutput7.hdr");<BR> gradientWriter->Update();</DIV>
<DIV><BR> return 0;<BR>}<BR></DIV></FONT>
<DIV style="FONT-SIZE: 12pt; FONT-FAMILY: times new roman, new york, times, serif">
<DIV style="FONT-SIZE: 13px; FONT-FAMILY: arial, helvetica, sans-serif"></DIV></DIV></DIV><BR></DIV></BLOCKQUOTE></DIV><BR></DIV></DIV></DIV></DIV></DIV><BR></DIV></BLOCKQUOTE></DIV><BR></DIV></DIV></div><br>
</body></html>