Class AlgorithmDTICreateListFile

  • All Implemented Interfaces:
    AlgorithmInterface, java.awt.event.ActionListener, java.awt.event.WindowListener, java.lang.Runnable, java.util.EventListener

    public class AlgorithmDTICreateListFile
    extends AlgorithmBase
    implements AlgorithmInterface
    • Field Detail

      • studyName

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

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

        private java.lang.String prFileName
        par rec file name
      • prFileDir

        private java.lang.String prFileDir
        par rec file dir
      • gradientFilePath

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

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

        private boolean isInterleaved
        boolean if dataset is interelaved
      • outputTextArea

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

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

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

        private java.util.TreeSet<java.lang.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 java.lang.String listFileName
        List file name
      • bmatrixFileName

        private java.lang.String bmatrixFileName
        B Matrix file name
      • pathFileName

        private java.lang.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 java.lang.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 java.util.ArrayList<java.lang.Float> bValuesArrayList
        this is an array of b-values that for each volume.*
      • fileParRec

        private FilePARREC fileParRec
        FileParRec handle
      • image4D

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

        private java.lang.String originalColumnsString
        x dim
      • originalRowsString

        private java.lang.String originalRowsString
        y dim
      • numSlicesString

        private java.lang.String numSlicesString
        z dim
      • nimString

        private java.lang.String nimString
        t dim
      • phaseEncodingString

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

        private java.lang.String horizontalFOVString
        horizontal FOV
      • verticalFOVString

        private java.lang.String verticalFOVString
        vertical FOV
      • sliceGapString

        private java.lang.String sliceGapString
        slice gap String
      • sliceThicknessString

        private java.lang.String sliceThicknessString
        sliec thickness
      • imageOrientationString

        private java.lang.String imageOrientationString
        image orientation
      • volParameters

        private java.util.HashMap<java.lang.String,​java.lang.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 java.util.ArrayList<java.lang.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 java.lang.String imageSlicesDirPath
        path for imageSlicesDir
      • relativeImageSlicesDirPath

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

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

        private java.util.ArrayList<java.lang.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
      • 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 java.lang.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 java.lang.String registeredStudyName
        study name for registered data set
      • 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 java.lang.String registeredDicomB0VolumePathParentFolder
        registered B0 parent folder
    • Constructor Detail

      • AlgorithmDTICreateListFile

        public AlgorithmDTICreateListFile​(java.lang.String studyPath,
                                          java.lang.String studyName,
                                          java.lang.String gradientFilePath,
                                          java.lang.String bmtxtFilePath,
                                          javax.swing.JTextArea outputTextArea,
                                          boolean isInterleaved,
                                          boolean performRegsitration)
        constructor for dicom
        Parameters:
        studyPath -
        studyName -
        gradientFilePath -
        bmtxtFilePath -
        outputTextArea -
      • AlgorithmDTICreateListFile

        public AlgorithmDTICreateListFile​(java.lang.String studyPath,
                                          java.lang.String studyName,
                                          java.lang.String dicomB0VolumePath,
                                          java.lang.String gradientFilePath,
                                          java.lang.String bmtxtFilePath,
                                          javax.swing.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,
                                          javax.swing.JTextField dwiPathTextField)
        constructor for dicom if registration is to be done first
        Parameters:
        studyPath -
        studyName -
        gradientFilePath -
        bmtxtFilePath -
        outputTextArea -
      • AlgorithmDTICreateListFile

        public AlgorithmDTICreateListFile​(java.lang.String fileName,
                                          java.lang.String fileDir,
                                          java.lang.String gradientFilePath,
                                          java.lang.String bmtxtFilePath,
                                          javax.swing.JTextArea outputTextArea,
                                          boolean performRegsitration)
        constructor for par/rec
      • AlgorithmDTICreateListFile

        public AlgorithmDTICreateListFile​(java.lang.String fileName,
                                          java.lang.String fileDir,
                                          java.lang.String gradientFilePath,
                                          java.lang.String bmtxtFilePath,
                                          javax.swing.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,
                                          javax.swing.JTextField dwiPathTextField)
        constructor for par/rec if registration is to be done first
    • Method Detail

      • 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​(java.io.File dir)
      • createSubDirsInRegisteredDir

        public boolean createSubDirsInRegisteredDir​(java.io.File dir)
      • deleteAllFiles

        public boolean deleteAllFiles​(java.io.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​(java.io.File file)
                      throws java.io.IOException,
                             java.lang.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:
        java.io.IOException
        java.lang.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