[Insight-developers] WrapITK must found ImageCompare to run the tests

Gaëtan Lehmann gaetan.lehmann at jouy.inra.fr
Thu Sep 7 18:09:55 EDT 2006


Le Thu, 07 Sep 2006 23:35:14 +0200, Luis Ibanez <luis.ibanez at kitware.com>  
a écrit:

>
> Hi Gaetan,
>
> The original itkTestMain.h is located in Insight/Code/Common.
>
> I would suggest to put there also the itkTestDriver.cxx and
> build a single library for it.
>
> I assume that by having this function in a library you will be
> able to use it from the target languages, is that correct ?

It's not a function, it's a program. I want to use it to run the tests:

/itk/build/bin/itkTestDriver --add-before-libpath /itk/build/bin \
    --add-before-env PYTHONPATH /itk/build/Wrapping/WrapITK/Python \
    /usr/bin/python2.4 \
    /itk/Wrapping/WrapITK/Python/Tests/MedianImageFilter.py \
    /itk/Wrapping/WrapITK/images/input.png \
    MedianImageFiler.png \
    3 \
    --compare MedianImageFilter.png \
              /itk/Wrapping/WrapITK/images/MedianImageFilter.png

Note that the 3 first lines are the same for all the project and can be  
stored in a cmake variable (PYTHON_TEST_DRIVER for example) to be easy to  
reuse.
That's only a program which change the environment according to what is  
pass to the command line, run a test, and compare the images given on the  
command line with the --compare options.

In a contribution to the IJ, we would have:

   ADD_TEST(Check ${TEST_DRIVER} check ${IMAGE} out.png
     --compare out.png ${PROJECT_SOURCE_DIR}/image/check.png)

instead of 2 ADD_TEST() for only 1 real test:

   ADD_TEST(Check check ${IMAGE} out.png)
   ADD_TEST(CheckCompare ${IMAGE_COMPARE} out.png  
${PROJECT_SOURCE_DIR}/image/check.png)

Gaetan


>
>
>    Please let us know,
>
>
>      Thanks
>
>
>         Luis
>
>
> ---------------------
> Gaëtan Lehmann wrote:
>>  Luis,
>>  The itkTestDriver is mostly ready:   
>> http://voxel.jouy.inra.fr/darcsweb/darcsweb.cgi?r=itkTestDriver;a=headblob;f=/itkTestDriver.cxx  
>>  I wouldn't be too surprised to read that there is still some small   
>> problems or some english mistakes, but it is ready to be tested.
>>  Can you tell me where I should put it in ITK ? It should be built even  
>> if  c++ tests are not built, so the wrapper test can be run, and it can  
>> be use  to implement other test, for the IJ for example
>>  Thanks,
>>  Gaetan
>>   Le Thu, 07 Sep 2006 14:44:50 +0200, Luis Ibanez  
>> <luis.ibanez at kitware.com>  a écrit:
>>
>>>
>>> Ok, I will add ImageCompare as a default binary to build in ITK,
>>> then look at removing the duplicate functionality from the test
>>> drivers.
>>>
>>> Hopefully we would be able to do this without having to touch the
>>> CMakeLists.txt files in the Testing directories...
>>>
>>>
>>>     Luis
>>>
>>>
>>> -----------------------
>>> Gaetan Lehmann wrote:
>>>
>>>> On Thu, 07 Sep 2006 13:48:15 +0200, Luis Ibanez   
>>>> <luis.ibanez at kitware.com>  wrote:
>>>>
>>>>>
>>>>> Hi Gaetan,
>>>>>
>>>>> The C++ test drivers already have a built-in Image Compare
>>>>> functionality. So, it seems that the problem is that it is not
>>>>> available to the wrapping tests.
>>>>>
>>>>> It was from the C++ test drivers that we took the code for creating
>>>>> ImageCompare when we put it in the suggested material for the Insigth
>>>>> Journal.
>>>>>
>>>>> That being said, ImageCompare is such a basic tool, that I agree with
>>>>> you that adding it to the default binaries to be built by ITK is a
>>>>> good idea.
>>>>>
>>>>> Option (3) also sounds like a good option, and it seems that it  
>>>>> offers
>>>>> extra advantages.  My suggestion would be to do (1) right now,  
>>>>> just   because it is so easy (we just need to commit the file), and  
>>>>> then
>>>>> proceed to also implement (3).
>>>>>
>>>>>
>>>>> Would you like to undertake (3) ?
>>>>>
>>>>  Ok. Can you add ImageCompare to ITK ?
>>>> Where do you think ImageCompare and the new test driver should go in   
>>>> ITK ?
>>>>  Also, what do you think of moving the common code from ImageCompare   
>>>> and  itkTestMain.h in a common file, to avoid duplicating code, and  
>>>> to  make  implementation of the new test driver easier ?
>>>>  Gaetan
>>>>
>>>>>
>>>>>      Luis
>>>>>
>>>>>
>>>>> ----------------------
>>>>> Gaetan Lehmann wrote:
>>>>>
>>>>>>  Hi,
>>>>>>  To implement WrapITK's tests, I have used ImageCompare, which is   
>>>>>> not  by  default in ITK.
>>>>>> There is several possible ways to go:
>>>>>>  (1) add ImageCompare to ITK
>>>>>>  (2) implement the image comparaison in the test drivers
>>>>>>  (3) implement a test driver in c++ usable for all the languages,   
>>>>>> and  able  to compare the images
>>>>>>  (1) is the simplest one, and would be much give ImageCompare by    
>>>>>> default to  the user, so it would be easier to begin to prepare a    
>>>>>> contribution to the  insight journal
>>>>>> (2) will duplicate the image comparaison task - not so good
>>>>>> (3) should be mainly an adaptation of the ITK test driver to set   
>>>>>> the   environment needed to run the tests with the target  
>>>>>> languages.  Also, I   think that this test driver would be better  
>>>>>> for the insight  journal  than  ImageCompare: we can run the test  
>>>>>> and validate its  results in a  single  test; it is not possible  
>>>>>> with ImageCompare.  Finally, it should  be easy  with this one to  
>>>>>> fix the lib path  problem with java
>>>>>>  My preference goes to (3) - please let me know what you think  
>>>>>> about   that
>>>>>>  Thanks,
>>>>>>  Gaetan
>>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
>



-- 
Gaëtan Lehmann
Biologie du Développement et de la Reproduction
INRA de Jouy-en-Josas (France)
tel: +33 1 34 65 29 66    fax: 01 34 65 29 09
http://voxel.jouy.inra.fr


More information about the Insight-developers mailing list