Projects:ARRA:SlicerEM:AtlasCreator:PCA

From NAMIC Wiki
Jump to: navigation, search
Home < Projects:ARRA:SlicerEM:AtlasCreator:PCA

Back to AtlasCreator..

PCA functionality for the Atlas Creator

This content describes the PCA functionality of KilisSandbox.

Create environment for pcaModelling on Mac

$ tcsh
% cd /Users/daniel/SLICER/TRUNK/Slicer3/Modules/KilisSandbox/scripts
% source setEnvironment
% /Users/daniel/SLICER/TRUNK/Slicer3-build/Slicer3 --launch xterm

pcaModelling Help

Main

$ pcaModelling

Slicer home is /Users/daniel/SLICER/TRUNK/Slicer3-build
============================ Start PCADistance =======================
Always look at vtkEMPrivateSegment/projects/iccv05/TestExample to see example structure
Now can read in raw data with extension .img
load multiple volumes by doing -pr "<dir>/*/prefix" eg case*/I.001 - 001 is important bc file has to exist
=============================
General Options
-ld = load data - default: "1"
-pr = file prefix (mandatory)
-p2 = file prefix of second Volume
-sv = saving output in file formate (sli, img, hdr (analyze), nhdr or nrrd (NRRD),
                              mhd or mha (Meta), nii (Nifti), vtk) - default: nrrd
-va = value for function, default: 0.0
=============================
-fc = function (mandatory) - possibilities:
   distance       = Turns a labelmap into a distance map as needed for PCA modelling (*)
   generate       = Generate the PCA model from the training data (*)
   model          = Turns PCA analysis into 3D models (*)
   parameter      = Extracts the PCA shape parameters from a shape representation (e.g. distance map) (*)
   representation = Determines the shape representation from the PCA shape parameters (*)
   view           = View the PCA model (*)

-HELP = help function If the description of a function has (*) then execute -HELP <function> for more detail, e.g. mathImage -HELP com

Error: Currently function "" is not implemented
============================ End MathImage =======================

Questions:

  • What is the general workflow of the PCA functions? First distance, then generate..?
    • Only distance and generate are interesting. Aligned labelMaps as input for distance.Distance per label, other steps can be for combined labels.
  • Can you give an example of commands which have to be executed during this workflow? (f.e. creating a PCA atlas using segmentations and originals folders?)
  • Do we need to integrate all 6 functions in the Atlas Creator?

Distance functionality

$ pcaModelling -HELP distance
Slicer home is /Users/daniel/SLICER/TRUNK/Slicer3-build
============================ Start PCADistance =======================
Always look at vtkEMPrivateSegment/projects/iccv05/TestExample to see example structure
Now can read in raw data with extension .img
load multiple volumes by doing -pr "<dir>/*/prefix" eg case*/I.001 - 001 is important bc file has to exist

      To transfere the labelmap into a distance map according to the PCA model please define the following values:
      -path   = where should the file be save to
      -volume = defines the labelmap
      -va (first)  = defines the label of interest
      -va (second) = Maximum value in the distance map in Euclidean norm (e.g. 100)
      -va (third)  = Distance value of boundary (e.g. 10)

Questions:

  • Does the program support .nrrd output and input?
    • Should work
  • Do we transfer one label at a time to a distance map?
    • Yes one label at a time
  • Can the maximum and distance values get computed automatically or does the user have to enter them?
    • Use 100 for maximum
    • Use 10 as distance value

Generate functionality

$ pcaModelling -HELP generate
Slicer home is /Users/daniel/SLICER/TRUNK/Slicer3-build
============================ Start PCADistance =======================
Always look at vtkEMPrivateSegment/projects/iccv05/TestExample to see example structure
Now can read in raw data with extension .img
load multiple volumes by doing -pr "<dir>/*/prefix" eg case*/I.001 - 001 is important bc file has to exist

      To generate the PCA  the training data has to be organized the following way
        <PATH>/case*/<STRUCTURES>/I
      where
        -path defines <PATH>
        the different subjects have to be named case<No>
        -list defines the different <STRUCTURES>
      e.g. /projects/iccv05/TestExample/TestEMPCASeg/PCATraining/distance/case1/Background/I.*
      with -path = /projects/iccv05/TestExample/TestEMPCASeg/PCATraining/distance and -list (Background Foreground)
      In addition:
        -max  defines the maximum number of Eigenvectors to compute
        -full defines the full image range, e.g. 1 124, where PCA might only be computed for 40 90
      The results will be located in <PATH>/PCA<STRUCTURES>
        -combine  =  define all structures in one PCA model (= 1) or define a PCA model for each structure independently (=0)
        -va  do you want to normalize the mean distance map so that it is a real distance map (generally a bad idea)

Questions:

  • What does this step do?
  • Can you explain the path? <PATH>/case*/<STRUCTURES>/I
    • In the Atlas Creator, a case does not have subfolders for structures? Does it mean a threshold by label?
      • case1.nrrd -> case1/LABELVALUE/I.nrrd
  • What does the maximum number of Eigenvectors mean? Should the user specify it?
    • e.g. 10
  • Does the full image range switch calculate the PCA for all intensities?
    • 1-124
  • We probably want to define PCA for each label independently, correct?
    • combine to 0, -va 0
  • Should we include Normalization even if it is a bad idea? Why is it a bad idea?
    • one flag in gui for PCA

Model functionality

$ pcaModelling -HELP model
Slicer home is /Users/daniel/SLICER/TRUNK/Slicer3-build
============================ Start PCADistance =======================
Always look at vtkEMPrivateSegment/projects/iccv05/TestExample to see example structure
Now can read in raw data with extension .img
load multiple volumes by doing -pr "<dir>/*/prefix" eg case*/I.001 - 001 is important bc file has to exist

      To turn the shape representation into 3D models
        -list defines the <STRUCTURE> to be considered, e.g. Background
        -path defines the path of the location of the PCA directory
          where the subdirectory of PCA<STRUCTURE> define EigenValues_<STRUCTURE>.txt, EigenVector*, and  MeanImage
         e.g. -path is /projects/iccv05/TestExample/TestEMPCASeg and all necessary files are located in /projects/iccv05/TestExample/TestEMPCASeg/PCABackground
        -max  defines the maximum number of Eigenvectors to considere
        -combine just set this parameter if you have one PCA model for multiple structures bc the directory structure is sliglhty different (e.g.  TestEMPCASegBlub/PCATraining/distance/PCAFore_Back/Background/EigenVector5/I)

Questions:

  • Why do we need 3D models?
  • The PCA directory: Where does it come frome?
  • Again, what should we use as Max?

Parameter functionality

$ pcaModelling -HELP parameter
Slicer home is /Users/daniel/SLICER/TRUNK/Slicer3-build
============================ Start PCADistance =======================
Always look at vtkEMPrivateSegment/projects/iccv05/TestExample to see example structure
Now can read in raw data with extension .img
load multiple volumes by doing -pr "<dir>/*/prefix" eg case*/I.001 - 001 is important bc file has to exist

      To turn the shape representation into shape parameters
        -list defines the <STRUCTURE> to be considered, e.g. Background
        -path defines the path of the location of the PCA directory
          where the subdirectory of PCA<STRUCTURE> define EigenValues_<STRUCTURE>.txt, EigenVector*, and  MeanImage
         e.g. -path is /projects/iccv05/TestExample/TestEMPCASeg and all necessary files are located in /projects/iccv05/TestExample/TestEMPCASeg/PCABackground
        -max  defines the maximum number of Eigenvectors to considere
        -volume defines the volume that should be transfered from a shape representation into PCA parameters
        -combine just set this parameter if you have one PCA model for multiple structures bc the directory structure is sliglhty different (e.g.  TestEMPCASegBlub/PCATraining/distance/PCAFore_Back/Background/EigenVector5/I)
        -va (first) (Optional) define a file name to which results should be written


Questions:

  • What does this command do?
  • What are shape representations and what are shape parameters?
  • What is the input and output here?

Representation functionality

$ pcaModelling -HELP representation
Slicer home is /Users/daniel/SLICER/TRUNK/Slicer3-build
============================ Start PCADistance =======================
Always look at vtkEMPrivateSegment/projects/iccv05/TestExample to see example structure
Now can read in raw data with extension .img
load multiple volumes by doing -pr "<dir>/*/prefix" eg case*/I.001 - 001 is important bc file has to exist

representation = Determines the shape representation from the PCA shape parameters
      To turn shape parameters into  shape representation (the opposite of function parameter)
        -list        = the <STRUCTURE> to be considered, e.g. Background
        -path        = the path of the location of the PCA directory
                       where the subdirectory of PCA<STRUCTURE> define EigenValues_<STRUCTURE>.txt, EigenVector*, and  MeanImage
                       e.g. -path is /projects/iccv05/TestExample/TestEMPCASeg and all necessary files are located in /projects/iccv05/TestExample/TestEMPCASeg/PCABackground
        -max         = the maximum number of Eigenvectors to considere
        -va (first)  = the list of shape parameters, e.g. (1.0 3.4)
        -va (second) = directory, where the resulting shape representation should be saved to
        -combine just set this parameter if you have one PCA model for multiple structures bc the directory structure is sliglhty different (e.g.  TestEMPCASegBlub/PCATraining/distance/PCAFore_Back/Background/EigenVector5/I)


Questions:

  • What does this do?
  • Again, how to specify Max?
  • Where does the list of shape parameters come from?

View functionality

$ pcaModelling -HELP view
Slicer home is /Users/daniel/SLICER/TRUNK/Slicer3-build
============================ Start PCADistance =======================
Always look at vtkEMPrivateSegment/projects/iccv05/TestExample to see example structure
Now can read in raw data with extension .img
load multiple volumes by doing -pr "<dir>/*/prefix" eg case*/I.001 - 001 is important bc file has to exist

      To turn the shape representation into shape parameters
        -list defines the <STRUCTURE> to be considered, e.g. Background
        -path defines the path of the location of the PCA directory
          where the subdirectory of PCA<STRUCTURE> define EigenValues_<STRUCTURE>.txt, EigenVector*, and  MeanImage
         e.g. -path is /projects/iccv05/TestExample/TestEMPCASeg and all necessary files are located in /projects/iccv05/TestExample/TestEMPCASeg/PCABackground
        -max  defines the maximum number of Eigenvectors to considere
        -combine just set this parameter if you have one PCA model for multiple structures bc the directory structure is sliglhty different (e.g.  TestEMPCASegBlub/PCATraining/distance/PCAFore_Back/Background/EigenVector5/I)

Questions:

  • To turn the shape representation into shape parameters - this was the description of other functions too? Is this a mistake or really true?