<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hello, <br><br>Thank you for your reply again. <br>I am using ITK-3.20.0 version. <br>The source code is as follows, in it, the "ABC Dicom Loader" is a VTK based data loader. Hope it could be helpful to figure out its error.: <br>******************************************************************************************<br>#if defined(_MSC_VER)<br>#pragma warning ( disable : 4786 )<br>#endif<br><br>#ifdef __BORLANDC__<br>#define ITK_LEAN_AND_MEAN<br>#endif<br><br>//for DCMTK<br>#define HAVE_CONFIG_H 1 <br>#include &lt;osconfig.h&gt;<br><br>#include &lt;iostream&gt;<br>#include &lt;fstream&gt;<br>#include &lt;sstream&gt;<br>#include &lt;cstring&gt;<br>#include &lt;string&gt;<br>#include &lt;stdio.h&gt;<br>#include &lt;stdlib.h&gt;<br><br>#include "BaseData.h"<br><br>//for casting to float and converting to ITK image<br>#include "vtkImageCast.h"<br>#include
 "./Headerfiles/itkVTKImageToImageFilter.h"<br>#include "itkCastImageFilter.h"<br><br><br><br>//for geodesic active contor segmentation<br>#include "itkGradientAnisotropicDiffusionImageFilter.h"<br>#include "itkScalarImageToHistogramGenerator.h"<br><br>//for itk images<br>#include "itkImage.h"<br>#include "itkImageRegionIterator.h"<br>#include "itkImageRegionConstIterator.h"<br>#include "itkCovariantVector.h"<br>#include "itkImageRegionConstIterator.h"<br>#include "itkImageRegionIterator.h"<br><br>//for itk vector<br>#include "itkVector.h"<br><br>//modified ITK classes<br>#include "./Headerfiles/VavGradientVectorFlowImageFilter.h"<br>#include "./Headerfiles/VavEdgeEnhancingDiffusionImageFilter.h"<br><br>//header files for reading/writing dicom series<br>#include "itkImage.h"<br>#include "itkGDCMImageIO.h"<br>#include "itkOrientedImage.h"<br>#include "itkImageFileReader.h"<br>#include "itkImageFileWriter.h"<br>#include "itkImageSeriesReader.h"<br>#include
 "itkGDCMSeriesFileNames.h"<br><br>//header files for Demons algorithm registration<br>#include "itkCastImageFilter.h"<br>#include "itkWarpImageFilter.h"<br>#include "itkHistogramMatchingImageFilter.h"<br>#include "itkLinearInterpolateImageFunction.h"<br>#include "itkSymmetricForcesDemonsRegistrationFilter.h"<br>#include "itkDemonsRegistrationFilter.h" <br><br>//for reading images<br>#include &lt;QtGui&gt;<br>#include "DICOMLoader.h"<br>//#include "dicomviewer2d.h"<br>#include "ContentTree.h"<br>#include "ContentItem.h"<br>#include &lt;QtUiTools&gt;<br>#include "/usr/local/include/vtk-5.2/QVTKWidget.h"<br>#include &lt;QMainWindow&gt;<br>#include &lt;QVBoxLayout&gt;<br>#include &lt;QSlider&gt;<br>#include &lt;QtGui&gt;<br><br>//for converting itk result back to vtk<br>#include "itkImageToVTKImageFilter.h"<br><br>//for interpolator <br>#include "itkContinuousIndex.h"<br>#include "itkLinearInterpolateImageFunction.h"<br><br>// image types<br>const unsigned
 int Dimension = 3;<br>typedef unsigned short PixelType;<br>typedef float InternalPixelType;<br>typedef itk::Image&lt; InternalPixelType, Dimension &gt; InternalImageType;<br>typedef itk::Image&lt; float, 3 &gt; ImageType;<br>typedef itk::Image&lt; float, 3 &gt; ShapeImageType;<br>typedef itk::Image&lt; int, 3 &gt; IntegerImageType;<br>typedef itk::VTKImageToImageFilter&lt;ImageType&gt; VTKImageToImageType;<br>typedef itk::Image&lt; unsigned char, 3 &gt;&nbsp; OutputImageType;// 2D output image for .png writers<br>typedef itk::CovariantVector&lt;float, 3&gt;&nbsp; GradientPixelType;<br>typedef itk::Image&lt;GradientPixelType,3&gt; GradientImageType;<br>typedef itk::Image&lt; PixelType, Dimension &gt;&nbsp; FixedImageType;<br>typedef itk::Image&lt; PixelType, Dimension &gt;&nbsp; MovingImageType;<br>// region iterators<br>typedef itk::ImageRegionConstIterator&lt;ImageType&gt; ImageConstIterator;<br>typedef
 itk::ImageRegionConstIterator&lt;OutputImageType&gt; ImageConstIteratorChar;<br>typedef itk::ImageRegionIterator&lt;ImageType&gt; ImageIterator;<br>typedef itk::ImageRegionIterator&lt;GradientImageType&gt; DerivativeImageIterator;<br><br><br>//define filters<br>typedef itk::VTKImageToImageFilter &lt; InternalImageType &gt;&nbsp; VTK2ITKConnectorFilterType;<br>//matchingfilter type<br>typedef itk::HistogramMatchingImageFilter&lt;InternalImageType, InternalImageType &gt; MatchingFilterType;<br><br>//deformation field type<br>typedef itk::Vector&lt; float, Dimension &gt;&nbsp;&nbsp;&nbsp; VectorPixelType;<br>typedef itk::Image&lt;&nbsp; VectorPixelType, Dimension &gt; DeformationFieldType;<br><br>// writers<br>typedef itk::ImageFileWriter&lt; OutputImageType &gt;&nbsp; WriterType;<br>typedef itk::ImageFileWriter&lt; ImageType &gt;&nbsp;&nbsp;&nbsp; WriterTypeDouble;<br>typedef itk::ImageFileWriter&lt; GradientImageType &gt;&nbsp;
 WriterTypeGradient;<br>typedef itk::ImageFileWriter&lt; DeformationFieldType &gt; FieldWriterType;<br><br>// reader<br>typedef itk::ImageFileReader&lt; ImageType &gt; ReaderType;<br>typedef itk::ImageFileReader&lt; GradientImageType &gt;&nbsp; ReaderTypeGradient;<br><br><br>//registration filter type<br>&nbsp; typedef itk::SymmetricForcesDemonsRegistrationFilter<br>&nbsp;&nbsp;&nbsp; &nbsp; &lt;InternalImageType,InternalImageType,DeformationFieldType&gt;&nbsp; RegistrationFilterType;<br><br>//warper type<br>&nbsp; typedef itk::WarpImageFilter&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; 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;
 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; DeformationFieldType&gt;&nbsp;&nbsp;&nbsp;&nbsp; WarperType;<br><br>//interpolator type<br>&nbsp; typedef itk::LinearInterpolateImageFunction&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; ImageType, double&gt;&nbsp; InterpolatorType;<br><br>//output image type<br>&nbsp; typedef&nbsp; unsigned char&nbsp; OutputPixelType;<br>&nbsp; typedef itk::Image&lt; OutputPixelType, Dimension &gt; OutputImageType;<br><br>//castfilter type<br>&nbsp; typedef itk::CastImageFilter&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;
 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; OutputImageType &gt; CastFilterType;<br><br>//itk to vtk connector<br>typedef itk::ImageToVTKImageFilter&lt; ImageType &gt; ConnectorType;<br><br><br><br><br>using namespace std;<br><br>//implements a command observer<br>class CommandIterationUpdate : public itk::Command <br>{<br>&nbsp;public:<br>&nbsp;typedef&nbsp; CommandIterationUpdate&nbsp;&nbsp; Self;<br>&nbsp;typedef&nbsp; itk::Command&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Superclass;<br>&nbsp;typedef&nbsp; itk::SmartPointer&lt;CommandIterationUpdate&gt;&nbsp; Pointer;<br>&nbsp;itkNewMacro( CommandIterationUpdate );<br>&nbsp;protected:<br>&nbsp;CommandIterationUpdate() {};<br><br>// typedef itk::Image&lt; float, 3 &gt; InternalImageType;<br><br>&nbsp;typedef itk::Image&lt; InternalPixelType, Dimension &gt;
 InternalImageType;<br>&nbsp;typedef itk::Vector&lt; float, 3 &gt;&nbsp;&nbsp;&nbsp; VectorPixelType;<br>&nbsp;typedef itk::Image&lt;&nbsp; VectorPixelType, 3 &gt; DeformationFieldType;<br><br><br>&nbsp;public:<br><br>&nbsp;void Execute(itk::Object *caller, const itk::EventObject &amp; event)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Execute( (const itk::Object *)caller, event);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>void Execute(const itk::Object * object, const itk::EventObject &amp; event)<br>&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const RegistrationFilterType * filter = <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dynamic_cast&lt; const RegistrationFilterType * &gt;( object );<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if( !(itk::IterationEvent().CheckEvent( &amp;event )) )<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cout &lt;&lt; filter-&gt;GetMetric() &lt;&lt;endl;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp; };<br><br><br>int main( int argc, char * argv[] )<br>{<br><br><br>&nbsp;&nbsp;&nbsp; //////////////////////////////////////////////<br>&nbsp;&nbsp;&nbsp; //////////// READING IMAGES /////////////////<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ////////////////////////////////////////////<br><br><br>/////////////////////////////////////<br>/// Reading the fixed image ////////<br>///////////////////////////////////<br><br>&nbsp;&nbsp;&nbsp; ABC::Loader::DICOMLoader* fixedImageLoader = new ABC::Loader::DICOMLoader();<br>&nbsp;&nbsp;&nbsp; ABC::Data::BaseData*&nbsp;&nbsp;&nbsp; fixedImageData= new ABC::Data::BaseData();<br>&nbsp;&nbsp;&nbsp; ContentTree *fixedImageTree;<br>&nbsp;&nbsp;&nbsp; ContentItem* fixedImageItem;<br><br><br><br>&nbsp;&nbsp; fixedImageTree=NULL;<br><br>&nbsp;&nbsp;&nbsp; fixedImageTree =
 fixedImageLoader-&gt;LoadDataContent(argv[1]);<br>&nbsp; <br><br><br>&nbsp;&nbsp;&nbsp; fixedImageItem = fixedImageTree-&gt;GetFistItem()-&gt;GetFirstItem(); // first study first series<br>&nbsp;&nbsp;&nbsp; cout &lt;&lt; " 1.2" &lt;&lt; fixedImageItem-&gt;GetDescription()&nbsp; &lt;&lt; endl;<br>&nbsp;&nbsp;&nbsp; cout &lt;&lt; " 1.2" &lt;&lt; fixedImageItem-&gt;GetID()&nbsp; &lt;&lt; endl;<br>&nbsp;&nbsp;&nbsp; cout &lt;&lt; " 1.2" &lt;&lt; fixedImageItem-&gt;GetFSPath() &lt;&lt; endl;<br><br>&nbsp;&nbsp;&nbsp; /// LOAD DATA !!!<br><br>&nbsp;&nbsp;&nbsp; fixedImageData = fixedImageLoader-&gt;LoadData(fixedImageItem);<br><br>&nbsp;&nbsp;&nbsp; vector&lt;int&gt; dimensionsFixed = fixedImageData-&gt;GetScalar()-&gt;GetDimensions();<br>&nbsp;&nbsp;&nbsp; printf("Dimensions %d %d %d \n", dimensionsFixed[0], dimensionsFixed[1], dimensionsFixed[2]);<br><br>&nbsp;&nbsp;&nbsp; vector&lt;double&gt; SpacingFixed =
 fixedImageData-&gt;GetScalar()-&gt;GetSpacing();<br>&nbsp;&nbsp;&nbsp; printf("Spacing %f %f %f \n", SpacingFixed[0], SpacingFixed[1], SpacingFixed[2]);<br>cout&lt;&lt;"The end! "&lt;&lt;endl&lt;&lt;endl&lt;&lt;endl;<br>&nbsp;&nbsp;&nbsp; double* bndFixed = fixedImageData-&gt;GetScalar()-&gt;GetImageData()-&gt;GetBounds();<br>&nbsp;&nbsp;&nbsp; printf("Bounds1 %lf %lf %lf %lf %lf %lf \n", bndFixed[0], bndFixed[1], bndFixed[2], bndFixed[3], bndFixed[4], bndFixed[5]);<br><br><br><br>&nbsp;&nbsp; vtkImageCast* VtkCasterFixed = vtkImageCast::New(); // Casting to float in VTK is needed<br>&nbsp;&nbsp; VtkCasterFixed-&gt;SetInput(fixedImageData -&gt; GetScalar() -&gt; GetImageData());<br>&nbsp;&nbsp; VtkCasterFixed-&gt;SetOutputScalarTypeToFloat();<br><br>&nbsp;&nbsp; VTK2ITKConnectorFilterType::Pointer VTK2ITKconnectorFixed = VTKImageToImageType::New();<br>&nbsp;&nbsp; VTK2ITKconnectorFixed-&gt;SetInput( VtkCasterFixed-&gt;GetOutput());<br>&nbsp;&nbsp;
 VTK2ITKconnectorFixed-&gt;GetImporter()-&gt;Update();<br><br><br><br>/////////////////////////////////////<br>/// Reading the moving image ////////<br>///////////////////////////////////<br><br>&nbsp;&nbsp;&nbsp; ABC::Loader::DICOMLoader* movingImageLoader = new ABC::Loader::DICOMLoader();<br>&nbsp;&nbsp;&nbsp; ABC::Data::BaseData*&nbsp;&nbsp;&nbsp; movingImageData= new ABC::Data::BaseData();<br>&nbsp;&nbsp;&nbsp; ContentTree *movingImageTree;<br>&nbsp;&nbsp;&nbsp; ContentItem* movingImageItem;<br><br>&nbsp;&nbsp;&nbsp; movingImageTree = movingImageLoader-&gt;LoadDataContent(argv[2]);<br><br>&nbsp;&nbsp;&nbsp; movingImageItem = movingImageTree-&gt;GetFistItem()-&gt;GetFirstItem(); // first study first series<br>&nbsp;&nbsp;&nbsp; cout &lt;&lt; " 1.2" &lt;&lt; movingImageItem-&gt;GetDescription()&nbsp; &lt;&lt; endl;<br>&nbsp;&nbsp;&nbsp; cout &lt;&lt; " 1.2" &lt;&lt; movingImageItem-&gt;GetID()&nbsp; &lt;&lt; endl;<br>&nbsp;&nbsp;&nbsp; cout &lt;&lt; "
 1.2" &lt;&lt; movingImageItem-&gt;GetFSPath() &lt;&lt; endl;<br><br>&nbsp;&nbsp;&nbsp; /// LOAD DATA !!!<br><br>&nbsp;&nbsp;&nbsp; movingImageData = movingImageLoader-&gt;LoadData(fixedImageItem);<br><br>&nbsp;&nbsp;&nbsp; vector&lt;int&gt; dimensionsMoving = movingImageData-&gt;GetScalar()-&gt;GetDimensions();<br>&nbsp;&nbsp;&nbsp; printf("Dimensions %d %d %d \n", dimensionsMoving[0], dimensionsMoving[1], dimensionsMoving[2]);<br><br>&nbsp;&nbsp;&nbsp; vector&lt;double&gt; SpacingMoving = movingImageData-&gt;GetScalar()-&gt;GetSpacing();<br>&nbsp;&nbsp;&nbsp; printf("Spacing %f %f %f \n", SpacingMoving[0], SpacingMoving[1], SpacingMoving[2]);<br><br>&nbsp;&nbsp;&nbsp; double* bndMoving = movingImageData-&gt;GetScalar()-&gt;GetImageData()-&gt;GetBounds();<br>&nbsp;&nbsp;&nbsp; printf("Bounds1 %lf %lf %lf %lf %lf %lf \n", bndMoving[0], bndMoving[1], bndMoving[2], bndMoving[3], bndMoving[4], bndMoving[5]);<br><br>//<br><br>&nbsp;&nbsp; vtkImageCast*
 VtkCasterMoving = vtkImageCast::New(); // Casting to float in VTK is needed<br>&nbsp;&nbsp; VtkCasterMoving-&gt;SetInput(movingImageData -&gt; GetScalar() -&gt; GetImageData());<br>&nbsp;&nbsp; VtkCasterMoving-&gt;SetOutputScalarTypeToFloat();<br>&nbsp;&nbsp; VTK2ITKConnectorFilterType::Pointer VTK2ITKconnectorMoving = VTKImageToImageType::New();<br>&nbsp;&nbsp; VTK2ITKconnectorMoving-&gt;SetInput( VtkCasterMoving-&gt;GetOutput());<br>&nbsp;&nbsp; VTK2ITKconnectorMoving-&gt;GetImporter()-&gt;Update();<br><br><br>/////////////////////////////////////////////<br>// Demons registration starts from here ////<br>///////////////////////////////////////////<br><br>// The basic idea is to match the histograms of the two images at a user-specified number of quantile values.&nbsp; <br>&nbsp; MatchingFilterType::Pointer matcher = MatchingFilterType::New();<br>&nbsp; matcher-&gt;SetInput( VTK2ITKconnectorMoving-&gt;GetOutput() );<br>&nbsp;
 matcher-&gt;SetReferenceImage( VTK2ITKconnectorFixed-&gt;GetOutput() );<br><br><br><br><br><br>//select the number of bins to represent the histograms and the<br>// number of points or quantile values where the histogram is to be<br>// matched.<br>&nbsp; matcher-&gt;SetNumberOfHistogramLevels( 1024 );<br>&nbsp; matcher-&gt;SetNumberOfMatchPoints( 7 );<br><br>// Simple background extraction is done by thresholding at the mean intensity.<br>&nbsp; matcher-&gt;ThresholdAtMeanIntensityOn();<br><br>//the deformation field is represented as an image whose pixels are floating point vectors.<br>&nbsp; RegistrationFilterType::Pointer filter = RegistrationFilterType::New();<br><br>//Create the Command observer and register it with the registration filter.<br>&nbsp; CommandIterationUpdate::Pointer observer = CommandIterationUpdate::New();<br>&nbsp; filter-&gt;AddObserver( itk::IterationEvent(), observer );<br>&nbsp; filter-&gt;SetFixedImage(
 VTK2ITKconnectorFixed-&gt;GetOutput() );<br>&nbsp; filter-&gt;SetMovingImage( matcher-&gt;GetOutput() );<br><br><br>&nbsp; filter-&gt;SetNumberOfIterations( 1.0 );<br>&nbsp; filter-&gt;SetStandardDeviations( 1.0 );<br><br><br>&nbsp; filter-&gt;Update(); //the filter output is the computed deformation field <br>&nbsp;<br><br>//warp the moving image with the output deformation field&nbsp; <br>&nbsp; WarperType::Pointer warper = WarperType::New();<br>&nbsp; InterpolatorType::Pointer interpolator = InterpolatorType::New();<br><br>&nbsp; typedef itk::CastImageFilter&lt; ImageType, InternalImageType &gt; FixedImageCasterType;<br>&nbsp; typedef itk::CastImageFilter&lt; ImageType, InternalImageType &gt; MovingImageCasterType;<br><br><br>&nbsp; FixedImageCasterType::Pointer fixedImageCaster&nbsp;&nbsp; = FixedImageCasterType::New();<br>&nbsp; MovingImageCasterType::Pointer movingImageCaster = MovingImageCasterType::New();<br><br>&nbsp;
 fixedImageCaster-&gt;SetInput( VTK2ITKconnectorFixed-&gt;GetOutput() );<br>&nbsp; movingImageCaster-&gt;SetInput( VTK2ITKconnectorMoving-&gt;GetOutput() ); <br><br>&nbsp; ImageType::Pointer fixedImage = fixedImageCaster-&gt;GetOutput();<br>&nbsp; ImageType::Pointer movingImage = movingImageCaster-&gt;GetOutput();<br><br>&nbsp; warper-&gt;SetInput( movingImage );<br>&nbsp; warper-&gt;SetInterpolator( interpolator );<br>&nbsp; warper-&gt;SetOutputSpacing( fixedImage-&gt;GetSpacing() );<br>&nbsp; warper-&gt;SetOutputOrigin( fixedImage-&gt;GetOrigin() );<br>&nbsp; warper-&gt;SetOutputDirection( fixedImage-&gt;GetDirection() );<br>&nbsp; warper-&gt;SetDeformationField( filter-&gt;GetOutput() );<br><br>// Write warped image out to file<br>&nbsp; WriterType::Pointer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writer =&nbsp; WriterType::New();<br>&nbsp; CastFilterType::Pointer&nbsp; caster =&nbsp; CastFilterType::New();<br><br>&nbsp; writer-&gt;SetFileName( argv[3]
 );<br>&nbsp; <br>&nbsp; caster-&gt;SetInput( warper-&gt;GetOutput() );<br>&nbsp; writer-&gt;SetInput( caster-&gt;GetOutput()&nbsp;&nbsp; );<br>&nbsp; writer-&gt;Update();<br><br><br><br>if( argc &gt; 4 ) <br>&nbsp; {<br><br>&nbsp; FieldWriterType::Pointer fieldWriter = FieldWriterType::New();<br>&nbsp; fieldWriter-&gt;SetFileName( argv[6] );<br><br>&nbsp; fieldWriter-&gt;SetInput( filter-&gt;GetOutput() );<br>&nbsp; fieldWriter-&gt;Update();<br>&nbsp;&nbsp;&nbsp; }<br><br><br>return EXIT_SUCCESS;<br><br>&nbsp;&nbsp;&nbsp; }<br><br><br><br><br><br>--- On <b>Fri, 3/25/11, Ariel Hernán Curiale <i>&lt;curiale@gmail.com&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Ariel Hernán Curiale &lt;curiale@gmail.com&gt;<br>Subject: Re: [Insight-users] Itk Segmentation Fault<br>To: "akbarjan bayiz" &lt;abayiz@yahoo.com&gt;<br>Cc: insight-users@itk.org<br>Date: Friday, March 25, 2011,
 7:21 AM<br><br><div id="yiv707525447">What ITK version are running ?<div><br></div><div>Another things is that "DeformationPixelType" need to be a float or double.</div><div><br></div><div>Please post the source code.</div><div><br></div><div><br><div>
<span class="yiv707525447Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><div>Saludos</div><div>Ariel Hernán Curiale</div><div><a rel="nofollow" target="_blank" href="http://www.curiale.com.ar">www.curiale.com.ar</a></div><div><br></div></span><br class="yiv707525447Apple-interchange-newline">
</div>
<br><div><div>El 25/03/2011, a las 12:54, akbarjan bayiz escribió:</div><br class="yiv707525447Apple-interchange-newline"><blockquote type="cite"><table style="" border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font: inherit;" valign="top">Hello!<br><br>Thank you for your reply. <br>I've done it as you said, changed the data types, but unfortunately it gives out a full screen of error now. I am trying to read two dicom series from two different directories, and perform Demons registration, then save the output as a new dicom file. Maybe this is different from what you are doing, and that is why your data type does not work for my code I think. <br><br>Do you have any other good suggestions? <br><br>Best Regards, <br><br>--- On <b>Fri, 3/25/11, Ariel Hernán Curiale <i>&lt;<a rel="nofollow" ymailto="mailto:curiale@gmail.com" target="_blank" href="/mc/compose?to=curiale@gmail.com">curiale@gmail.com</a>&gt;</i></b> wrote:<br><blockquote
 style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Ariel Hernán Curiale &lt;<a rel="nofollow" ymailto="mailto:curiale@gmail.com" target="_blank" href="/mc/compose?to=curiale@gmail.com">curiale@gmail.com</a>&gt;<br>Subject: Re: [Insight-users] Itk Segmentation Fault<br>To: "akbarjan bayiz" &lt;<a rel="nofollow" ymailto="mailto:abayiz@yahoo.com" target="_blank" href="/mc/compose?to=abayiz@yahoo.com">abayiz@yahoo.com</a>&gt;<br>Cc:
 <a rel="nofollow" ymailto="mailto:insight-users@itk.org" target="_blank" href="/mc/compose?to=insight-users@itk.org">insight-users@itk.org</a><br>Date: Friday, March 25, 2011, 5:34 AM<br><br><div id="yiv707525447">Hi, Im recently used this class &nbsp;and I had no errors. &nbsp;This is my code:<div><br></div><div><span class="yiv707525447Apple-tab-span" style="white-space: pre;">                </span>&nbsp;&nbsp;<font class="yiv707525447Apple-style-span" face="Menlo" size="3"><span class="yiv707525447Apple-style-span" style="font-size: 11px;"><font class="yiv707525447Apple-style-span" color="#010101">typedef</font></span></font><font class="yiv707525447Apple-style-span" face="Menlo" size="3"><span class="yiv707525447Apple-style-span" style="font-size: 11px;"><font class="yiv707525447Apple-style-span" color="#010101"> </font></span></font><font class="yiv707525447Apple-style-span" face="Menlo" size="3"><span class="yiv707525447Apple-style-span" style="font-size:
 11px;"><font class="yiv707525447Apple-style-span" color="#010101">itk</font></span></font><font class="yiv707525447Apple-style-span" face="Menlo" size="3"><span class="yiv707525447Apple-style-span" style="font-size: 11px;"><font class="yiv707525447Apple-style-span" color="#010101">::</font></span></font><font class="yiv707525447Apple-style-span" face="Menlo" size="3"><span class="yiv707525447Apple-style-span" style="font-size: 11px;"><font class="yiv707525447Apple-style-span" color="#010101">Image</font></span></font><font class="yiv707525447Apple-style-span" face="Menlo" size="3"><span class="yiv707525447Apple-style-span" style="font-size: 11px;"><font class="yiv707525447Apple-style-span" color="#010101">&lt;</font></span></font><font class="yiv707525447Apple-style-span" face="Menlo" size="3"><span class="yiv707525447Apple-style-span" style="font-size: 11px;"><font class="yiv707525447Apple-style-span" color="#010101">PixelType</font></span></font><font
 class="yiv707525447Apple-style-span" face="Menlo" size="3"><span class="yiv707525447Apple-style-span" style="font-size: 11px;"><font class="yiv707525447Apple-style-span" color="#010101">,</font></span></font><font class="yiv707525447Apple-style-span" face="Menlo" size="3"><span class="yiv707525447Apple-style-span" style="font-size: 11px;"><font class="yiv707525447Apple-style-span" color="#010101">3</font></span></font><font class="yiv707525447Apple-style-span" face="Menlo" size="3"><span class="yiv707525447Apple-style-span" style="font-size: 11px;"><font class="yiv707525447Apple-style-span" color="#010101">&gt; </font></span></font><font class="yiv707525447Apple-style-span" face="Menlo" size="3"><span class="yiv707525447Apple-style-span" style="font-size: 11px;"><font class="yiv707525447Apple-style-span" color="#010101">ImageType</font></span></font><font class="yiv707525447Apple-style-span" face="Menlo" size="3"><span
 class="yiv707525447Apple-style-span" style="font-size: 11px;"><font class="yiv707525447Apple-style-span" color="#010101">;</font></span></font></div><div><div style="margin: 0px; font: 11px Menlo; color: rgb(0, 179, 249);"><span style="color: rgb(227, 57, 161);"><span class="yiv707525447Apple-tab-span" style="white-space: pre;">        </span><font class="yiv707525447Apple-style-span" color="#010101">typedef</font></span><font class="yiv707525447Apple-style-span" color="#010101"> itk::Image&lt; itk::Vector&lt;DeformationPixelType, 3&gt;, 3&gt; DeformationFieldType</font><span style="color: rgb(255, 255, 255);">;</span></div></div><div><div style="margin: 0px; font: 11px Menlo; color: rgb(0, 179, 249);"><font class="yiv707525447Apple-style-span" color="#ffffff"><div style="margin: 0px; font: 11px Menlo;"><span class="yiv707525447Apple-tab-span" style="white-space: pre;"><font class="yiv707525447Apple-style-span" color="#010101">        </font></span><font
 class="yiv707525447Apple-style-span" color="#010101">typedef
 itk::DiffeomorphicDemonsRegistrationFilter &lt;ImageType, ImageType, DeformationFieldType&gt; FilterType;</font></div><div style="margin: 0px; font: 11px Menlo; min-height: 13px;"><span class="yiv707525447Apple-tab-span" style="white-space: pre;"><font class="yiv707525447Apple-style-span" color="#010101">        </font></span><font class="yiv707525447Apple-style-span" color="#010101"><br class="yiv707525447webkit-block-placeholder"></font></div><div style="margin: 0px; font: 11px Menlo;"><span class="yiv707525447Apple-tab-span" style="white-space: pre;"><font class="yiv707525447Apple-style-span" color="#010101">        </font></span><font class="yiv707525447Apple-style-span" color="#010101">typename FilterType::Pointer filter = FilterType::New();</font></div><div style="margin: 0px; font: 11px Menlo; min-height: 13px;"><span class="yiv707525447Apple-tab-span" style="white-space: pre;"><font class="yiv707525447Apple-style-span" color="#010101">        </font></span><font
 class="yiv707525447Apple-style-span" color="#010101"><br class="yiv707525447webkit-block-placeholder"></font></div><div style="margin: 0px; font: 11px Menlo; min-height: 13px;"><span class="yiv707525447Apple-tab-span" style="white-space: pre;"><font class="yiv707525447Apple-style-span" color="#010101">        </font></span><font class="yiv707525447Apple-style-span" color="#010101"><br class="yiv707525447webkit-block-placeholder"></font></div><div style="margin: 0px; font: 11px Menlo;"><span class="yiv707525447Apple-tab-span" style="white-space: pre;"><font class="yiv707525447Apple-style-span" color="#010101">        </font></span><font class="yiv707525447Apple-style-span" color="#010101">filter-&gt;SetFixedImage(img_diastole-&gt;GetOutput());</font></div><div style="margin: 0px; font: 11px Menlo;"><span class="yiv707525447Apple-tab-span" style="white-space: pre;"><font class="yiv707525447Apple-style-span" color="#010101">        </font></span><font
 class="yiv707525447Apple-style-span" color="#010101">filter-&gt;SetMovingImage(img_sistole-&gt;GetOutput());</font></div><div style="margin: 0px; font: 11px Menlo;"><span class="yiv707525447Apple-tab-span" style="white-space: pre;"><font class="yiv707525447Apple-style-span" color="#010101">        </font></span><font class="yiv707525447Apple-style-span" color="#010101">filter-&gt;Update();</font></div><div style="margin: 0px; font: 11px Menlo; min-height: 13px;"><span class="yiv707525447Apple-tab-span" style="white-space: pre;"><font class="yiv707525447Apple-style-span" color="#010101">        </font></span><font class="yiv707525447Apple-style-span" color="#010101"><br class="yiv707525447webkit-block-placeholder"></font></div><div style="margin: 0px; font: 11px Menlo;"><span class="yiv707525447Apple-tab-span" style="white-space: pre;"><font class="yiv707525447Apple-style-span" color="#010101">        </font></span><font class="yiv707525447Apple-style-span"
 color="#010101">typename DeformationFieldType::Pointer deformacion = filter-&gt;GetDeformationField();</font></div><div><span style="color: rgb(255, 255, 255);"><br></span></div></font></div></div><div><br><div>
<div>Saludos</div><div>Ariel Hernán Curiale</div><div><a rel="nofollow" target="_blank" href="http://www.curiale.com.ar/">www.curiale.com.ar</a></div><div><br></div><br class="yiv707525447Apple-interchange-newline">
</div>
<br><div><div>El 25/03/2011, a las 10:00, akbarjan bayiz escribió:</div><br class="yiv707525447Apple-interchange-newline"><blockquote type="cite"><div>Hello all!<br><br>I am using Demons algorithm to perform registration of two DICOM series. My code compiles without any error. And when I run it, at the final step, when it updates the filter, there is a "0" on the screen, and gives error message saying "Segmentation Fault". <br><br>What should I do for it? <br><br>Thank you in advance! <br><br><br><br>_____________________________________<br>Powered by <a rel="nofollow" target="_blank" href="http://www.kitware.com/">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a rel="nofollow" target="_blank" href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information
 visit:<br><a rel="nofollow" target="_blank" href="http://www.kitware.com/products/protraining.html">http://www.kitware.com/products/protraining.html</a><br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.itk.org/mailman/listinfo/insight-users<br></div></blockquote></div><br></div></div></blockquote></td></tr></tbody></table><br>

      </blockquote></div><br></div></div></blockquote></td></tr></table><br>