[Insight-developers] ExternalData evaluation of DATA{} without a test

Daniel Blezek Blezek.Daniel at mayo.edu
Tue Jul 5 08:08:35 EDT 2011


Brad,

  Thanks for this help.  SimpleITK has the same growing pains as ITK
data-wise.  I am hopeful this will address them.

Best,
-dan


On 6/30/11 10:06 AM, "Brad King" <brad.king at kitware.com> wrote:

> Hi Dan,
> 
> Bill mentioned that you asked about referencing external data without adding
> it
> to a test command line.  This is already possible.  See the documentation in
> the ExternalData module itself:
> 
>   
> http://itk.org/gitweb?p=ITK.git;a=blob;f=CMake/ExternalData.cmake;hb=v4.0a08#l
> 16
> 
> In particular, look at the ExternalData_Expand_Arguments function:
> 
>   # The 'ExternalData_Expand_Arguments' function evaluates DATA{} references
>   # in its arguments and constructs a new list of arguments:
>   #  ExternalData_Expand_Arguments(
>   #    <target>   # Name of data management target
>   #    <outVar>   # Output variable
>   #    [args...]  # Input arguments, DATA{} allowed
>   #    )
> 
> Here is how to use it in CMake code:
> 
>   # Add rule to fetch DATA{}.  Stores in "in_png" variable the
>   # location of data after build.
>   ExternalData_Expand_Arguments(MyData in_png DATA{Input/in.png})
> 
>   # ... configure_file ... to put @in_png@ in test source
> 
>   # At end of configuration, add target to download data.
>   ExternalData_Add_Target(MyData)
> 
> the MyData target will contain the download rules at build time.  The same
> target can be used for tests and direct calls to Expand_Arguments.  For
> example, in ITK one could write
> 
>   ExternalData_Expand_Arguments(ITKData in_png DATA{Input/in.png})
> 
> and the main ITKData target will download the data.
> 
> -Brad

-- 
Daniel Blezek, PhD
Medical Imaging Informatics Innovation Center

P 127 or (77) 8 8886
T 507 538 8886
E blezek.daniel at mayo.edu

Mayo Clinic
200 First St. S.W.
Harwick SL-44
Rochester, MN 55905
mayoclinic.org
"It is more complicated than you think." -- RFC 1925



More information about the Insight-developers mailing list