Class AlgorithmDTICreateListFile

java.lang.Object
java.lang.Thread
gov.nih.mipav.model.algorithms.AlgorithmBase
gov.nih.mipav.model.algorithms.DiffusionTensorImaging.AlgorithmDTICreateListFile
All Implemented Interfaces:
AlgorithmInterface, ActionListener, WindowListener, Runnable, EventListener

public class AlgorithmDTICreateListFile extends AlgorithmBase implements AlgorithmInterface
  • Field Details

    • studyName

      private String studyName
      This is the dir name of the study.*
    • studyPath

      private String studyPath
      This is the full path of the study.*
    • prFileName

      private String prFileName
      par rec file name
    • prFileDir

      private String prFileDir
      par rec file dir
    • gradientFilePath

      private String gradientFilePath
      This is the full path to the gradient file.*
    • bmtxtFilePath

      private String bmtxtFilePath
      This is the full path to the b matrix file.*
    • isInterleaved

      private boolean isInterleaved
      boolean if dataset is interelaved
    • outputTextArea

      private JTextArea outputTextArea
      TextArea of main dialog for text output.*
    • dwiPathTextField

      private JTextField dwiPathTextField
      handle to dwi data textfield of main dialog
    • seriesFileInfoTreeMap

      private TreeMap<Integer,TreeSet<String[]>> seriesFileInfoTreeMap
      This is an ordered map of series number and seriesFileInfoTreeSet.*
    • seriesFileInfoTreeSet

      private TreeSet<String[]> seriesFileInfoTreeSet
      This is an ordered list of files per series number.*
    • isDICOM

      private boolean isDICOM
      boolean indicating if we are dealing with dicom or par/rec
    • listFileName

      private String listFileName
      List file name
    • bmatrixFileName

      private String bmatrixFileName
      B Matrix file name
    • pathFileName

      private String pathFileName
      Path File name
    • success

      private boolean success
      flag indicating if method was successful.*
    • totalImageSlices

      private int totalImageSlices
      total image slices.*
    • totalNumVolumes

      private int totalNumVolumes
      total num of volumes in study.*
    • isEDTI

      private boolean isEDTI
      boolean telling if dataset is eDTI.*
    • isGE

      private boolean isGE
      boolean telling if datset is GE.*
    • isSiemens

      private boolean isSiemens
      boolean telling if datset is SIEMENS.*
    • firstFileInfoDicom

      private FileInfoDicom firstFileInfoDicom
      first fileinfo dicom...used for list file info.*
    • geSoftwareVersion

      private int geSoftwareVersion
      int telling software version if datset is GE.*
    • imageFilter

      private ViewImageFileFilter imageFilter
      This is the image filter needed to select the correct dicom images.*
    • dicomInfo

      private String[] dicomInfo
      Array that holds the dicom tag info*
    • isProcDirCreated

      private boolean isProcDirCreated
      boolean if proc dir was created.*
    • numSlicesPerVolume

      private int numSlicesPerVolume
      this is the number of image slices per volume.*
    • nim

      private int nim
      this is the number of gradient quantities that is obtained by reading first line of gradient file.*
    • direction

      private float[][] direction
      this is the gradient matrix that is populated when reading the gradient file.*
    • bValuesArrayList

      private ArrayList<Float> bValuesArrayList
      this is an array of b-values that for each volume.*
    • fileParRec

      private FilePARREC fileParRec
      FileParRec handle
    • fileInfoPR

      private FileInfoPARREC fileInfoPR
      file info Par/Rec
    • image4D

      private ModelImage image4D
      ModelImage of 4D par/rec dataset
    • originalColumnsString

      private String originalColumnsString
      x dim
    • originalRowsString

      private String originalRowsString
      y dim
    • numSlicesString

      private String numSlicesString
      z dim
    • nimString

      private String nimString
      t dim
    • phaseEncodingString

      private String phaseEncodingString
      phase encoding...hard coded to vertical
    • horizontalFOVString

      private String horizontalFOVString
      horizontal FOV
    • verticalFOVString

      private String verticalFOVString
      vertical FOV
    • sliceGapString

      private String sliceGapString
      slice gap String
    • sliceThicknessString

      private String sliceThicknessString
      sliec thickness
    • imageOrientationString

      private String imageOrientationString
      image orientation
    • volParameters

      private HashMap<String,String> volParameters
      vol parameters
    • avgVolIndex

      private int avgVolIndex
      Philips puts in one volume as the average of all the DWIs. This volume will have a non-zero B value and 0 in the gradients Once we find this volume, exclude it.... this int represents which volume index to exclude
    • isOldVersion

      private boolean isOldVersion
      boolean identifying if par/rec datset is older than version 4.1
    • oldVersionGradientsAL

      private ArrayList<String[]> oldVersionGradientsAL
      arraylist of gradients for version 4 of Par/Rec
    • nimCounter

      private int nimCounter
      this counter is used for version 4 of Par/Rec...nim is calculated from gradient file
    • imageSlicesDirPath

      private String imageSlicesDirPath
      path for imageSlicesDir
    • relativeImageSlicesDirPath

      private String relativeImageSlicesDirPath
      relative path for slices dir for outputting to path file
    • rawImageFormatString

      private String rawImageFormatString
      raw image format...hardcoded to float since we will be outputting par/rec slices in float format
    • unsortedPathsArrayList

      private ArrayList<String> unsortedPathsArrayList
      arraylist of unsorted path strings to image slices
    • xDim

      private int xDim
      xDIm of 4d image
    • yDim

      private int yDim
      yDim of 4d image
    • zDim

      private int zDim
      zDim of 4d image
    • tDim

      private int tDim
      tDim of 4d image
    • performRegistration

      private boolean performRegistration
      boolean for performing registration
    • reg35

      private AlgorithmRegOAR35D reg35
      handle to AlgorithmRegOAR35D
    • reg3

      private AlgorithmRegOAR3D reg3
      handle to AlgorithmRegOAR3D
    • cost

      private int cost
      registration option parameters
    • DOF

      private int DOF
      registration option parameters
    • interp

      private int interp
      registration option parameters
    • interp2

      private int interp2
      registration option parameters
    • registerTo

      private int registerTo
      registration option parameters
    • maxIterations

      private int maxIterations
      registration option parameters
    • numMinima

      private int numMinima
      registration option parameters
    • rotateBegin

      private float rotateBegin
      registration option parameters
    • rotateEnd

      private float rotateEnd
      registration option parameters
    • coarseRate

      private float coarseRate
      registration option parameters
    • fineRate

      private float fineRate
      registration option parameters
    • rotateBeginX

      private float rotateBeginX
      registration option parameters
    • rotateEndX

      private float rotateEndX
      registration option parameters
    • coarseRateX

      private float coarseRateX
      registration option parameters
    • fineRateX

      private float fineRateX
      registration option parameters
    • rotateBeginY

      private float rotateBeginY
      registration option parameters
    • rotateEndY

      private float rotateEndY
      registration option parameters
    • coarseRateY

      private float coarseRateY
      registration option parameters
    • fineRateY

      private float fineRateY
      registration option parameters
    • rotateBeginZ

      private float rotateBeginZ
      registration option parameters
    • rotateEndZ

      private float rotateEndZ
      registration option parameters
    • coarseRateZ

      private float coarseRateZ
      registration option parameters
    • fineRateZ

      private float fineRateZ
      registration option parameters
    • doGraph

      private boolean doGraph
      registration option parameters
    • doSubsample

      private boolean doSubsample
      registration option parameters
    • doMultiThread

      private boolean doMultiThread
      registration option parameters
    • fastMode

      private boolean fastMode
      registration option parameters
    • maxOfMinResol

      private boolean maxOfMinResol
      registration option parameters
    • dicomB0VolumePath

      private String dicomB0VolumePath
      path to dicom B0 for registration purposes
    • refImage

      private ModelImage refImage
      model images
    • matchImage

      private ModelImage matchImage
      model images
    • resultImage

      private ModelImage resultImage
      model images
    • fileIO

      private FileIO fileIO
      file IO
    • registeredStudyName

      private String registeredStudyName
      study name for registered data set
    • transform

      private AlgorithmTransform transform
      handle to AlgorithmTransform
    • xdimA

      private int xdimA
      parameter for AlgorithmTransform
    • ydimA

      private int ydimA
      parameter for AlgorithmTransform
    • zdimA

      private int zdimA
      parameter for AlgorithmTransform
    • xresA

      private float xresA
      parameter for AlgorithmTransform
    • yresA

      private float yresA
      parameter for AlgorithmTransform
    • zresA

      private float zresA
      parameter for AlgorithmTransform
    • registeredDicomB0VolumePathParentFolder

      private String registeredDicomB0VolumePathParentFolder
      registered B0 parent folder
  • Constructor Details

    • AlgorithmDTICreateListFile

      public AlgorithmDTICreateListFile(String studyPath, String studyName, String gradientFilePath, String bmtxtFilePath, JTextArea outputTextArea, boolean isInterleaved, boolean performRegsitration)
      constructor for dicom
      Parameters:
      studyPath -
      studyName -
      gradientFilePath -
      bmtxtFilePath -
      outputTextArea -
    • AlgorithmDTICreateListFile

      public AlgorithmDTICreateListFile(String studyPath, String studyName, String dicomB0VolumePath, String gradientFilePath, String bmtxtFilePath, JTextArea outputTextArea, boolean isInterleaved, boolean performRegsitration, int cost, int DOF, int interp, int interp2, float rotateBeginX, float rotateEndX, float coarseRateX, float fineRateX, float rotateBeginY, float rotateEndY, float coarseRateY, float fineRateY, float rotateBeginZ, float rotateEndZ, float coarseRateZ, float fineRateZ, boolean maxOfMinResol, boolean doSubsample, boolean doMultiThread, boolean fastMode, int bracketBound, int maxIterations, int numMinima, JTextField dwiPathTextField)
      constructor for dicom if registration is to be done first
      Parameters:
      studyPath -
      studyName -
      gradientFilePath -
      bmtxtFilePath -
      outputTextArea -
    • AlgorithmDTICreateListFile

      public AlgorithmDTICreateListFile(String fileName, String fileDir, String gradientFilePath, String bmtxtFilePath, JTextArea outputTextArea, boolean performRegsitration)
      constructor for par/rec
    • AlgorithmDTICreateListFile

      public AlgorithmDTICreateListFile(String fileName, String fileDir, String gradientFilePath, String bmtxtFilePath, JTextArea outputTextArea, boolean performRegsitration, int cost, int DOF, int interp, int interp2, int registerTo, float rotateBegin, float rotateEnd, float coarseRate, float fineRate, boolean doSubsample, boolean doMultiThread, boolean fastMode, int bracketBound, int maxIterations, int numMinima, JTextField dwiPathTextField)
      constructor for par/rec if registration is to be done first
  • Method Details

    • runAlgorithm

      public void runAlgorithm()
      Description copied from class: AlgorithmBase
      Actually runs the algorithm. Implemented by inheriting algorithms.
      Specified by:
      runAlgorithm in class AlgorithmBase
    • performRegistrationPARREC

      public boolean performRegistrationPARREC()
      regsitration of PAR REC DWI dataset
    • performRegistrationDICOM

      public boolean performRegistrationDICOM()
      regsitration of DICOM DWI dataset
    • registerAndSaveVolumes

      public boolean registerAndSaveVolumes(File dir)
    • createSubDirsInRegisteredDir

      public boolean createSubDirsInRegisteredDir(File dir)
    • deleteAllFiles

      public boolean deleteAllFiles(File dir)
    • runAlgorithmDICOM

      public void runAlgorithmDICOM()
      run algorithm for dicom
    • runAlgorithmPARREC

      public void runAlgorithmPARREC()
      run algorithm for par/rec
    • setInitialInfo

      public boolean setInitialInfo()
      this method sets initial info about the study.
      Returns:
      boolean success
    • parse

      public boolean parse(File file) throws IOException, OutOfMemoryError
      this method parses the study dir sort into lists using series number that is available in dicom tag. then based on the filename, get vol number (for example mipav_dicom_dti_series11_volume10005.dcm), and sort within lists using vol number and instance number that comes from dicom tag.
      Parameters:
      file -
      Returns:
      boolean success
      Throws:
      IOException
      OutOfMemoryError
    • createProcDirDICOM

      public boolean createProcDirDICOM()
      this method creates the proc dir in which the list file, path file, and b-matrix file go.
      Returns:
      boolean success
    • createPathFileForInterleavedDICOM

      public boolean createPathFileForInterleavedDICOM()
      This method creates the path file for interleaverd datasets
      Returns:
      boolean success
    • createPathFileDICOM

      public boolean createPathFileDICOM()
      This method creates the path file.
      Returns:
      boolean success
    • createListFileDICOM

      public boolean createListFileDICOM()
      This method creates the list file.
      Returns:
      boolean success
    • readGradientFileDICOM

      public boolean readGradientFileDICOM()
      This method reads in the gradient file gradient file can be in 2 differetn ways....for eDTI, there will be a number on first line followed by correct number of gradients if it is DTI, there will be no number and just 7 linies of gradients....this needs to be duplicated as many times as there are series.
      Returns:
      boolean success
    • obtainBValuesDICOM

      public boolean obtainBValuesDICOM()
      This method obtains the b-values for each volume from either the public tag or the private tag.
      Returns:
      boolean success
    • createBMatrixFileDICOM

      public boolean createBMatrixFileDICOM()
      This method creates the b-matrix file.
      Returns:
      boolean success
    • obtainListFileDataParRec

      public boolean obtainListFileDataParRec()
      This method obtains list file data mostly from the 1st slice
      Returns:
    • readGradientFileParRec

      public boolean readGradientFileParRec()
      this method reads the gradient file
      Returns:
    • createProcDirAndImageSlicesDirParRec

      public boolean createProcDirAndImageSlicesDirParRec()
      this method creates the proc dir in which the list file, path file, and b-matrix file go.
      Returns:
      boolean success
    • createListFileParRec

      public boolean createListFileParRec()
      This method creates the list file.
      Returns:
      boolean success
    • createBMatrixFileParRec

      public boolean createBMatrixFileParRec()
      This method creates the B-Matrix file
      Returns:
    • writeImageSlicesParRec

      public boolean writeImageSlicesParRec()
      This method writes out the image slices as raw float
      Returns:
    • createPathFileParRec

      public boolean createPathFileParRec()
      This method creates the path file
      Returns:
    • finalize

      public void finalize()
      this method cleans up the proc dir if success is false and it sets the lists to null.
      Overrides:
      finalize in class AlgorithmBase
    • copyBMatrixFile

      public boolean copyBMatrixFile()
      This method copies the optional b matrix file that user provided, and copies it to proc dir and renames it to the correct naming syntax.
      Returns:
      boolean
    • algorithmPerformed

      public void algorithmPerformed(AlgorithmBase algorithm)
      Description copied from interface: AlgorithmInterface
      Called after an algorithm this listener is registered to exits (maybe successfully, maybe not). If the algorithm is run in a separate thread, this call will be made within that thread. If not, this call will be made from that same, shared thread.
      Specified by:
      algorithmPerformed in interface AlgorithmInterface
      Parameters:
      algorithm - the algorithm which has just completed