<div dir="ltr"><div><div>Hi Wei,<br><br></div>You didn't specify a version of ITK that you were using, so I will assume the most recent release (v4.4.2) for my comments.<br><br>First, note that itk::ScalarToRGBColormapImageFilter will always get the maximum pixel value of the input image and re-call "m_C<span class="">olormap</span>->SetMaximumInputValue" with it [1]. This happens intrinsically when running the ColormapImageFilter, so I believe there is really no place in user code that you could set a different maximum that wouldn't be overwritten later.<br>
<br></div>There is a fairly simple solution, however. The method itk::HotColormapFunction::SetMaximumInputValue is virtual [2]. You could create your own subclass of itk::HotColormapFunction, then override "SetMaximumInputValue" to ignore its parameter and insted set "m_MaximumInputValue" to be 255 (or even some other value, stored in another new member variable). Then of course just typedef your new subclass as the ColormapType and use the rest of your code as normal.<br>
<div><br>[1]
<a href="http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Filtering/Colormap/include/itkScalarToRGBColormapImageFilter.hxx;h=2e958db61f7f7639951af24d93baac921534819f;hb=3f8d0a7d84ba3bac4950114e0e0e15f69852496d#l101">http://itk.org/gitweb?p=ITK.git;a=blob;f=Modules/Filtering/Colormap/include/itkScalarToRGBColormapImageFilter.hxx;h=2e958db61f7f7639951af24d93baac921534819f;hb=3f8d0a7d84ba3bac4950114e0e0e15f69852496d#l101</a><br>
[2] <a href="http://www.itk.org/Doxygen44/html/classitk_1_1Function_1_1ColormapFunction.html#a6e3e281b374c86acf427baf2983f879a">http://www.itk.org/Doxygen44/html/classitk_1_1Function_1_1ColormapFunction.html#a6e3e281b374c86acf427baf2983f879a</a><br>
<br></div><div>Hope this helps.<br><br></div><div>Enjoy,<br></div><div>Brian<br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Nov 12, 2013 at 1:26 AM, Wei Liu <span dir="ltr"><<a href="mailto:weiliu620@gmail.com" target="_blank">weiliu620@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Dear itk users,<br><br>I'm trying to use ScalarToRGBColormapImageFilter to map a scalar to rgb color. According to the document, "The range of values present in the input image is the range that is mapped to the entire range of colors". However, I want to fix the range of the input image. That is, no matter what intensity range of the input image is, I want the range [0, 255] map to the full color range. So far I have tried the following approach:<div>
<br> typedef itk::Function::HotColormapFunction< ImageType2DF::PixelType, RGBImageType::PixelType > ColormapType;<br><div> ColormapType::Pointer colormap = ColormapType::New();<br><div><div> colormap->SetMinimumInputValue(0); </div>
<div> colormap->SetMaximumInputValue(255); </div><div> std::cout << "max input: " << colormap->GetMaximumInputValue() << std::endl;</div><div> rgbfilter->SetColormap(colormap);</div>
</div></div><div><br></div><div>I can see the maximum input value is correctly set. But it seems the ScalarToRGBColormapImageFilter still define the input range by reading the input image's min/max value. Did I miss something? </div>
<div><br></div><div>I have a related question: it looks itk does not have a filter to overlay a continuous value image onto a gray level intensity image. That is the reason I mannually convert the scalar image to rgb image, and overlay it onto the gray level intensity image. Is there better way of doing it?</div>
<div><br></div><div>I appreciate your input.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>Wei</div></font></span></div></div>
<br>_____________________________________<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.php" target="_blank">http://www.kitware.com/products/protraining.php</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>
Community mailing list<br>
<a href="mailto:Community@itk.org">Community@itk.org</a><br>
<a href="http://public.kitware.com/cgi-bin/mailman/listinfo/community" target="_blank">http://public.kitware.com/cgi-bin/mailman/listinfo/community</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Brian Helba<br>Medical Imaging<br>Kitware, Inc.<br>
</div>