BRAINS Snap Shopt Writer

Description

Create 2D snap shots from multiple 3D volumes with labels. Any number of input and label could be given. 

Required Input:

  1. at lease one inputVolumes (NO DEFAULT)
  2. at least inputPlaneDirection (Default is given in xml)
  3. inputSliceToExtract[InPercent/InIndex/InPhysicalPoint], This has to be paired to the number of inputPlaneDirection above. (default is given in xml)
Batch Processing Script

This is script to generate snap shot for auto work up. 

Ex)

   

for dir in `ls //scratch/PREDICT/B4AUTO.20120104/BAW_20120104_workflow/`
do

  ## t1 and t2
  t1=(`ls //scratch/PREDICT/B4AUTO.20120104/BAW_20120104_workflow/$dir/11_BABC/*t1_average*`)
  t2=(`ls //scratch/PREDICT/B4AUTO.20120104/BAW_20120104_workflow/$dir/11_BABC/*t2_average*`)

  # structures
  includeBinaries="";
  for file in `ls //scratch/PREDICT/B4AUTO.20120104/BAW_20120104_workflow/$dir/_structures_*/BRAINSCUT/*_seg.nii.gz`
  do
    includeBinaries="$includeBinaries --inputBinaryVolumes $file"
  done

  inputBasename=$dir
  outputDir="/scratch/PREDICT/regina/BRAINSFitCheck/B4AUTO.20120104/"
  mkdir -p $outputDir
  outputImage="$outputDir/${inputBasename}2DImage.png"

  atlasVolume="/scratch/PREDICT/regina/BRAINS/buildICC/ReferenceAtlas-build/Atlas/Atlas_20111229/template_t1.nii.gz"

  CMD="/scratch/PREDICT/regina/BRAINS/buildICC/lib/BRAINSSnapShotWriter  \
    --inputVolumes $t1 \
    --inputVolumes $t2 \
    $includeBinaries \
    --inputVolumes $atlasVolume \
    --inputPlaneDirection 2,1,0,0 \
    --inputSliceToExtractInPhysicalPoint  0,0,10,-10  \
    --outputFilename $outputImage"

  echo "-------------------------------------------"
  echo $CMD
  if [ -s $outputImage ]; then
    echo "exist"
  else
    script="$outputDir//Script$inputBasename.sh"
    echo "$CMD" > $script
    chmod 755 $script
  fi
  echo "-------------------------------------------"

done

Help

$ BRAINSSnapShotWriter --help

USAGE:

   ../../buildBRAINSCut201111215/lib/BRAINSSnapShotWriter
                                        [--returnparameterfile
                                        <std::string>]
                                        [--processinformationaddress
                                        <std::string>] [--xml] [--echo]
                                        [--outputFilename <std::string>]
                                        [--inputPlaneDirection
                                        <std::vector<int>>]
                                        [--inputSliceToExtractInPercent
                                        <std::vector<int>>]
                                        [--inputSliceToExtractInIndex
                                        <std::vector<int>>]
                                        [--inputSliceToExtractInPhysicalPoi
                                        nt <std::vector<float>>]
                                        [--inputBinaryVolumes
                                        <std::vector<std::string>>] ...
                                        [--inputVolumes
                                        <std::vector<std::string>>] ...
                                        [--] [--version] [-h]


Where:

   --returnparameterfile <std::string>
     Filename in which to write simple return parameters (int, float,
     int-vector, etc.) as opposed to bulk return parameters (image,
     geometry, transform, measurement, table).

   --processinformationaddress <std::string>
     Address of a structure to store process information (progress, abort,
     etc.). (default: 0)

   --xml
     Produce xml description of command line arguments (default: 0)

   --echo
     Echo the command line arguments (default: 0)

   --outputFilename <std::string>
     2D file name of input images. Required.

   --inputPlaneDirection <std::vector<int>>
     Plane to display. In general, 0=saggital, 1=coronal, and 2=axial
     plane. (default: 0,1,2)

   --inputSliceToExtractInPercent <std::vector<int>>
     2D slice number of input images. Percentage input from 0%-100%. (ex.
     --inputSliceToExtractInPercent 50,50,50

   --inputSliceToExtractInIndex <std::vector<int>>
     2D slice number of input images. For size of 256*256*256 image, 128 is
     usually used.

   --inputSliceToExtractInPhysicalPoint <std::vector<float>>
     2D slice number of input images. For autoWorkUp output, which AC-PC
     aligned, 0,0,0 will be the center.

   --inputBinaryVolumes <std::vector<std::string>>  (accepted multiple
      times)
     Input mask (binary) volume list to be extracted as 2D image. Multiple
     input is possible.

   --inputVolumes <std::vector<std::string>>  (accepted multiple times)
     Input image volume list to be extracted as 2D image. Multiple input is
     possible. At least one input is required.

   --,  --ignore_rest
     Ignores the rest of the labeled arguments following this flag.

   --version
     Displays version information and exits.

   -h,  --help
     Displays usage information and exits.


   Description: Create 2D snapshot of input images. Mask images are
   color-coded

   Author(s): Eunyoung Regina Kim
Usage
Usage A. index input by voxel index:
BRAINSSnapShotWriter \
--inputVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/43971_AVG_T1.nii.gz \
--inputVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/43971_AVG_T2.nii.gz \
--inputVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/43971_SG.nii.gz \
--inputBinaryVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/ANN2011May04ManualCompleted/43971_l_putamen.nii.gz  \
--inputBinaryVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/ANN2011May04ManualCompleted/43971_r_putamen.nii.gz \
--inputBinaryVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/ANN2011May04ManualCompleted/43971_l_caudate.nii.gz  \
--inputBinaryVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/ANN2011May04ManualCompleted/43971_r_caudate.nii.gz \
--inputPlaneDirection 2,1,0,0 \
--inputSliceToExtractInIndex  128,128,115,135 \
--outputFilename ~/Desktop/testIndex.png

Usage B. index input by physical points:
BRAINSSnapShotWriter \
--inputVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/43971_AVG_T1.nii.gz \
--inputVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/43971_AVG_T2.nii.gz \
--inputVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/43971_SG.nii.gz \
--inputBinaryVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/ANN2011May04ManualCompleted/43971_l_putamen.nii.gz  \
--inputBinaryVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/ANN2011May04ManualCompleted/43971_r_putamen.nii.gz \
--inputBinaryVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/ANN2011May04ManualCompleted/43971_l_caudate.nii.gz  \
--inputBinaryVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/ANN2011May04ManualCompleted/43971_r_caudate.nii.gz \
--inputPlaneDirection 2,1,0 \
--inputSliceToExtractInPhysicalPoint 0,0,10 \
--outputFilename ~/Desktop/testPhysicalPoints.png

Usage C. index input by percent:
BRAINSSnapShotWriter \
--inputVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/43971_AVG_T1.nii.gz \
--inputVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/43971_AVG_T2.nii.gz  \
--inputBinaryVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/ANN2011May04ManualCompleted/43971_l_putamen.nii.gz  \
--inputBinaryVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/ANN2011May04ManualCompleted/43971_r_putamen.nii.gz \
--inputBinaryVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/ANN2011May04ManualCompleted/43971_l_caudate.nii.gz  \
--inputBinaryVolumes /paulsen/IPIG/predict_3T_MR/site-073/2334/43971/10_AUTO.NN3Tv20110418/ANN2011May04ManualCompleted/43971_r_caudate.nii.gz \
--inputPlaneDirection 2,1,0,0 \
--inputSliceToExtractInPercent 50,50,40,60 \
--outputFilename ~/Desktop/testPercents.png