<br>Dear Luis et al.,<br><br>This question is about how to handle image data in an image registration algorithm (based on the book section 8.2 &quot;Hello World&quot; Registration).<br><br>Given this code (most of this is straight from the example):<br>
<br><font size="2"><span style="font-family: courier new,monospace;">    //  Define the types of the images to be registered.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    const    unsigned short  Dimension = 3;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    typedef  float           bwPixelType;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">    typedef itk::Image&lt; bwPixelType,  Dimension &gt; bwImageType;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">    typedef itk::ImageFileReader&lt; bwImageType  &gt;  bwImageReaderType;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">    // Instantiate the image readers.</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    // How do they convert tif file data to bwPixelType?</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    bwImageReaderType::Pointer fixBWimgReader = bwImageReaderType::New();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    bwImageReaderType::Pointer movBWimgReader = bwImageReaderType::New();<br>
</span></font><font size="2"><span style="font-family: courier new,monospace;">    // create image data objects (this a slight variation on the example)</span></font><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">    fixBWimgReader-&gt;SetFileName( fixBWImgFileName ); // assume this works</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    fixBWimgReader-&gt;Update();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    movBWimgReader-&gt;SetFileName( movBWImgFileName );</span></font><font size="2"><span style="font-family: courier new,monospace;"> // assume this works</span></font><font size="2"><span style="font-family: courier new,monospace;"></span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    movBWimgReader-&gt;Update();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    bwImageType::Pointer fixBWimg = fixBWimgReader-&gt;GetOutput();</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">    bwImageType::Pointer movBWimg = movBWimgReader-&gt;GetOutput();<br><br>    // *****************************************************<br>    // Imagine code here (not in the example);<br>
    // the additional code sets specific &#39;spacing&#39; and &#39;origin&#39;<br>    // values on fixBWimg and movBWimg (ommited for brevity).<br></span><span style="font-family: courier new,monospace;"></span></font><font size="2"><span style="font-family: courier new,monospace;">    // *****************************************************<br>
<br>
</span></font><font size="2"><span style="font-family: courier new,monospace;">    // Now create registration objects (some elements ommited in this email)</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">    typedef itk::ImageRegistrationMethod&lt; bwImageType, bwImageType &gt; RegistrationType;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"></span><span style="font-family: courier new,monospace;">    RegistrationType::Pointer registration = RegistrationType::New();</span><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"><span style="font-family: arial,helvetica,sans-serif;">Is there any significant functional difference (or problems) in using this:</span><br style="font-family: arial,helvetica,sans-serif;">
<br>// Add images to the registration method.<br> registration-&gt;SetFixedImage(  fixBWimgReader-&gt;GetOutput() );<br> registration-&gt;SetMovingImage( movBWimgReader-&gt;GetOutput() );<br>fixBWimgReader-&gt;Update();<br>
registration-&gt;SetFixedImageRegion( fixBWimgReader-&gt;GetOutput()-&gt;GetBufferedRegion() );</span><br style="font-family: courier new,monospace;"><br>OR this:<br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> </span></font><font size="2"><span style="font-family: courier new,monospace;">// Add images to the registration method.<br>
 </span></font><font size="2"><span style="font-family: courier new,monospace;">registration-&gt;SetFixedImage(  fixBWimg );<br> registration-&gt;SetMovingImage( movBWimg );<br>registration-&gt;SetFixedImageRegion( fixBWimg-&gt;GetLargestPossibleRegion().GetSize() );</span></font><br>
<br>The puzzle hinges on how the data pipeline handles the file/image data and whether or not it is necessary to have some kind of &quot;update object&quot; for the image data in the registration object?  Is there some sense in which the &#39;fixBWimg&#39; object contains &#39;static&#39; data in memory (which is modified after reading the file data by calls to fixBWimg-&gt;SetSpacing() and fixBWimg-&gt;SetOrigin())?  Given changes to the image spacing and origin, it is preferable to have &#39;static&#39; image data in memory and to avoid any automatic refresh or update of the image data from disk for every iteration in the registration method (which might wipe out the settings for spacing and origin).<br>
<br>Please share some insight on the Insight(ITK) data pipeline during registration. :-)<br><br>Take care,<br>Darren<br><br>