Commit 502fb4a9 authored by Marc Modat's avatar Marc Modat

(1) Modified the root CMakeLists.txt to detect the current git hash key. (2)...

(1) Modified the root CMakeLists.txt to detect the current git hash key. (2) Included the hash key into each executable and associated it with the -v flag
parent c51caf23
......@@ -214,14 +214,24 @@ if(USE_CUDA)
endif(CUDA_FOUND)
endif(USE_CUDA)
#-----------------------------------------------------------------------------
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.svn)
find_package(Subversion)
if(Subversion_FOUND)
Subversion_WC_INFO(${CMAKE_SOURCE_DIR} NiftyReg)
add_definitions(-D_SVN_REV=${NiftyReg_WC_REVISION})
message(STATUS "Found subversion - the revision number is added to the source.")
endif(Subversion_FOUND)
endif(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.svn)
find_package(Git)
if(GIT_FOUND)
execute_process(
COMMAND git rev-parse HEAD
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
RESULT_VARIABLE GIT_FAILED
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT GIT_FAILED)
add_definitions(-D_GIT_HASH=\"${GIT_COMMIT_HASH}\")
message(STATUS "Found GIT - the hash is added to the source.")
else(NOT GIT_FAILED)
add_definitions(-D_GIT_HASH="NoInfo")
endif(NOT GIT_FAILED)
else(GIT_FOUND)
add_definitions(-D_GIT_HASH="NoInfo")
endif(GIT_FOUND)
#-----------------------------------------------------------------------------
subdirs(reg-io)
subdirs(reg-lib)
......
......@@ -45,7 +45,6 @@ void Usage(char *exec)
printf("This code has been written by Marc Modat (m.modat@ucl.ac.uk) and Pankaj Daga,\n");
printf("for any comment, please contact them.\n");
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
printf("Usage:\t%s -ref <filename> -flo <filename> [OPTIONS].\n",exec);
printf("\t-ref <filename>\tReference image filename (also called Target or Fixed) (mandatory)\n");
printf("\t-flo <filename>\tFloating image filename (also called Source or moving) (mandatory)\n");
......@@ -79,10 +78,13 @@ void Usage(char *exec)
printf("\t-%%v <int>\t\tPercentage of blocks to use in the optimisation scheme. [50]\n");
printf("\t-%%i <int>\t\tPercentage of blocks to consider as inlier in the optimisation scheme. [50]\n");
printf("\t-voff\t\t\tTurns verbose off [on]\n");
#if defined (_OPENMP)
printf("\t-omp <int>\t\tNumber of thread to use with OpenMP. [%i]\n",
omp_get_num_procs());
#endif
printf("\t-voff\t\t\tTurns verbose off [on]\n");
#ifdef _GIT_HASH
printf("\n\t-v\t\t\tPrint current source code git hash key and exit\n\t\t\t\t(%s)\n",_GIT_HASH);
#endif
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
return;
......@@ -157,7 +159,7 @@ int main(int argc, char **argv)
printf("%s",xml_aladin);
return 0;
}
#ifdef _SVN_REV
#ifdef _GIT_HASH
if( strcmp(argv[i], "-version")==0 ||
strcmp(argv[i], "-Version")==0 ||
strcmp(argv[i], "-V")==0 ||
......@@ -165,7 +167,7 @@ int main(int argc, char **argv)
strcmp(argv[i], "--v")==0 ||
strcmp(argv[i], "--version")==0)
{
printf("NiftyReg revision number: %i\n",_SVN_REV);
printf("%s\n",_GIT_HASH);
return 0;
}
#endif
......
......@@ -27,6 +27,7 @@
void usage(char *exec)
{
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
printf("usage:\n\t%s <outputFileName> [OPTIONS]\n\n", exec);
printf("\t-avg <inputAffineName1> <inputAffineName2> ... <inputAffineNameN> \n");
printf("\t\tIf the input are images, the intensities are averaged\n");
......@@ -37,6 +38,9 @@ void usage(char *exec)
printf("\t-demean1 <referenceImage> <AffineMat1> <floatingImage1> ... <AffineMatN> <floatingImageN>\n");
printf("\t-demean2 <referenceImage> <NonRigidTrans1> <floatingImage1> ... <NonRigidTransN> <floatingImageN>\n");
printf("\t-demean3 <referenceImage> <AffineMat1> <NonRigidTrans1> <floatingImage1> ... <AffineMatN> <NonRigidTransN> <floatingImageN>\n\n");
#ifdef _GIT_HASH
printf("\n\t-v\tPrint current source code git hash key and exit\n\t\t(%s)\n",_GIT_HASH);
#endif
printf("Desciptions:\n\n");
printf("* The demean1 option enforces the mean of all affine matrices to have\n");
printf("a Jacobian determinant equal to one. This is done by computing the\n");
......@@ -46,6 +50,7 @@ void usage(char *exec)
printf("user-defined reference space\n\n");
printf("* The demean2\n\n");
printf("* The demean3\n\n");
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
}
template <class DTYPE>
......@@ -89,6 +94,21 @@ int main(int argc, char **argv)
usage(argv[0]);
return EXIT_SUCCESS;
}
// Check if the --xml information is required
else if(strcmp(argv[i], "--xml")==0)
{
printf("%s",xml_average);
return 0;
}
#ifdef _GIT_HASH
else if(strcmp(argv[i], "-version")==0 || strcmp(argv[i], "-Version")==0 ||
strcmp(argv[i], "-V")==0 || strcmp(argv[i], "-v")==0 ||
strcmp(argv[i], "--v")==0 || strcmp(argv[i], "--version")==0)
{
printf("%s\n",_GIT_HASH);
return EXIT_SUCCESS;
}
#endif
}
// Command line
printf("\nCommand line:\n\t");
......
......@@ -73,11 +73,7 @@ void Usage(char *exec)
printf("\t-ref <filename>\tFilename of the reference image (mandatory)\n");
printf("\t-flo <filename>\tFilename of the floating image (mandatory)\n");
printf("\n***************\n*** OPTIONS ***\n***************\n");
#ifdef _SVN_REV
fprintf(stderr,"\n-v Print the subversion revision number\n");
#endif
printf("\n*** Initial transformation options (One option will be considered):\n");
printf("*** Initial transformation options (One option will be considered):\n");
printf("\t-aff <filename>\t\tFilename which contains an affine transformation (Affine*Reference=Floating)\n");
printf("\t-incpp <filename>\tFilename ofloatf control point grid input\n\t\t\t\tThe coarse spacing is defined by this file.\n");
......@@ -149,11 +145,6 @@ void Usage(char *exec)
printf("\t-vel \t\t\tUse a velocity field integration to generate the deformation\n");
printf("\t-fmask <filename>\tFilename of a mask image in the floating space\n");
printf("\n*** Other options:\n");
printf("\t-smoothGrad <float>\tTo smooth the metric derivative (in mm) [0]\n");
printf("\t-pad <float>\t\tPadding value [nan]\n");
printf("\t-voff\t\t\tTo turn verbose off\n");
#if defined (_OPENMP)
printf("\n*** OpenMP-related options:\n");
printf("\t-omp <int>\t\tNumber of thread to use with OpenMP. [%i]\n",
......@@ -163,6 +154,14 @@ void Usage(char *exec)
printf("\n*** GPU-related options:\n");
printf("\t-mem\t\t\tDisplay an approximate memory requierment and exit\n");
printf("\t-gpu \t\t\tTo use the GPU implementation [no]\n");
#endif
printf("\n*** Other options:\n");
printf("\t-smoothGrad <float>\tTo smooth the metric derivative (in mm) [0]\n");
printf("\t-pad <float>\t\tPadding value [nan]\n");
printf("\t-voff\t\t\tTo turn verbose off\n");
#ifdef _GIT_HASH
printf("\t-v\t\t\tPrint current source code git hash key and exit\n\t\t\t\t(%s)\n",_GIT_HASH);
#endif
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
printf("For further description of the penalty term, use: %s -helpPenalty\n", exec);
......@@ -201,7 +200,7 @@ int main(int argc, char **argv)
{
verbose=false;
}
#ifdef _SVN_REV
#ifdef _GIT_HASH
if( strcmp(argv[i], "-version")==0 ||
strcmp(argv[i], "-Version")==0 ||
strcmp(argv[i], "-V")==0 ||
......@@ -209,8 +208,8 @@ int main(int argc, char **argv)
strcmp(argv[i], "--v")==0 ||
strcmp(argv[i], "--version")==0)
{
printf("NiftyReg revision number: %i\n",_SVN_REV);
return 0;
printf("%s\n",_GIT_HASH);
return EXIT_SUCCESS;
}
#endif
if(strcmp(argv[i], "-helpPenalty")==0)
......
......@@ -106,11 +106,7 @@ void Usage(char *exec)
{
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
printf("Usage:\t%s [OPTIONS].\n",exec);
#ifdef _SVN_REV
fprintf(stderr,"\n-v Print the subversion revision number\n");
#endif
printf("\n* * INPUT * *\n");
printf("* * INPUT * *\n");
printf("\t-trans <filename>\n");
printf("\t\tFilename of the file containing the transformation (mandatory).\n");
printf("\t-ref <filename>\n");
......@@ -122,6 +118,9 @@ void Usage(char *exec)
printf("\t\tFilename of the Jacobian matrix map. (9 or 4 values are stored as a 5D nifti).\n");
printf("\t-jacL <filename>\n");
printf("\t\tFilename of the Log of the Jacobian determinant map.\n");
#ifdef _GIT_HASH
printf("\n\t-v\tPrint current source code git hash key and exit\n\t\t(%s)\n",_GIT_HASH);
#endif
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
return;
}
......@@ -151,16 +150,16 @@ int main(int argc, char **argv)
printf("%s",xml_jacobian);
return 0;
}
#ifdef _SVN_REV
if( strcmp(argv[i], "-version")==0 ||
#ifdef _GIT_HASH
else if( strcmp(argv[i], "-version")==0 ||
strcmp(argv[i], "-Version")==0 ||
strcmp(argv[i], "-V")==0 ||
strcmp(argv[i], "-v")==0 ||
strcmp(argv[i], "--v")==0 ||
strcmp(argv[i], "--version")==0)
{
printf("NiftyReg revision number: %i\n",_SVN_REV);
return 0;
printf("%s\n",_GIT_HASH);
return EXIT_SUCCESS;
}
#endif
else if((strcmp(argv[i],"-ref")==0) || (strcmp(argv[i],"-target")==0) ||
......
......@@ -59,15 +59,15 @@ void Usage(char *exec)
printf("\t-flo <filename>\tFilename of the floating image (mandatory)\n");
printf("\t\tNote that the floating image is resampled into the reference\n");
printf("\t\timage space using the header informations.\n");
#ifdef _SVN_REV
fprintf(stderr,"\n-v Print the subversion revision number\n");
#endif
printf("* * OPTIONS * *\n");
printf("\t-ncc\t\tReturns the NCC value\n");
printf("\t-lncc\t\tReturns the LNCC value\n");
printf("\t-nmi\t\tReturns the NMI value (64 bins are used)\n");
printf("\t-ssd\t\tReturns the SSD value\n");
#ifdef _GIT_HASH
printf("\n\t-v\t\tPrint current source code git hash key and exit\n\t\t\t(%s)\n",_GIT_HASH);
#endif
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
return;
}
......@@ -95,16 +95,16 @@ int main(int argc, char **argv)
// printf("%s",xml_measure);
// return 0;
// }
#ifdef _SVN_REV
if( strcmp(argv[i], "-version")==0 ||
#ifdef _GIT_HASH
else if( strcmp(argv[i], "-version")==0 ||
strcmp(argv[i], "-Version")==0 ||
strcmp(argv[i], "-V")==0 ||
strcmp(argv[i], "-v")==0 ||
strcmp(argv[i], "--v")==0 ||
strcmp(argv[i], "--version")==0)
{
printf("NiftyReg revision number: %i\n",_SVN_REV);
return 0;
printf("%s\n",_GIT_HASH);
return EXIT_SUCCESS;
}
#endif
else if((strcmp(argv[i],"-ref")==0) || (strcmp(argv[i],"-target")==0) ||
......
......@@ -163,6 +163,15 @@ int main(int argc, char **argv)
Usage(argv[0]);
return 0;
}
#ifdef _GIT_HASH
else if(strcmp(argv[i], "-version")==0 || strcmp(argv[i], "-Version")==0 ||
strcmp(argv[i], "-V")==0 || strcmp(argv[i], "-v")==0 ||
strcmp(argv[i], "--v")==0 || strcmp(argv[i], "--version")==0)
{
printf("%s\n",_GIT_HASH);
return EXIT_SUCCESS;
}
#endif
else if(strcmp(argv[i], "-source") == 0)
{
param->sourceImageName=argv[++i];
......
......@@ -58,10 +58,6 @@ void Usage(char *exec)
printf("Usage:\t%s -ref <filename> -flo <filename> [OPTIONS].\n",exec);
printf("\t-ref <filename>\n\t\tFilename of the reference image (mandatory)\n");
printf("\t-flo <filename>\n\t\tFilename of the floating image (mandatory)\n\n");
#ifdef _SVN_REV
fprintf(stderr,"\n-v Print the subversion revision number\n");
#endif
printf("* * OPTIONS * *\n");
printf("\t-trans <filename>\n\t\tFilename of the file containing the transformation parametrisation (from reg_aladin, reg_f3d or reg_transform)\n");
printf("\t-res <filename>\n\t\tFilename of the resampled image [none]\n");
......@@ -69,6 +65,9 @@ void Usage(char *exec)
printf("\t-inter <int>\n\t\tInterpolation order (0,1,3)[3] (0=NN, 1=LIN; 3=CUB)\n");
printf("\t-pad <int>\n\t\tInterpolation padding value [0]\n");
printf("\t-voff\n\t\tTurns verbose off [on]\n");
#ifdef _GIT_HASH
printf("\t-v\n\t\tPrint current source code git hash key and exit\n\t\t(%s)\n",_GIT_HASH);
#endif
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
return;
}
......@@ -101,16 +100,16 @@ int main(int argc, char **argv)
{
verbose=false;
}
#ifdef _SVN_REV
if( strcmp(argv[i], "-version")==0 ||
#ifdef _GIT_HASH
else if( strcmp(argv[i], "-version")==0 ||
strcmp(argv[i], "-Version")==0 ||
strcmp(argv[i], "-V")==0 ||
strcmp(argv[i], "-v")==0 ||
strcmp(argv[i], "--v")==0 ||
strcmp(argv[i], "--version")==0)
{
printf("NiftyReg revision number: %i\n",_SVN_REV);
return 0;
printf("%s\n",_GIT_HASH);
return EXIT_SUCCESS;
}
#endif
else if((strcmp(argv[i],"-ref")==0) || (strcmp(argv[i],"-target")==0) ||
......
......@@ -89,8 +89,8 @@ void Usage(char *exec)
printf("\t-nan <filename>\t\tThis image is used to mask the input image.\n\t\t\t\tVoxels outside of the mask are set to nan\n");
printf("\t-iso\t\t\tThe resulting image is made isotropic\n");
printf("\t-noscl\t\t\tThe scl_slope and scl_inter are set to 1 and 0 respectively\n");
#ifdef _SVN_REV
printf("\t-v Print the subversion revision number\n");
#ifdef _GIT_HASH
printf("\n\t-v\t\t\tPrint current source code git hash key and exit\n\t\t\t\t(%s)\n",_GIT_HASH);
#endif
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
return;
......@@ -123,13 +123,13 @@ int main(int argc, char **argv)
printf("%s",xml_tools);
return 0;
}
#ifdef _SVN_REV
if(strcmp(argv[i], "-version")==0 || strcmp(argv[i], "-Version")==0 ||
#ifdef _GIT_HASH
else if(strcmp(argv[i], "-version")==0 || strcmp(argv[i], "-Version")==0 ||
strcmp(argv[i], "-V")==0 || strcmp(argv[i], "-v")==0 ||
strcmp(argv[i], "--v")==0 || strcmp(argv[i], "--version")==0)
{
printf("NiftyReg revision number: %i\n",_SVN_REV);
return 0;
printf("%s\n",_GIT_HASH);
return EXIT_SUCCESS;
}
#endif
else if(strcmp(argv[i], "-in") == 0)
......
......@@ -62,11 +62,7 @@ void Usage(char *exec)
{
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
printf("Usage:\t%s [OPTIONS].\n",exec);
#ifdef _SVN_REV
fprintf(stderr,"\n-v Print the subversion revision number\n");
#endif
printf("\n* * OPTIONS * *\n\n");
printf("* * OPTIONS * *\n\n");
printf("\t-ref <filename>\n");
printf("\t\tFilename of the reference image\n");
......@@ -135,6 +131,10 @@ void Usage(char *exec)
printf("\t\tfilename3 - Image used as a floating (-in arg in FLIRT)\n");
printf("\t\tfilename4 - Output affine transformation file name\n\n");
#ifdef _GIT_HASH
printf("\t-v\tPrint current source code git hash key and exit\n\t\t(%s)\n\n",_GIT_HASH);
#endif
printf("\t* The supported transformation types are:\n");
printf("\t\t- cubic B-Spline parametrised grid (reference image is required)\n");
printf("\t\t- a dense deformation field\n");
......@@ -143,7 +143,6 @@ void Usage(char *exec)
printf("\t\t- a stationary velocity deformation field\n");
printf("\t\t- a stationary velocity displacement field\n");
printf("\t\t- an affine matrix\n\n");
printf("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n");
return;
}
......@@ -175,6 +174,15 @@ int main(int argc, char **argv)
Usage(argv[0]);
return 0;
}
#ifdef _GIT_HASH
else if(strcmp(argv[i], "-version")==0 || strcmp(argv[i], "-Version")==0 ||
strcmp(argv[i], "-V")==0 || strcmp(argv[i], "-v")==0 ||
strcmp(argv[i], "--v")==0 || strcmp(argv[i], "--version")==0)
{
printf("%s\n",_GIT_HASH);
return EXIT_SUCCESS;
}
#endif
else if(strcmp(argv[i],"-ref")==0 || strcmp(argv[i],"--ref")==0 || strcmp(argv[i],"-target")==0)
{
flag->referenceImageFlag=true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment