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
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate classThis inner class is used to sort the list by instance numberprivate classThis inner class is used to sort the list by instance number and vol. the vol is determined by the filenameNested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intPhilips puts in one volume as the average of all the DWIs.private StringB Matrix file nameprivate StringThis is the full path to the b matrix filethis is an array of b-values that for each volumeprivate floatregistration option parametersprivate floatregistration option parametersprivate floatregistration option parametersprivate floatregistration option parametersprivate intregistration option parametersprivate Stringpath to dicom B0 for registration purposesprivate String[]Array that holds the dicom tag info*private float[][]this is the gradient matrix that is populated when reading the gradient fileprivate intregistration option parametersprivate booleanregistration option parametersprivate booleanregistration option parametersprivate booleanregistration option parametersprivate JTextFieldhandle to dwi data textfield of main dialogprivate booleanregistration option parametersprivate FileInfoPARRECfile info Par/Recprivate FileIOfile IOprivate FilePARRECFileParRec handleprivate floatregistration option parametersprivate floatregistration option parametersprivate floatregistration option parametersprivate floatregistration option parametersprivate FileInfoDicomfirst fileinfo dicom...used for list file infoprivate intint telling software version if datset is GEprivate StringThis is the full path to the gradient fileprivate Stringhorizontal FOVprivate ModelImageModelImage of 4D par/rec datasetprivate ViewImageFileFilterThis is the image filter needed to select the correct dicom imagesprivate Stringimage orientationprivate Stringpath for imageSlicesDirprivate intregistration option parametersprivate intregistration option parametersprivate booleanboolean indicating if we are dealing with dicom or par/recprivate booleanboolean telling if dataset is eDTIprivate booleanboolean telling if datset is GEprivate booleanboolean if dataset is interelavedprivate booleanboolean identifying if par/rec datset is older than version 4.1private booleanboolean if proc dir was createdprivate booleanboolean telling if datset is SIEMENSprivate StringList file nameprivate ModelImagemodel imagesprivate intregistration option parametersprivate booleanregistration option parametersprivate intthis is the number of gradient quantities that is obtained by reading first line of gradient fileprivate intthis counter is used for version 4 of Par/Rec...nim is calculated from gradient fileprivate Stringt dimprivate intregistration option parametersprivate intthis is the number of image slices per volumeprivate Stringz dimarraylist of gradients for version 4 of Par/Recprivate Stringx dimprivate Stringy dimprivate JTextAreaTextArea of main dialog for text outputprivate StringPath File nameprivate booleanboolean for performing registrationprivate Stringphase encoding...hard coded to verticalprivate Stringpar rec file dirprivate Stringpar rec file nameprivate Stringraw image format...hardcoded to float since we will be outputting par/rec slices in float formatprivate ModelImagemodel imagesprivate AlgorithmRegOAR3Dhandle to AlgorithmRegOAR3Dprivate AlgorithmRegOAR35Dhandle to AlgorithmRegOAR35Dprivate Stringregistered B0 parent folderprivate Stringstudy name for registered data setprivate intregistration option parametersprivate Stringrelative path for slices dir for outputting to path fileprivate ModelImagemodel imagesprivate floatregistration option parametersprivate floatregistration option parametersprivate floatregistration option parametersprivate floatregistration option parametersprivate floatregistration option parametersprivate floatregistration option parametersprivate floatregistration option parametersprivate floatregistration option parametersThis is an ordered map of series number and seriesFileInfoTreeSetThis is an ordered list of files per series numberprivate Stringslice gap Stringprivate Stringsliec thicknessprivate StringThis is the dir name of the studyprivate StringThis is the full path of the studyprivate booleanflag indicating if method was successfulprivate inttDim of 4d imageprivate inttotal image slicesprivate inttotal num of volumes in studyprivate AlgorithmTransformhandle to AlgorithmTransformarraylist of unsorted path strings to image slicesprivate Stringvertical FOVvol parametersprivate intxDIm of 4d imageprivate intparameter for AlgorithmTransformprivate floatparameter for AlgorithmTransformprivate intyDim of 4d imageprivate intparameter for AlgorithmTransformprivate floatparameter for AlgorithmTransformprivate intzDim of 4d imageprivate intparameter for AlgorithmTransformprivate floatparameter for AlgorithmTransformFields inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
destFlag, destImage, image25D, mask, maxProgressValue, minProgressValue, multiThreadingEnabled, nthreads, progress, progressModulus, progressStep, runningInSeparateThread, separable, srcImage, threadStoppedFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY -
Constructor Summary
ConstructorsConstructorDescriptionAlgorithmDTICreateListFile(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 firstAlgorithmDTICreateListFile(String fileName, String fileDir, String gradientFilePath, String bmtxtFilePath, JTextArea outputTextArea, boolean performRegsitration) constructor for par/recAlgorithmDTICreateListFile(String studyPath, String studyName, String gradientFilePath, String bmtxtFilePath, JTextArea outputTextArea, boolean isInterleaved, boolean performRegsitration) constructor for dicomAlgorithmDTICreateListFile(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 Summary
Modifier and TypeMethodDescriptionvoidalgorithmPerformed(AlgorithmBase algorithm) Called after an algorithm this listener is registered to exits (maybe successfully, maybe not).booleanThis method copies the optional b matrix file that user provided, and copies it to proc dir and renames it to the correct naming syntax.booleanThis method creates the b-matrix file.booleanThis method creates the B-Matrix filebooleanThis method creates the list file.booleanThis method creates the list file.booleanThis method creates the path file.booleanThis method creates the path file for interleaverd datasetsbooleanThis method creates the path filebooleanthis method creates the proc dir in which the list file, path file, and b-matrix file go.booleanthis method creates the proc dir in which the list file, path file, and b-matrix file go.booleanbooleandeleteAllFiles(File dir) voidfinalize()this method cleans up the proc dir if success is false and it sets the lists to null.booleanThis method obtains the b-values for each volume from either the public tag or the private tag.booleanThis method obtains list file data mostly from the 1st slicebooleanthis 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.booleanregsitration of DICOM DWI datasetbooleanregsitration of PAR REC DWI datasetbooleanThis 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.booleanthis method reads the gradient filebooleanvoidActually runs the algorithm.voidrun algorithm for dicomvoidrun algorithm for par/recbooleanthis method sets initial info about the study.booleanThis method writes out the image slices as raw floatMethods inherited from class gov.nih.mipav.model.algorithms.AlgorithmBase
actionPerformed, addListener, addProgressChangeListener, calculateImageSize, calculatePrincipleAxis, computeElapsedTime, computeElapsedTime, convertIntoFloat, delinkProgressToAlgorithm, delinkProgressToAlgorithmMulti, displayError, errorCleanUp, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, generateProgressValues, getDestImage, getElapsedTime, getMask, getMaxProgressValue, getMinProgressValue, getNumberOfThreads, getProgress, getProgressChangeListener, getProgressChangeListeners, getProgressModulus, getProgressStep, getProgressValues, getSrcImage, isCompleted, isImage25D, isMultiThreadingEnabled, isRunningInSeparateThread, isThreadStopped, linkProgressToAlgorithm, linkProgressToAlgorithm, makeProgress, notifyListeners, removeListener, removeProgressChangeListener, run, setCompleted, setImage25D, setMask, setMaxProgressValue, setMinProgressValue, setMultiThreadingEnabled, setNumberOfThreads, setProgress, setProgressModulus, setProgressStep, setProgressValues, setProgressValues, setRunningInSeparateThread, setSrcImage, setStartTime, setThreadStopped, startMethod, windowActivated, windowClosed, windowClosing, windowDeactivated, windowDeiconified, windowIconified, windowOpenedMethods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
studyName
This is the dir name of the study.* -
studyPath
This is the full path of the study.* -
prFileName
par rec file name -
prFileDir
par rec file dir -
gradientFilePath
This is the full path to the gradient file.* -
bmtxtFilePath
This is the full path to the b matrix file.* -
isInterleaved
private boolean isInterleavedboolean if dataset is interelaved -
outputTextArea
TextArea of main dialog for text output.* -
dwiPathTextField
handle to dwi data textfield of main dialog -
seriesFileInfoTreeMap
This is an ordered map of series number and seriesFileInfoTreeSet.* -
seriesFileInfoTreeSet
This is an ordered list of files per series number.* -
isDICOM
private boolean isDICOMboolean indicating if we are dealing with dicom or par/rec -
listFileName
List file name -
bmatrixFileName
B Matrix file name -
pathFileName
Path File name -
success
private boolean successflag indicating if method was successful.* -
totalImageSlices
private int totalImageSlicestotal image slices.* -
totalNumVolumes
private int totalNumVolumestotal num of volumes in study.* -
isEDTI
private boolean isEDTIboolean telling if dataset is eDTI.* -
isGE
private boolean isGEboolean telling if datset is GE.* -
isSiemens
private boolean isSiemensboolean telling if datset is SIEMENS.* -
firstFileInfoDicom
first fileinfo dicom...used for list file info.* -
geSoftwareVersion
private int geSoftwareVersionint telling software version if datset is GE.* -
imageFilter
This is the image filter needed to select the correct dicom images.* -
dicomInfo
Array that holds the dicom tag info* -
isProcDirCreated
private boolean isProcDirCreatedboolean if proc dir was created.* -
numSlicesPerVolume
private int numSlicesPerVolumethis is the number of image slices per volume.* -
nim
private int nimthis is the number of gradient quantities that is obtained by reading first line of gradient file.* -
direction
private float[][] directionthis is the gradient matrix that is populated when reading the gradient file.* -
bValuesArrayList
this is an array of b-values that for each volume.* -
fileParRec
FileParRec handle -
fileInfoPR
file info Par/Rec -
image4D
ModelImage of 4D par/rec dataset -
originalColumnsString
x dim -
originalRowsString
y dim -
numSlicesString
z dim -
nimString
t dim -
phaseEncodingString
phase encoding...hard coded to vertical -
horizontalFOVString
horizontal FOV -
verticalFOVString
vertical FOV -
sliceGapString
slice gap String -
sliceThicknessString
sliec thickness -
imageOrientationString
image orientation -
volParameters
vol parameters -
avgVolIndex
private int avgVolIndexPhilips 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 isOldVersionboolean identifying if par/rec datset is older than version 4.1 -
oldVersionGradientsAL
arraylist of gradients for version 4 of Par/Rec -
nimCounter
private int nimCounterthis counter is used for version 4 of Par/Rec...nim is calculated from gradient file -
imageSlicesDirPath
path for imageSlicesDir -
relativeImageSlicesDirPath
relative path for slices dir for outputting to path file -
rawImageFormatString
raw image format...hardcoded to float since we will be outputting par/rec slices in float format -
unsortedPathsArrayList
arraylist of unsorted path strings to image slices -
xDim
private int xDimxDIm of 4d image -
yDim
private int yDimyDim of 4d image -
zDim
private int zDimzDim of 4d image -
tDim
private int tDimtDim of 4d image -
performRegistration
private boolean performRegistrationboolean for performing registration -
reg35
handle to AlgorithmRegOAR35D -
reg3
handle to AlgorithmRegOAR3D -
cost
private int costregistration option parameters -
DOF
private int DOFregistration option parameters -
interp
private int interpregistration option parameters -
interp2
private int interp2registration option parameters -
registerTo
private int registerToregistration option parameters -
maxIterations
private int maxIterationsregistration option parameters -
numMinima
private int numMinimaregistration option parameters -
rotateBegin
private float rotateBeginregistration option parameters -
rotateEnd
private float rotateEndregistration option parameters -
coarseRate
private float coarseRateregistration option parameters -
fineRate
private float fineRateregistration option parameters -
rotateBeginX
private float rotateBeginXregistration option parameters -
rotateEndX
private float rotateEndXregistration option parameters -
coarseRateX
private float coarseRateXregistration option parameters -
fineRateX
private float fineRateXregistration option parameters -
rotateBeginY
private float rotateBeginYregistration option parameters -
rotateEndY
private float rotateEndYregistration option parameters -
coarseRateY
private float coarseRateYregistration option parameters -
fineRateY
private float fineRateYregistration option parameters -
rotateBeginZ
private float rotateBeginZregistration option parameters -
rotateEndZ
private float rotateEndZregistration option parameters -
coarseRateZ
private float coarseRateZregistration option parameters -
fineRateZ
private float fineRateZregistration option parameters -
doGraph
private boolean doGraphregistration option parameters -
doSubsample
private boolean doSubsampleregistration option parameters -
doMultiThread
private boolean doMultiThreadregistration option parameters -
fastMode
private boolean fastModeregistration option parameters -
maxOfMinResol
private boolean maxOfMinResolregistration option parameters -
dicomB0VolumePath
path to dicom B0 for registration purposes -
refImage
model images -
matchImage
model images -
resultImage
model images -
fileIO
file IO -
registeredStudyName
study name for registered data set -
transform
handle to AlgorithmTransform -
xdimA
private int xdimAparameter for AlgorithmTransform -
ydimA
private int ydimAparameter for AlgorithmTransform -
zdimA
private int zdimAparameter for AlgorithmTransform -
xresA
private float xresAparameter for AlgorithmTransform -
yresA
private float yresAparameter for AlgorithmTransform -
zresA
private float zresAparameter for AlgorithmTransform -
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:AlgorithmBaseActually runs the algorithm. Implemented by inheriting algorithms.- Specified by:
runAlgorithmin classAlgorithmBase
-
performRegistrationPARREC
public boolean performRegistrationPARREC()regsitration of PAR REC DWI dataset -
performRegistrationDICOM
public boolean performRegistrationDICOM()regsitration of DICOM DWI dataset -
registerAndSaveVolumes
-
createSubDirsInRegisteredDir
-
deleteAllFiles
-
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
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:
IOExceptionOutOfMemoryError
-
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:
finalizein classAlgorithmBase
-
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
Description copied from interface:AlgorithmInterfaceCalled 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:
algorithmPerformedin interfaceAlgorithmInterface- Parameters:
algorithm- the algorithm which has just completed
-