[Insight-developers] ScalarImageKmeansImageFilter example

Luis Ibanez luis.ibanez at kitware.com
Thu Mar 18 11:16:36 EDT 2010


Hi David,

Yeap, that's a good point.


The information is there, but it doesn't get exported to the latex
file that later gets compiled into the final PDF file.

You will find information about the parameters needed to run
examples at the beginning of every example.

In this case, if you look at lines 21-26 of the file
ScalarImageKmeansClassifier.cxx you will see:

//  Software Guide : BeginCommandLineArgs
//    INPUTS: {BrainT1Slice.png}
//    OUTPUTS: {BrainT1Slice_labelled.png}
//    0 3 14.8 91.6 134.9
//    NORMALIZE_EPS_OUTPUT_OF: {BrainT1Slice_labelled.png}
//  Software Guide : EndCommandLineArgs


When we build the software guide document with CMake,
there is a Perl script that parses these arguments and
actually run the test with them, in order to generate the
screen shots that you see later in the Software Guide.


The ITK book is a fully reproducible document.    :-)


What is missing, as you pointed out, is to include this
information as text in the guide itself.

You will also find useful to look at the test of this file
in the CMakeLists.txt file in lines 125-132:

ADD_TEST( ScalarImageKmeansClassifierTest ${STATISTICS_EXAMPLES_WITH_TESTS3}
  --compare ${BASELINE}/ScalarImageKmeansClassifierOutput.png
            ${TEMP}/ScalarImageKmeansClassifierOutput.png
  ScalarImageKmeansClassifierTest
        ${ITK_SOURCE_DIR}/Examples/Data/BrainT1Slice.png
        ${TEMP}/ScalarImageKmeansClassifierOutput.png
        1 3 14.8 91.6 134.9
)


or by going to the binary directory and doing

    ctest -R ScalarImageKmeansClassifierTes -V -N

you will get text such as:

Test command: /home/ibanez/bin/Insight/Release/bin/StatisticsExamplesTests3
--compare /home/ibanez/src/Insight/Testing/Data/Baseline/Statistics/ScalarImageKmeansClassifierOutput.png
/home/ibanez/bin/Insight/Release/Testing/Temporary/ScalarImageKmeansClassifierOutput.png
ScalarImageKmeansClassifierTest
/home/ibanez/src/Insight/Examples/Data/BrainT1Slice.png
/home/ibanez/bin/Insight/Release/Testing/Temporary/ScalarImageKmeansClassifierOutput.png
1 3 14.8 91.6 134.9

which is the actual command line used for running
the test.



     Regards,


            Luis



----------------------------------------------------------
On Wed, Mar 17, 2010 at 7:20 PM, David Doria <daviddoria at gmail.com> wrote:
> Hi Luis,
>
> Just a recommendation - in the Insight Software Guide,
> ScalarImageKmeansClassifier.cxx is documented in tremendous detail.
> However, then no use case is provided! (unless I'm missing it?).
>
> Saying something like "this example can be tested by running:
> ./KMeansClassification cthead1.jpg output.jpg 1 3 0 100 200
> "
>
> or something like that would be very helpful. It is always my first
> step to run an example on input for which I have a known output to
> make sure the code is working before I touch (read "break") it.
>
> Just food for thought if you work up the courage to write version 3.0
> of the guide!
>
> Thanks,
>
> David
>


More information about the Insight-developers mailing list