<br>Hi Luis et al.,<br><br>Now the ITK library is compiled and installed with the additional features available. Now this code will compile:<br><br><span style="font-family: courier new,monospace;">typedef itk::MeanSquaresImageToImageMetric<iBWImgType,iBWImgType> MetricType;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">MetricType::Pointer metric = MetricType::New();</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">metric->SetUseFixedImageSamplesIntensityThreshold( true );</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">metric->SetFixedImageSamplesIntensityThreshold( intensityThreshold );</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">//metric->SetUseSequentialSampling( true );</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">//metric->SetUseAllPixels( true );</span><br style="font-family: courier new,monospace;"><br><br>Now a question arises about the range of values for the "intensityThreshold". The input pixel and image typedefs are:<br>
<br><span style="font-family: courier new,monospace;">const unsigned short dimImg = 2;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">typedef float iPixType;</span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">typedef itk::Image< iPixType, dimImg > iBWImgType;</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">typedef itk::ImageFileReader< iBWImgType > bwImageReaderType;</span><br style="font-family: courier new,monospace;">
<br><br>The image reader is pulling in .tif images, which ImageMagick identifies as (see verbose output in attachment):<br><br><span style="font-family: courier new,monospace;">$ identify testdata/bw/section0003_w1.tif </span><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;">testdata/bw/section0003_w1.tif TIFF 549x539 549x539+0+0 16-bit Grayscale DirectClass 615KB 0.010u 0:00.030</span><br><br>When this image is read into the iPixType, I assume the range of these "unsigned short" values is mapped or cast into a range of "float" values. Is the new range of values from 0.0 to 1.0, is that correct for the "float" pixel type in ITK? How does the ITK image reader convert or cast the pixel values to float? (The reason the input images are specified as "float" rather than "unsigned short" is to have them input to the registration method as floats - should this be done with an explicit cast filter?)<br>
<br>The input images have a black background (RGB value: 0 0 0). It would be great to threshold the <span style="font-family: courier new,monospace;">MeanSquaresImageToImageMetric</span> to exclude all the black pixels. In the range of values for the input pixel data that are an unsigned short (0 to 65535), any pixel above 0 would be<br>
<br><span style="font-family: courier new,monospace;">unsigned short intensityThreshold = 1;</span><br><br>However, the intensityThreshold is declared and initialized as:<br><br><span style="font-family: courier new,monospace;">iBWImgType::PixelType intensityThreshold = 0.0;</span><br style="font-family: courier new,monospace;">
<br>Is this a reasonable value for this float intensityThreshold:<br><br><span style="font-family: courier new,monospace;">iBWImgType::PixelType
intensityThreshold = 1.0 / USHRT_MAX;</span><br><br><br>TIA,<br>Darren<br><br><br><br><br><div class="gmail_quote">On Sat, Mar 6, 2010 at 12:15 PM, Luis Ibanez <span dir="ltr"><<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">Hi Darren,<br>
<br>
The feature that you are referring to, is only available<br>
in the new version of the metrics that are in the<br>
Code/Review directory.<br>
<br>
In order to use this classes you must reconfigure your<br>
binary build of ITK, by rerunning CMake and turning<br>
ON the CMake variables:<br>
<br>
* ITK_USE_REVIEW<br>
* OPTIMIZED_REGISTRATION_METHODS<br>
<br>
Then you can rebuild your application.<br>
<br>
<br>
Regards,<br>
<br>
<br>
Luis<br>
<br>
<br>
-----------------------------------------------------------------------------------<br>
<div><div></div><div class="h5">On Thu, Mar 4, 2010 at 5:56 PM, Darren Weber<br>
<<a href="mailto:darren.weber.lists@gmail.com">darren.weber.lists@gmail.com</a>> wrote:<br>
><br>
> In an image registration framework, the metric determines image "matches".<br>
> Let's suppose we have large images that contain a majority of background<br>
> color (or transparency). In a metric like the<br>
> itk::MeanSquaresImageToImageMetric, the majority of the sqaured-diff-values<br>
> would be zero and the remainder of the "relevant" pixel differences may be<br>
> "swamped" or "lost" in the division by a large N.<br>
> Also, it appears the default metric sampling is a random-sample of the image<br>
> pixels (this might be modified with methods like "SetUseAllPixels(bool)").<br>
> In this case, it is possible, perhaps likely, that few of the "relevant"<br>
> pixels will be evaluated in the metric.<br>
> See:<br>
> <a href="http://www.itk.org/Doxygen316/html/classitk_1_1ImageToImageMetric.html#42b876134388099afbf34b14faf83cdb" target="_blank">http://www.itk.org/Doxygen316/html/classitk_1_1ImageToImageMetric.html#42b876134388099afbf34b14faf83cdb</a><br>
> This documentation suggests there are also options to define:<br>
> IntensityThreshold, Masks, and SequentialSampling<br>
> In my reading of the doxy page (see next link), there is a method called<br>
> "SetFixedImageSamplesIntensityThreshold" that might be useful to define a<br>
> background value (like zero) to be excluded from the metric. Is that right?<br>
> <a href="http://www.itk.org/Doxygen316/html/classitk_1_1MeanSquaresImageToImageMetric-members.html" target="_blank">http://www.itk.org/Doxygen316/html/classitk_1_1MeanSquaresImageToImageMetric-members.html</a><br>
> What is the logic of this "threshold" method? From the documentation, it<br>
> appears to be a minima value. So if the background intensity is zero, the<br>
> threshold value of 1 would include all pixels > 0 (note the threshold value<br>
> must be the same type as the fixed image PixelType).<br>
> There is no equivalent method for the moving image,<br>
> like "SetMovingImageSamplesIntensityThreshold". Is this unnecessary because<br>
> the metric only scans the pixels of the moving image that fall within the<br>
> "domain" of fixed image after the transform & interpolation?<br>
> I could not locate this method in the class hierarchy - is it available<br>
> (inherited) in all metrics?<br>
> I'm confused because these methods do not appear to be available<br>
> to itk::MeanSquaresImageToImageMetric<br>
> e.g.: CODE:<br>
> typedef itk::MeanSquaresImageToImageMetric< iBWImgType, iBWImgType ><br>
> MetricType;<br>
> MetricType::Pointer metric = MetricType::New();<br>
> metric->SetFixedImageSamplesIntensityThreshold( 0.0 );<br>
> metric->SetUseAllPixels( true );<br>
> e.g.: COMPILATION:<br>
> itkImageRigid2DCoregistration.cxx: In function ‘int main(int, char**)’:<br>
> itkImageRigid2DCoregistration.cxx:442: error: ‘class<br>
> itk::MeanSquaresImageToImageMetric<iBWImgType, iBWImgType>’ has no member<br>
> named ‘SetFixedImageSamplesIntensityThreshold’<br>
> itkImageRigid2DCoregistration.cxx:443: error: ‘class<br>
> itk::MeanSquaresImageToImageMetric<iBWImgType, iBWImgType>’ has no member<br>
> named ‘SetUseAllPixels’<br>
> gmake[2]: ***<br>
> [CMakeFiles/itkImageRigid2DCoregistration.dir/itkImageRigid2DCoregistration.cxx.o]<br>
> Error 1<br>
><br>
><br>
><br>
> TIA,<br>
> Darren<br>
><br>
</div></div>> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.html" target="_blank">http://www.kitware.com/products/protraining.html</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><br>
><br>
</blockquote></div><br>