<DIV>
<FORM name=frmAddAddrs action=http://address.mail.yahoo.com/yab/us?v=YM&amp;.rand=58728&amp;A=m&amp;simp=1 method=post><TT>Hi all,<BR><BR>I am running ITK 1.8.1 and I have been trying to use<BR>the SecondDerivateRecursiveGaussianImageFilter found<BR>at Examples\Filtering\SecondDerivativeRecursiveGaussianImageFilter.cxx<BR>on a large volume (&gt;= 700x700x700) but it always<BR>crashes the first time it reaches the line: <BR><BR>gc-&gt;Update;<BR><BR>The only modification I have made to the example is<BR>that the input and output pixel type is short instead<BR>of float. It runs fine on smaller volumes but crashes<BR>on anything bigger than 700x700x700. <BR><BR>I am posting the code as found in examples with the<BR>float parameter changed to short. I have also posted<BR>some code below it that creates volumes with a sphere<BR>in it. The argument list I used to create my test<BR>volume was: BigSphere.mhd 700 700 700 200 200 200 100.<BR>The first parameter is the name, the next three
 are<BR>the dimensions of the volume, the next three are the<BR>center of the sphere and the last one is the radius of<BR>the sphere. <BR><BR>Does anyone have any ideas what might be causing this?<BR><BR>Thanks!<BR><BR>Robert </TT></FORM>
<DIV id=message>
<DIV><PRE><TT>Volume Creator:</TT></PRE><PRE><TT>#include "itkImage.h"<BR>#include "itkImageFileReader.h"<BR>#include "itkImageFileWriter.h"<BR>#include "itkRecursiveGaussianImageFilter.h"<BR>#include "itkImageDuplicator.h"<BR>#include &lt;string.h&gt;<BR>#include &lt;iostream&gt;<BR>#include &lt;fstream&gt;<BR>#include "itkCastImageFilter.h"<BR>#include "itkRescaleIntensityImageFilter.h"<BR>#include &lt;cmath&gt;<BR>using namespace std;</TT></PRE><TT><PRE><BR>// Function prototypes<BR>int CastUCharTOShortVol( const char *, const char * );</PRE><PRE>int main( int argc, char ** argv)<BR>{<BR>&nbsp; char * inputImageName = argv[1];<BR>&nbsp; char * outputImageName = argv[2];<BR>&nbsp;<BR>&nbsp; CastUCharTOShortVol(inputImageName, outputImageName );</PRE><PRE>&nbsp; return 0;<BR>}</PRE><PRE>int CastUCharTOShortVol( const char * inputFile, const char *
 outputFile )<BR>{<BR>&nbsp; typedef unsigned char&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PixelType;<BR>&nbsp; typedef short&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OutPixelType;<BR>&nbsp; const unsigned int&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dimension = 3;</PRE><PRE>&nbsp; // Define the image type and dimensions<BR>&nbsp; typedef itk::Image&lt; PixelType, Dimension &gt;&nbsp;&nbsp; ImageType;<BR>&nbsp; typedef itk::Image&lt; OutPixelType, Dimension &gt;&nbsp;&nbsp; OutputImageType;</PRE><PRE>&nbsp; // Define typedefs for the readers and writers<BR>&nbsp; typedef itk::ImageFileReader&lt; ImageType &gt;&nbsp; ReaderType;<BR>&nbsp; typedef itk::ImageFileWriter&lt; OutputImageType &gt;&nbsp; WriterType;<BR>&nbsp; typedef itk::CastImageFilter&lt;ImageType, OutputImageType &gt;&nbsp; CastToShortFilterType;<BR>&nbsp; typedef itk::RescaleIntensityImageFilter&lt; ImageType, OutputImageType &gt;&nbsp; RescaleFilterType;</PRE><PRE>&nbsp; // Initialize
 pointers for the readers and writers<BR>&nbsp; ReaderType::Pointer reader = ReaderType::New();<BR>&nbsp; WriterType::Pointer writer = WriterType::New();<BR>&nbsp; CastToShortFilterType::Pointer castToShortFilter = CastToShortFilterType::New();<BR>&nbsp; RescaleFilterType::Pointer rescaleFilter = RescaleFilterType::New();<BR>&nbsp; <BR>&nbsp; // Set the input and output file names for the reader and writer<BR>&nbsp; reader-&gt;SetFileName( inputFile );<BR>&nbsp; writer-&gt;SetFileName( outputFile );</PRE><PRE>&nbsp; // We can now access the input in the variable 'image'<BR>&nbsp; ImageType::Pointer image = reader-&gt;GetOutput();</PRE><PRE>&nbsp; // Convert the image to float<BR>&nbsp; castToShortFilter-&gt;SetInput( image );<BR>//&nbsp; rescaleFilter-&gt;SetInput(image);<BR>//&nbsp; rescaleFilter-&gt;SetOutputMinimum(&nbsp; 0);<BR>//&nbsp; rescaleFilter-&gt;SetOutputMaximum(255);&nbsp; <BR>&nbsp;<BR>&nbsp; // Set the input of the writer as the output of castToFloatFilter<BR>&nbsp;
 writer-&gt;SetInput ( castToShortFilter-&gt;GetOutput() );</PRE><PRE>&nbsp; // Update the writer to send the image to the file specified by outFileName <BR>&nbsp; // and outDataFileName<BR>&nbsp; try <BR>&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp; writer-&gt;Update(); <BR>&nbsp;&nbsp;&nbsp; } <BR>&nbsp; catch( itk::ExceptionObject &amp; err ) <BR>&nbsp;&nbsp;&nbsp; { <BR>&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; "ExceptionObject caught !" &lt;&lt; std::endl; <BR>&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; err &lt;&lt; std::endl; <BR>&nbsp;&nbsp;&nbsp; return -1;<BR>&nbsp;&nbsp;&nbsp; }</PRE><PRE>&nbsp; return 0;<BR>}</PRE>SecondDerivativeRecursiveGaussianImageFilter<PRE>#include "itkRecursiveGaussianImageFilter.h"<BR>#include "itkImageFileReader.h"<BR>#include "itkImageFileWriter.h"<BR>#include "itkImageDuplicator.h"<BR>#include "itkImage.h"<BR>#include &lt;string&gt;</PRE><PRE><BR>int main(int argc, char * argv [] )<BR>{</PRE><PRE>&nbsp; if( argc &lt; 3 )<BR>&nbsp;&nbsp;&nbsp;
 {<BR>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "Usage: " &lt;&lt; std::endl;<BR>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "SecondDerivativeRecursiveGaussianImageFilter inputImage outputPrefix&nbsp; [sigma] " &lt;&lt; std::endl;<BR>&nbsp;&nbsp;&nbsp; return -1;<BR>&nbsp;&nbsp;&nbsp; }</PRE><PRE>&nbsp; typedef short&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PixelType;<BR>&nbsp; typedef short&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OutputPixelType;</PRE><PRE>&nbsp; const unsigned int&nbsp; Dimension = 3;</PRE><PRE>&nbsp; typedef itk::Image&lt; PixelType,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dimension &gt;&nbsp; ImageType;<BR>&nbsp; typedef itk::Image&lt; OutputPixelType, Dimension &gt;&nbsp; OutputImageType;<BR>&nbsp;<BR>&nbsp; typedef itk::ImageFileReader&lt; ImageType&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &gt;&nbsp;&nbsp; ReaderType;<BR>&nbsp; typedef itk::ImageFileWriter&lt; OutputImageType &gt;&nbsp;&nbsp; WriterType;</PRE><PRE>&nbsp; typedef
 itk::ImageDuplicator&lt; OutputImageType &gt;&nbsp;&nbsp; DuplicatorType;</PRE><PRE>&nbsp; typedef itk::RecursiveGaussianImageFilter&lt; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ImageType, <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ImageType &gt;&nbsp; FilterType;</PRE><PRE>&nbsp; ReaderType::Pointer&nbsp; reader&nbsp; = ReaderType::New();<BR>&nbsp; WriterType::Pointer&nbsp; writer&nbsp; = WriterType::New();</PRE><PRE>&nbsp; DuplicatorType::Pointer duplicator&nbsp; = DuplicatorType::New();</PRE><PRE>&nbsp; reader-&gt;SetFileName( argv[1] );<BR>&nbsp; <BR>&nbsp; std::string outputPrefix = argv[2];<BR>&nbsp; std::string
 outputFileName;</PRE><PRE>&nbsp; try<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; reader-&gt;Update();<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp; catch( itk::ExceptionObject &amp; excp )<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; "Problem reading the input file" &lt;&lt; std::endl;<BR>&nbsp;&nbsp;&nbsp; std::cerr &lt;&lt; excp &lt;&lt; std::endl;<BR>&nbsp;&nbsp;&nbsp; return -1;<BR>&nbsp;&nbsp;&nbsp; }</PRE><PRE>&nbsp; FilterType::Pointer ga = FilterType::New();<BR>&nbsp; FilterType::Pointer gb = FilterType::New();<BR>&nbsp; FilterType::Pointer gc = FilterType::New();</PRE><PRE>&nbsp; ga-&gt;SetDirection( 0 );<BR>&nbsp; gb-&gt;SetDirection( 1 );<BR>&nbsp; gc-&gt;SetDirection( 2 );</PRE><PRE>&nbsp; if( argc &gt; 3 )<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp; const float sigma = atof( argv[3] );<BR>&nbsp;&nbsp;&nbsp; ga-&gt;SetSigma( sigma );<BR>&nbsp;&nbsp;&nbsp; gb-&gt;SetSigma( sigma );<BR>&nbsp;&nbsp;&nbsp; gc-&gt;SetSigma( sigma );<BR>&nbsp;&nbsp;&nbsp;
 }</PRE><PRE>&nbsp; ga-&gt;SetZeroOrder();<BR>&nbsp; gb-&gt;SetZeroOrder();<BR>&nbsp; gc-&gt;SetSecondOrder();</PRE><PRE>&nbsp; ImageType::Pointer inputImage = reader-&gt;GetOutput();</PRE><PRE>&nbsp; ga-&gt;SetInput( inputImage );<BR>&nbsp; gb-&gt;SetInput( ga-&gt;GetOutput() );<BR>&nbsp; gc-&gt;SetInput( gb-&gt;GetOutput() );</PRE><PRE>&nbsp; duplicator-&gt;SetInputImage( gc-&gt;GetOutput() );</PRE><PRE><BR>&nbsp; gc-&gt;Update(); <BR>&nbsp; duplicator-&gt;Update();</PRE><PRE>&nbsp; ImageType::Pointer Izz = duplicator-&gt;GetOutput();</PRE><PRE>&nbsp; writer-&gt;SetInput( Izz );<BR>&nbsp; outputFileName = outputPrefix + "-Izz.mhd";<BR>&nbsp; writer-&gt;SetFileName( outputFileName.c_str() );<BR>&nbsp; writer-&gt;Update();</PRE><PRE>&nbsp; gc-&gt;SetDirection( 1 );&nbsp; // gc now works along Y<BR>&nbsp; gb-&gt;SetDirection( 2 );&nbsp; // gb now works along Z</PRE><PRE>&nbsp; gc-&gt;Update();<BR>&nbsp; duplicator-&gt;Update();</PRE><PRE>&nbsp; ImageType::Pointer Iyy =
 duplicator-&gt;GetOutput();</PRE><PRE>&nbsp; writer-&gt;SetInput( Iyy );<BR>&nbsp; outputFileName = outputPrefix + "-Iyy.mhd";<BR>&nbsp; writer-&gt;SetFileName( outputFileName.c_str() );<BR>&nbsp; writer-&gt;Update();</PRE><PRE><BR>&nbsp; gc-&gt;SetDirection( 0 );&nbsp; // gc now works along X<BR>&nbsp; ga-&gt;SetDirection( 1 );&nbsp; // ga now works along Y</PRE><PRE>&nbsp; gc-&gt;Update();<BR>&nbsp; duplicator-&gt;Update();</PRE><PRE>&nbsp; ImageType::Pointer Ixx = duplicator-&gt;GetOutput();</PRE><PRE>&nbsp; writer-&gt;SetInput( Ixx );<BR>&nbsp; outputFileName = outputPrefix + "-Ixx.mhd";<BR>&nbsp; writer-&gt;SetFileName( outputFileName.c_str() );<BR>&nbsp; writer-&gt;Update();</PRE><PRE><BR>&nbsp; ga-&gt;SetDirection( 0 );<BR>&nbsp; gb-&gt;SetDirection( 1 );<BR>&nbsp; gc-&gt;SetDirection( 2 );</PRE><PRE>&nbsp; ga-&gt;SetZeroOrder();<BR>&nbsp; gb-&gt;SetFirstOrder();<BR>&nbsp; gc-&gt;SetFirstOrder();</PRE><PRE>&nbsp; gc-&gt;Update();<BR>&nbsp;
 duplicator-&gt;Update();</PRE><PRE>&nbsp; ImageType::Pointer Iyz = duplicator-&gt;GetOutput();</PRE><PRE>&nbsp; writer-&gt;SetInput( Iyz );<BR>&nbsp; outputFileName = outputPrefix + "-Iyz.mhd";<BR>&nbsp; writer-&gt;SetFileName( outputFileName.c_str() );<BR>&nbsp; writer-&gt;Update();</PRE><PRE><BR>&nbsp; ga-&gt;SetDirection( 1 );<BR>&nbsp; gb-&gt;SetDirection( 0 );<BR>&nbsp; gc-&gt;SetDirection( 2 );</PRE><PRE>&nbsp; ga-&gt;SetZeroOrder();<BR>&nbsp; gb-&gt;SetFirstOrder();<BR>&nbsp; gc-&gt;SetFirstOrder();</PRE><PRE>&nbsp; gc-&gt;Update();<BR>&nbsp; duplicator-&gt;Update();</PRE><PRE>&nbsp; ImageType::Pointer Ixz = duplicator-&gt;GetOutput();</PRE><PRE>&nbsp; writer-&gt;SetInput( Ixz );<BR>&nbsp; outputFileName = outputPrefix + "-Ixz.mhd";<BR>&nbsp; writer-&gt;SetFileName( outputFileName.c_str() );<BR>&nbsp; writer-&gt;Update();</PRE><PRE>&nbsp; ga-&gt;SetDirection( 2 );<BR>&nbsp; gb-&gt;SetDirection( 0 );<BR>&nbsp; gc-&gt;SetDirection( 1 );</PRE><PRE>&nbsp;
 ga-&gt;SetZeroOrder();<BR>&nbsp; gb-&gt;SetFirstOrder();<BR>&nbsp; gc-&gt;SetFirstOrder();</PRE><PRE>&nbsp; gc-&gt;Update();<BR>&nbsp; duplicator-&gt;Update();</PRE><PRE>&nbsp; ImageType::Pointer Ixy = duplicator-&gt;GetOutput();</PRE><PRE>&nbsp; writer-&gt;SetInput( Ixy );<BR>&nbsp; outputFileName = outputPrefix + "-Ixy.mhd";<BR>&nbsp; writer-&gt;SetFileName( outputFileName.c_str() );<BR>&nbsp; writer-&gt;Update();</PRE><PRE>&nbsp; // Software Guide : EndCodeSnippet<BR>&nbsp; <BR>return 0;<BR>}</PRE></TT></DIV></DIV></DIV><p>
        
                <hr size=1>Do you Yahoo!?<br> 
Check out the new Yahoo! Front Page. <a href="http://www.yahoo.com">www.yahoo.com</a>