[Insight-developers] RGB colormapping IJ contribution, Gaetan's comments

Nicholas Tustison ntustison at gmail.com
Tue Jan 6 12:25:03 EST 2009


Hi Gaetan,

I hope you don't mind but the IJ commenting mechanism doesn't seem to  
have the back-and-forth niceties of regular email and instead of  
simply contacting you directly I thought the developer's list would be  
more appropriate.  First off, thank you for the suggestions--they were  
great.  In fact, I included you as a co-author on the revision because  
of the resulting substantive changes.

As you can see below, I've made all the changes you suggested and am  
currently revising the document accordingly.  However, I had a couple  
of questions regarding a couple of your comments/suggestions.

1.  You ask why I didn't derive the filter from the  
UnaryFunctorImageFilter class.  Actually, this was my original  
implementation idea but it seems that swapping the colormap functors  
is not possible within that framework since the  
UnaryFunctorImageFilter class is templated over the specific functor.   
There is the SetFunctor() function but as its description says "This  
allows the user to specify a functor that has ivars set differently  
than the default functor."  Is there something that I'm missing such  
that swapping of the different colormap functors would be possible?

2. I'm afraid I'm not quite understanding your concern about the rgb  
channels and the rgb property not being respected by the custom  
colormap functor.  Could you please elaborate a little more?

3.  Unfortunately, I cannot access the attachment you give in your  
review which is unfortunate because I would like to include your  
colormap.  When I download it, all I get is a text file with a single  
zero in it which doesn't seem to be a very interesting colormap. :-)

Thanks,
Nick






Reproducing the examples has required a bit more work, because the  
test program simply doesn't write the output result to the disk. I  
would suggest writing the output to the disk (see attached file) and  
make the tests check the produced image. This can be acheived easily  
with itkTestDriver with the following lines:

FIND_PROGRAM(ITK_TEST_DRIVER itkTestDriver)
SET(TEST_COMMAND ${ITK_TEST_DRIVER} --add-before-env PATH $ 
{CMAKE_BINARY_DIR})

ADD_TEST( RGBColormapTestSpring ${TEST_COMMAND} ${CurrentExe}
           ${CMAKE_SOURCE_DIR}/images/grey.png spring.png spring
           --compare spring.png ${CMAKE_SOURCE_DIR}/images/spring.png
)

** done **


IMO, color map functor should have the whole pixel type as template  
parameter, to be able to use the RGBA pixels the same way

** done **

are you sure that the Get/SetRed/Green/BlueChannel() method should be  
there? I think they are quite strange, because itk::RGBPixel clearly  
use the first channel as red, the second as green and the last one as  
blue, so changing that in the functor means that this property is not  
respected by the functor

** ?? **

maybe m_MinimumRGBComponentValue and m_MaximumRGBComponentValue  
default values should be min() and max() rather than Zero and One?

** done **

is there a reason to not have implemented  
ScalarToRGBColormapImageFilter as a subclass of  
UnaryFunctorImageFilter? It is said in the paper that that filter has  
large parts of code from UnaryFunctorImageFilter - maybe subclassing  
it would be a better way to reuse the code without duplication

** ?? **

would you agree to add an option to compute the min and max values to  
be used in the functor automatically? That way, the filter would fit  
better in the pipeline architecture

** done **

to make the usage of the predefined colormaps easier, I would suggest  
the addition of a new method to ScalarToRGBColormapImageFilter which  
would allow to use one of those colormap in a single line. For example  
rgbfilter->SetColormap( RGBFilterType::HSV ) or rgbfilter- 
 >SetColormap( "hsv" )

** done **

I would also suggest to drop the ScalarToRGB part in the colormap  
names, and maybe also the Functor suffix -  
ScalarToRGBJetColormapFunctor would become JetColormapFunctor, or even  
JetColormap, which is a lot easier to read and write

** done **

finally, I have contributed another colormap used quive often by  
microscopists to see the saturation in the images - feel free to use  
it :-)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090106/7dcfc6fb/attachment.htm>


More information about the Insight-developers mailing list