Package gov.nih.mipav.model.file
Class FileBRUKER
java.lang.Object
gov.nih.mipav.model.file.FileBase
gov.nih.mipav.model.file.FileBRUKER
Reads a BRUKER file by first reading in the d3proc header file or if the d3proc header file is not\
present the visu_pars file, second the reco header file, third the acqp file in the
same directory or up one or two two parent directories, then the method file,l and finally the 2dseq binary file.
Paravision uses a subject patient coordinate system (L->R, P->A, F->H), with X = L->R, Y = P->A, and Z = F->H.
This is different from the DICOM R->L, A->P, F->H.
Paravision also has a (r, p, s) read, phase, slice coordinate system. ND is the total number of diffusion experiments.
The B Matrix (PVM_DwBMat)(implemented as symmetric 3x3 matrix array of size ND) is calculated for each diffusion experiment
in the imaging coordinate system (r,p,s).
Diffusion Gradient Vector (PVM_DwGradVec) - Parameter of dimension ND X 3 specifying the diffusion gradient amplitudes
in the x,y,z coordinate system.
Eff. B Value (PVM_DwEffBval) - The trace of the b-matrix (is implemented as an array of size ND.
ACQ_patient_pos - defines the patient position inside the magnet. According to
the defined patient position. ACQ_patient_pos may have the values:
Head_Supine - negates Gx and Gz.
Head_Prone - negates Gy and Gz.
Head_Left - negates Gz. Gx and Gy are exchanged.
Head_Right - negates Gx, Gy and Gz. Gx and Gy are exchanged.
Foot_Supine - all gradients remain unchanged.
Foot_Prone - negates Gx and Gy.
Foot_Left - negates Gy. Gx and Gy are exchanged.
Foot_Right - negates Gx. Gx and Gy are exchanged.
Look at O05_GeoEditor Figure 5.1. The description of gradient interchanges and negations together with the figure
show that the x, y, and z must be remaining constant independent of patient position. Therefore, once you have
x, y, z directly from PVM_DwGradVec or use ACQ_grad_matrix to convert PVM_DwBMat from r,p,s to x,y,z, there is no
need to consider ACQ_patient_pos.
ACQ_slice_sepn_mode - defines the slice separation mode of a multi slice
experiment. It can be either Contiguous, Equidistant, Var_Parallel or
Var_Angle. In case of Contiguous, Equidistant and Var_Parallel, the
parameter ACQ_grad_matrix has only one item in the slice dimension, since
these slice orientations produce parallel slices. In case of Var_Angle,
ACQ_grad_matrix has to have NSLICES items in the slice dimension to define
the orientation for each slice separately.
NSLICES - defines the number of slices of a multi slice experiment.
ACQ_grad_matrix[ ][3][3] - is a three dimensional array describing the slice orientation
of the images to be measured.
For ACQ_grad_matrix[i][j][k]
i = 0, ..., NSLICES - 1 specifies the slice index during the acquisition,
j = 0, 1, 2 specifies the read-, phase- and slice gradients,
k = 0, 1, 2 specifies the x, y and z components of the slice direction independent
of the patient position.
The gradient matrix of each slice is orthonormal, which means that the read-,
phase- and slice-gradient vectors are normalized to 1.0 and that they are
orthogonal to each other.
The following Example shows a two slice experiment with slice orientation
Cor_Sag_oblique with ACQ_slice_sepn_mode Var_Angle with 0o for the
first slice and 30o for the second slice.
Example: Cor_Sag_oblique
ACQ_slice_sepn_mode = Var_Angle
NSLICES = 2, (0 and 30 degree orientation)
ACQ_grad_matrix[0][0][0] = 1; 1st slice, read, Gx
ACQ_grad_matrix[0][0][1] = 0; 1st slice, read, Gy
ACQ_grad_matrix[0][0][2] = 0; 1st slice, read, Gz
ACQ_grad_matrix[0][1][0] = 0; 1st slice, phase, Gx
ACQ_grad_matrix[0][1][1] = 0; 1st slice, phase, Gy
ACQ_grad_matrix[0][1][2] = 1; 1st slice, phase, Gz
ACQ_grad_matrix[0][2][0] = 0; 1st slice, slice, Gx
ACQ_grad_matrix[0][2][1] = 1; 1st slice, slice, Gy
ACQ_grad_matrix[0][2][2] = 0; 1st slice, slice, Gz
ACQ_grad_matrix[1][0][0] = 0.866; 2nd slice, read, Gx
ACQ_grad_matrix[1][0][1] = 0.5; 2nd slice, read, Gy
ACQ_grad_matrix[1][0][2] = 0; 2nd slice, read, Gz
ACQ_grad_matrix[1][1][0] = 0; 2nd slice, phase, Gx
ACQ_grad_matrix[1][1][1] = 0; 2nd slice, phase, Gy
ACQ_grad_matrix[1][1][2] = 1; 2nd slice, phase, Gz
ACQ_grad_matrix[1][2][0] = -0,5; 2nd slice, slice, Gx
ACQ_grad_matrix[1][2][1] = 0.866; 2nd slice, slice, Gy
ACQ_grad_matrix[1][2][2] = 0; 2nd slice, slice, Gz
[x, y, z] = [r, p, s] * [ACQ_grad_matrix]
Let A = ACQ_grad_matrix
[x] [r]
[y] = ATranspose [p]
[z] [s]
[x] [x][y][z] = ATranspose [r] [r][p][s] A
[y] [p]
[z] [s]
so the to the BMatrix expressed in terms of xyz is ATranspose B A
[x] [y] [z] [x] = [r][p][s] A ATranspose [r]
[y] [p]
[z] [s]
For orthonormal matrices ATranspose = AInverse, so the trace of the B
matrix is the same for both x,y,z and r,p,s coordinates.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate double[][]private double[]private DTIParametersprivate FileDOCUMENT ME!private StringDOCUMENT ME!private FileInfoBRUKERDOCUMENT ME!private FileInfoBRUKERprivate StringDOCUMENT ME!private booleanDOCUMENT ME!private double[][]private ModelImageDOCUMENT ME!private intDOCUMENT ME!private float[]DOCUMENT ME!private ModelLUTDOCUMENT ME!private intprivate StringThe preferred image name, used if inversion time exists.Fields inherited from class gov.nih.mipav.model.file.FileBase
BIG_ENDIAN, bitsPerPixel, fileNames, LITTLE_ENDIAN, pBarVisible, raFile, READ, READ_WRITE -
Constructor Summary
ConstructorsConstructorDescriptionFileBRUKER(String fileName, String fileDir) BRUKER reader/writer constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns an ArrayList of all the names of subdirectories of the directory denoted bycurrentDir.voidfinalize()Prepares this class for cleanup.This convenience method is needed to establish the location of the 2dseq fileAccessor that returns the file info.returns LUT if defined.private String[]DOCUMENT ME!voidreadacqp()DOCUMENT ME!private voidreadBuffer(int slice, float[] buffer) Reads a slice of data at a time and stores the results in the buffer.voidDOCUMENT ME!readImage(boolean one) This method reads one slice from the file into byteBuffer and then transfers into the float array imgBuffer.private StringreadLine()Reads lines of the file until a nonnull String results or the end of the file is reached.voidReads the optional method file that may be part of the Bruker scan.voidreadreco()DOCUMENT ME!voidDOCUMENT ME!private StringsearchChildDir(File currentDir) Utility method for searching for the d3proc file that indicates a BRUKER file has been found, note method is recursive to a maximum level of 3.voidsetFileDir(String fDir) Accessor to set the file directory (used for reading BRUKER files).voidsetFileName(String fName) Accessor to set the file name (used for reading BRUKER files).Methods inherited from class gov.nih.mipav.model.file.FileBase
addProgressChangeListener, bytesToDouble, bytesToFloat, bytesToInt, bytesToShort, doubleToBytes, fireProgressStateChanged, fireProgressStateChanged, fireProgressStateChanged, floatToBytes, getBufferDouble, getBufferFloat, getBufferInt, getBufferLong, getBufferShort, getBufferUShort, getDataType, getDouble, getFloat, getInt, getLong, getProgressChangeListeners, getRaFile, getSignedShort, getString, getUInt, getUnsignedByte, getUnsignedShort, intToBytes, isBigEndian, isProgressBarVisible, linkProgress, longToBytes, readDouble, readFloat, readInt, readLong, readShort, readString, readUnsignedShort, removeProgressChangeListener, setBigEndian, setBufferFloat, setBufferInt, setBufferLong, setBufferShort, setBufferString, setDataType, setEndianess, shortToBytes, writeBytes, writeDouble, writeFloat, writeInt, writeLong, writeShort
-
Field Details
-
file
DOCUMENT ME! -
fileDir
DOCUMENT ME! -
fileInfo
DOCUMENT ME! -
fileInfoCopy
-
fileName
DOCUMENT ME! -
foundEOF
private boolean foundEOFDOCUMENT ME! -
image
DOCUMENT ME! -
imageSlice
private int imageSliceDOCUMENT ME! -
imgResols
private float[] imgResolsDOCUMENT ME! -
LUT
DOCUMENT ME! -
prefImageName
The preferred image name, used if inversion time exists. -
numVolumes
private int numVolumes -
dtiParams
-
bMatrixVals
private double[][] bMatrixVals -
gradients
private double[][] gradients -
bValues
private double[] bValues
-
-
Constructor Details
-
FileBRUKER
BRUKER reader/writer constructor.- Parameters:
fileName- file namefileDir- file directory- Throws:
IOException- if there is an error making the file
-
-
Method Details
-
searchChildDir
Utility method for searching for the d3proc file that indicates a BRUKER file has been found, note method is recursive to a maximum level of 3. -
childDir
Returns an ArrayList of all the names of subdirectories of the directory denoted bycurrentDir. -
finalize
public void finalize()Prepares this class for cleanup. Calls thefinalizemethod for existing elements, closes any open files and sets other elements tonull. -
getFileInfo
Accessor that returns the file info.- Returns:
- FileInfoBase containing the file info
-
getModelLUT
returns LUT if defined.- Returns:
- the LUT if defined else it is null
-
getDTIParameters
- Returns:
-
readMethod
Reads the optional method file that may be part of the Bruker scan.- Throws:
IOException- DOCUMENT ME!
-
readacqp
DOCUMENT ME!- Throws:
IOException- DOCUMENT ME!
-
readvisu_pars
DOCUMENT ME!- Throws:
IOException- DOCUMENT ME!
-
readd3proc
DOCUMENT ME!- Throws:
IOException- DOCUMENT ME!
-
readImage
This method reads one slice from the file into byteBuffer and then transfers into the float array imgBuffer.- Parameters:
one- DOCUMENT ME!- Returns:
- returns the image
- Throws:
IOException- if there is an error reading the file
-
readreco
DOCUMENT ME!- Throws:
IOException- DOCUMENT ME!
-
setFileDir
Accessor to set the file directory (used for reading BRUKER files).- Parameters:
fDir- file directory of image to read.
-
setFileName
Accessor to set the file name (used for reading BRUKER files).- Parameters:
fName- file name of image to read.
-
parse
DOCUMENT ME!- Parameters:
inString- DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
readBuffer
Reads a slice of data at a time and stores the results in the buffer.- Parameters:
slice- offset into the file stored in the dataOffset arraybuffer- buffer where the info is stored- Throws:
IOException- if there is an error reading the file
-
readLine
Reads lines of the file until a nonnull String results or the end of the file is reached.- Returns:
- the line read in
- Throws:
IOException- if there is an error reading the file
-
getFileDir
This convenience method is needed to establish the location of the 2dseq file
-