Package gov.nih.mipav.model.file
Class FileIO
java.lang.Object
gov.nih.mipav.model.file.FileIO
This class controls the file input/output of most formats that MIPAV supports, including tiff, raw, analyze, DICOM,
and Medvision. It switches based on file type and calls the file constructors, readers, and writers for the specific
file type. However, note the FileAvi and FileQT are called directly from ViewJFrameBase for file writes.
- Version:
- 0.1 Sept 5, 1997
- Author:
- Matthew J. McAuliffe, Ph.D., Neva Cherniavsky
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class(package private) static classclassOrientation information held by orientation. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate String[]For multi file formats where data is saved in a set of filesprivate booleanprivate booleanstatic final StringDOCUMENT ME!static final StringDOCUMENT ME!private StringDirectory where the image file can be found.private ModelImageprivate booleanprivate ModelLUTIf a LUT is to be saved with the image it is stored here.private ModelRGBDOCUMENT ME!private ViewJProgressBarDOCUMENT ME!private booleanRefers to whether or not the FileIO reports progress or errors.private RawImageInfoDOCUMENT ME!private booleanprivate intAddress of second image in file.private booleanprivate booleanprivate final ViewUserInterfaceReference to the user interface.private JDialogUnknownIODialog to prompt the user to determine the correct file type. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate intabsBiggest(double zero, double one, double two) Helper method for finding biggest (absolute value) of three numbers.private booleancallDialog(int[] extents, int dataType, FileWriteOptions options) Calls GUI dialogs based on what type of image this is and the number of dimensions.static final intchkMultiFile(int fileType, boolean multiFile) Sets specific types to be multifile based on the input argument.private StringconvertNumbersToStr(String dicomNumberString) static final ModelImageconvertToARGB(ModelImage modelImage) DOCUMENT ME!private ModelImageconvertToMultifile(ModelImage existingMultifileImage, ModelImage origImage, int[] extents, int pos) static final ModelImageconvertToUBYTE(ModelImage modelImageResult) DOCUMENT ME!private static voidcopyResolutions(ModelImage modelImageSrc, ModelImage modelImageResult, int sliceNum) DOCUMENT ME!private ModelImagecreateMultifile(FileInfoBase myFileInfo, ModelImage origImage, String fileDir, String fileName, boolean quiet) private voidcreateProgressBar(FileBase fBase, String fName, String message) Creates the progress bar and links (if not null) the progress bar to a FileBase for reading/writing if the progress bar should not be updated within the FileBase's readImage/writeImage, pass in null to the fBase and update within FileIO's read[ImageType] or write[ImageType] methods.protected booleandataConversion(FileInfoBase sourceInfo, FileInfoBase destInfo) Provides a method of conversion fromFileInfoDicomtoFileInfoImageXML, by filling theFileInfoImageXMLwith sets of chosen image information (from the DICOM tags).voiddispose()private static StringgenerateGEID(FileDicomTagTable tagTable) byte[]getByteImageData(ModelImage image, int start, int length) protected Hashtable<FileDicomKey, FileDicomTag> getDicomSaveList(FileInfoDicom sourceInfo, boolean isXML) Returns a list of tags that are a subset of the DICOM dictionary.private doublegetDoubleValOrAsciiVal(String value) intPresents a dialog for a user-entered definition of the image type.private StringgetModality(FileDicom imageFile) Gets the value of the Dicom modality tag, 0008,0060.Returns LUT associated with the image file.Gets the model RGB.private final BufferedImageintReturns address of TIFF header of second image if present in CZ-Private Tag of LSM 510 file Returns zero if not present.private voidinsertEnhancedSequence(FileInfoDicom myFileInfo, FileInfoDicom[][] infoAr, int dataType) private booleanisDiffusionSeries(FileInfoDicom dicomInfo) booleanisQuiet()Refers to whether or not the FileIO will send alerts to the user about progress or errors.protected voidLSMDataConversion(FileInfoLSM sourceInfo, FileInfoImageXML destInfo) Provides a method of conversion fromFileInfoLSMtoFileInfoImageXML, by filling theFileInfoImageXMLwith sets of chosen image information.private ModelImageReads an AFNI file by calling the read method of the file.private ModelImagereadAnalyze(String fileName, String fileDir, boolean one) Reads an analyze file by calling the read method of the file.private ModelImagereadAnalyzeMulti(String fileName, String fileDir) Reads a multi Analyze file.private ModelImageReads an AVI file by calling the read method of the file.private ModelImagereadBFLOAT(String fileName, String fileDir, boolean one) Reads a BFLOAT file by calling the read method of the file.private ModelImagereadBioRad(String fileName, String fileDir, boolean one) Reads a BioRad PIC file by calling the read method of the file.private ModelImageReads a BMP file by calling the read method of the file.private ModelImagereadBMPMulti(String fileName, String fileDir, boolean one) private ModelImagereadBRUKER(String fileName, String fileDir, boolean one) Reads a BRUKER file by first reading in the d3proc header file, second the reco header file, third the acqp file, and finally the 2dseq binary file.private ModelImagereadCheshire(String fileName, String fileDir) Reads a Cheshire file by calling the read method of the file.private ModelImageReads a COR file by first reading the header file then reading in each separate slice file.private ModelImageReads a Zeiss ZISRAW (CZI) file by calling the read method of the file.Reads a list of DICOM files.private DTIParametersreadDicomDTIParameters(FileInfoDicom[] dicomInfoList) private ModelImageReads a Dm3 file by calling the read method of the file.private intreadFileType(boolean niftiCompressed, boolean multiFile, String fileName, String fDir) private ModelImageReads a FITS file by calling the read method of the file.readGEGenesis5X(String fileName, String fileDir) Reads in a single GE Genesis type file.readGEGenesis5XMulti(String fileName, String fileDir) Reads in multiple GE Genesis 5x type files.readGESigna4X(String fileName, String fileDir) Reads in a single GE Signa 4x type file.private ModelImagereadGESigna4XMulti(String fileName, String fileDir) Reads in multiple GE Signa 4x type files.readHeader(String absoluteFilename) Reads generic file from an absolute filename.readHeader(String absoluteFilename, boolean multiFile) Reads generic file from an absolute filename.readHeader(String fileName, String fileDir) Reads file, determines file type, and calls a read function specific to the file.readHeader(String fileName, String fileDir, boolean multiFile) Reads file, determines file type, and calls a read function specific to the file.private ModelImageReads an ICS file by calling the read method of the file.Reads generic file from an absolute filename.Reads file, determines file type, and calls a read function specific to the file.readImage(String fileName, String fileDir, boolean multiFile, FileInfoBase fileInfo) Reads file, determines file type, and calls a read function specific to the file.readImage(String fileName, String fileDir, boolean multiFile, FileInfoBase fileInfo, boolean loadB) Reads file, determines file type, and calls a read function specific to the file.readImage(String fileName, String fileDir, boolean multiFile, FileInfoBase fileInfo, int secondAddress) Reads file, determines file type, and calls a read function specific to the file.readImage(String fileName, String fileDir, boolean multiFile, FileInfoBase fileInfo, int secondAddress, boolean loadB, boolean one) Reads file, determines file type, and calls a read function specific to the file.private ModelImagereadInterfile(String fileName, String fileDir, boolean one) Reads an Interfile file by calling the read method of the file.private ModelImagereadInterfileMulti(String fileName, String fileDir) Reads a multi Interfile file.Reads a JIMI file by calling the read method of the file.private ModelImagereadJPEG_LS(String fileName, String fileDir) Reads an JPEG_LS file by calling the read method of the file.private ModelImagereadJPEG_XL(String fileName, String fileDir) Reads an JPEG_XL file by calling the read method of the file.private ModelImagereadJpeg2000(String fileName, String fileDir, boolean one) Reads a JPEG2000 file by calling the read method of the file.private ModelImageReads a Improvision OpenLab LIFF file by calling the read method of the file.private ModelImageReads a LSM file by calling the read method of the file.private ModelImagereadLSMMulti(String fileName, String fileDir) Reads a multi LSM file by first reading the headers then reading in each separate file.private ModelImagereadMagnetomVision(String fileName, String fileDir) Reads a Magnetom Vision file by calling the read method of the file.private ModelImagereadMagnetomVisionMulti(String fileName, String fileDir) Reads multiple Magnetom Vision files by calling the read method of the file.private ModelImageReads a Map file by calling the read method of the file.private ModelImagereadMATLAB(String fileName, String fileDir, boolean one) Reads a NATLAB file by calling the read method of the file.private ModelImagereadMedVision(String fileName, String fileDir) Reads a MedVision file by calling the read method of the file.private ModelImagereadMetaImage(String fileName, String fileDir, boolean one) Reads a MetaImage file by calling the read method of the file. if so, calls that method instead.private ModelImageReads a MGH file by calling the read method of the file. if so, calls that method instead.private ModelImagereadMicroCat(String fileName, String fileDir, boolean one) Reads an Micro Cat file by calling the read method of the file.private ModelImageReads a MINC file by calling the read method of the file.private ModelImagereadMincHDF(String fileName, String fileDir, boolean one) private ModelImagereadMincMulti(String fileName, String fileDir) Reads a multi Minc file.private ModelImageReads a MRC file by calling the read method of the file.readNIFTI(String fileName, String fileDir, boolean one, boolean niftiCompressed, boolean noImportData, boolean noReadPrivateTags) Reads a NIFTI file by calling the read method of the file. if so, calls that method instead.private ModelImagereadNIFTIMulti(String fileName, String fileDir) Reads a multi NIFTI file.private ModelImageReads a NRRD file by calling the read method of the file. if so, calls that method instead.private ModelImagereadNRRDMulti(String fileName, String fileDir) Reads a multi NRRD file.readOneImage(String fileName, String fileDir) Reads file, determines file type, and calls a read function specific to the file.readOrderedARGB(File[] fileList, int numChannels, int[] channelMap, boolean showOrderedProgressBar, Dimension subsampleDimension, boolean forceUBYTE) This method examines parameter fileList and loads TIFF files according to the order in the list.readOrderedGrayscale(File[] fileList, boolean showLocalProgressBar, Dimension subsampleDimension, boolean forceUBYTE) This method will load a group of files in the order of fileList.readOrderedGrayscale(File[] fileList, boolean showLocalProgressBar, Dimension subsampleDimension, boolean forceUBYTE, int numSlices, int numTimePoints) This method will load a group of files in the order of fileList.readOrderedGrayscale2(File[] fileList, boolean showLocalProgressBar, Dimension subsampleDimension, boolean forceUBYTE, int numSlices, int numTimePoints) private ModelImagereadPARREC(String fileName, String fileDir, boolean one) Reads a PARREC file by calling the read method of the file.private ModelImagereadPARRECMulti(String fileName, String fileDir) Reads a multi PARREC file.private ModelImageReads a PGM file by calling the read method of the file.private ModelImageReads a PPM file by calling the read method of the file.private ModelImageReads a QT file by calling the read method of the file.private ModelImagereadRaw(String fileName, String fileDir, FileInfoBase fileInfo) Reads a RAW file by calling the read method of the file.private ModelImagereadRawMulti(String fileName, String fileDir, FileInfoBase fileInfo) Reads a RAW file by calling the read method of the file.private ModelImagereadSiemensText(String fileName, String fileDir, boolean one) Reads an siemenstext file by calling the read method of the file.private ModelImagereadSpar(FileInfoBase fileInfo, String fileName, String fileDir, boolean one) Reads a Spar file by calling the read method of the file.private ModelImageReads an SPM file by calling the read method of the file.private ModelImageReads a STK file by calling the read method of the file.private ModelImageReads a SVS file by calling the read method of the file.Reads a TIFF file by calling the read method of the file.private ModelImagereadTiffMulti(String fileName, String fileDir) Reads a multi TIFF file by first reading the headers then reading in each separate file.private ModelImageReads a TMG file by calling the read method of the file.private ModelImagereadTrackVis(String fileName, String fileDir) Reads in a single TrackVis file.private ModelImageReads an XML file by calling the read method of the file.private ModelImagereadXMLMulti(String fileName, String fileDir) Reads a multi XML file.readXMLThumbnail(String name, String directory) Reads a thumbnail image from an XML file. if thumbnail is empty, will returned FileImageXML will be null.private ModelImageReads a Zeiss ZVI file by calling the read method of the file.(package private) Stringprivate voidremoveEnhancedDicomInfo(FileInfoDicom myFileInfo, FileInfoBase[] fileInfoBases) private String[]removeFromImageList(String selectedFileName, String[] fileList) private static float[]resample255(float[] buffer, float min, float max) The purpose of this method is to take a buffer of float and resample the values to proper UBYTE values.voidsetDisplayRangeOfSlicesDialog(boolean displayRangeOfSlicesDialog) voidsetFileDir(String dir) Sets the directory where the file will be saved or opened.voidsetImageA(ModelImage imageA) voidsetModelLUT(ModelLUT lut) Sets the LUT.voidsetModelRGB(ModelRGB rgb) Sets the RGB.voidsetPBar(ProgressBarInterface pBar) Sets the progress bar (either panel or frame) to be used in image opening to update status.voidsetQuiet(boolean q) Refers to whether or not the FileIO will send alerts to the user about progress or errors.voidsetRawImageInfo(RawImageInfo rawInfo) DOCUMENT ME!voidsetSuppressProgressBar(boolean suppressProgressBar) voidsetSuppressUnknownFileTypeDialog(boolean val) If set to true, then unknown file type dialog is not shown and an error is returned instead.voidsetTIFFOrientation(boolean doTIFFOrientation) voidsetUserDefinedFileTypes_textFieldPref(String udefSuffix) This method sets the userDefinedFileTypes_textField preference.voidsetUserDefinedFileTypesPref(String udefSuffix) This method sets the userDefinedFileTypes preference.private static booleansort(float[] A, int[] B, int size) Sorts an array of floats (using Arrays.sort), turns into array of ints used to sort images by A; thus, the final value of B[i] is for the ith image read in, put that image at location B[i] in the image buffer.private static booleansort(int[] A, int[] B, int size) Sorts an array of ints (using insertion sort), turns into array of ints used to sort images by image number; thus, the final value of B[i] is for the ith image read in, put that image at location B[i] in the image buffer.private intsortDtiDicomData(String studyDescription, String seriesDescription, String scannerType, FileDicomTagTable tagTable, FileInfoDicom[] savedFileInfos, int[] indices, int instanceNumsLength, int[] zInst) static final ModelImagesubsample(ModelImage modelImage, Dimension subsampleDimension) The purpose of this method is to subsample a ModelImage to the dimensions specified by the subsampleDimension parameter.private int[]tryPartitionByMediaUID(FileInfoDicom[] savedFileInfos) partition into image subsets using media instance uidsprivate booleanwriteAfni(ModelImage image, FileWriteOptions options) Writes an AFNI file to store the image.private booleanwriteAnalyze(ModelImage image, FileWriteOptions options, boolean zerofunused) Writes an analyze file to store the image.private booleanwriteAvi(ModelImage image, FileWriteOptions options) Writes an AVI file to store the image.private booleanwriteCOR(ModelImage image, FileWriteOptions options) Writes a Freesurfer COR file to store the image.private booleanwriteDicom(ModelImage image, FileWriteOptions options) Writes a DICOM file to store the image.private booleanwriteDicomSlice(ModelImage image, int sliceNumber, FileWriteOptions options, FileInfoDicom fileDicom, FileInfoBase originalFileInfo, int originalImageDataType, TransMatrix originalImageMatrix, double originalImageMin, double originalImageMax, boolean originalIsDicom, boolean originalIsColor) Writes a DICOM file on a slice basis.private booleanwriteFits(ModelImage image, FileWriteOptions options) Writes a Fits file to store the image.private booleanwriteGEGenesis5X(ModelImage image, FileWriteOptions options) Writes a GESigna5X file to store the image.private booleanwriteGESigna4X(ModelImage image, FileWriteOptions options) Writes a GESigna4X file to store the image.private booleanwriteICS(ModelImage image, FileWriteOptions options) Writes an ICS file to store the image.voidwriteImage(ModelImage image, FileWriteOptions options) Determines file type from the file name and calls different write functions based on the file type.voidwriteImage(ModelImage image, FileWriteOptions options, boolean bDisplayProgress, boolean allowScriptRecording) Determines file type from the file name and calls different write functions based on the file type.private booleanwriteInterfile(ModelImage image, FileWriteOptions options) Writes an Interfile file to store the image.private booleanwriteJimi(ModelImage image, FileWriteOptions options) Writes a JIMI file to store the image.private booleanwriteJPEG_LS(ModelImage image, FileWriteOptions options) Writes a JPEG_LS file to store the image.private booleanwriteJpeg2000(ModelImage image, FileWriteOptions options) Writes a JPEG2000 file to store the image.private booleanwriteMATLAB(ModelImage image, FileWriteOptions options) Writes a MATLAB file to store the image.private booleanwriteMetaImage(ModelImage image, FileWriteOptions options) Writes a MetaImage file to store the image.private booleanwriteMGH(ModelImage image, FileWriteOptions options) Writes a MGH or MGZ file to store the image.private booleanwriteMinc(ModelImage image, FileWriteOptions options) Writes a Minc file to store the image.private booleanwriteMincHDF(ModelImage image, FileWriteOptions options) Writes out a MINC 2.0 HDF5 formatted fileprivate booleanwriteMRC(ModelImage image, FileWriteOptions options) Writes a MRC file to store the image.private booleanwriteNIFTI(ModelImage image, FileWriteOptions options) Writes a NIFTI file to store the image.private booleanwriteNRRD(ModelImage image, FileWriteOptions options) Writes a NRRD file to store the image.private booleanwritePARREC(ModelImage image, FileWriteOptions options) Writes a PAR/REC file to store the image.private booleanwriteRaw(ModelImage image, FileWriteOptions options) Writes a raw file to store the image.private booleanwriteSPM(ModelImage image, FileWriteOptions options) Writes a SPM file to store the image.private booleanwriteSTK(ModelImage image, FileWriteOptions options) Writes a STK file to store the image.private booleanwriteTiff(ModelImage image, FileWriteOptions options) Writes a TIFF file to store the image.private booleanwriteVista(ModelImage image, FileWriteOptions options) writes Vista format filesprivate booleanwriteXML(ModelImage image, FileWriteOptions options, boolean bDisplayProgress) Writes the image in our MIPAV XML format.
-
Field Details
-
FILE_READ
DOCUMENT ME!- See Also:
-
FILE_WRITE
DOCUMENT ME!- See Also:
-
fileDir
Directory where the image file can be found. -
LUT
If a LUT is to be saved with the image it is stored here. -
modelRGB
DOCUMENT ME! -
progressBar
DOCUMENT ME! -
quiet
private boolean quietRefers to whether or not the FileIO reports progress or errors. -
rawInfo
DOCUMENT ME! -
secondImage
private int secondImageAddress of second image in file. -
UI
Reference to the user interface. -
unknownIODialog
Dialog to prompt the user to determine the correct file type. If the type of file to read is unknown (ie., the suffix doesn't match one of the known types, build and display the unknown file dialog so the user can try to identify the image type so the correct reader can be used -
saveAsEncapJP2
private boolean saveAsEncapJP2 -
displayRangeOfSlicesDialog
private boolean displayRangeOfSlicesDialog -
dataFileName
For multi file formats where data is saved in a set of files -
isDTISort
private boolean isDTISort -
doTIFFOrientation
private boolean doTIFFOrientation -
imageA
-
suppressProgressBar
private boolean suppressProgressBar -
suppressUnknownFileTypeDialog
private boolean suppressUnknownFileTypeDialog
-
-
Constructor Details
-
FileIO
public FileIO()Creates the FileIO and displaysChoose File Type
unknown file dialog. Constructs a new FileIO object, sets the user interface, and initializes the unknown file dialog. Also gets the userDefinedFileTypeAssociations preferences -
FileIO
Creates the FileIO and displaysChoose File Type
unknown file dialog. Constructs a new FileIO object, sets the user interface, sets the LUT, and initializes the unknown file dialog. Also gets the userDefinedFileTypeAssociations preferences- Parameters:
_LUT- Passes LUT into file IO object so that LUT can be store with image (i.e. TIFF).
-
-
Method Details
-
dispose
public void dispose() -
chkMultiFile
public static final int chkMultiFile(int fileType, boolean multiFile) Sets specific types to be multifile based on the input argument. Not all file types are supported to handle multifiles. Those that do support building a 3D image out of a series of 2D images are defined to have that input capability here.- Parameters:
fileType- Input file type. File types which MIPAV does not allow multifile images get the file type returned as sent.multiFile- Iftrue, returns a new filetype corresponding to the input filetype + MULTIFILE. Iffalse, returns the given filetype.- Returns:
- The new or old fileType.
-
setImageA
-
setSuppressProgressBar
public void setSuppressProgressBar(boolean suppressProgressBar) - Parameters:
suppressProgressBar-
-
convertToARGB
DOCUMENT ME!- Parameters:
modelImage- ModelImage - the image to resample to UBYTE- Returns:
- ModelImage
-
convertToUBYTE
DOCUMENT ME!- Parameters:
modelImageResult- ModelImage - the image to resample to UBYTE- Returns:
- ModelImage
-
subsample
The purpose of this method is to subsample a ModelImage to the dimensions specified by the subsampleDimension parameter.- Parameters:
modelImage- ModelImage - the image to be subsampled. This image will be destroyed in the course of the algorithmsubsampleDimension- Dimension - the dimensions to subsample to.- Returns:
- ModelImage - the subsampled image
-
getFileType
public int getFileType()Presents a dialog for a user-entered definition of the image type.- Returns:
- The image file type entered by the user, or FileUtility.ERROR if FileIO is quiet or the dialog is cancelled. see FileUtility.ERROR see isQuiet()
- See Also:
-
getModelLUT
Returns LUT associated with the image file.- Returns:
- The LUT associated with the image although it may be null.
-
getModelRGB
Gets the model RGB.- Returns:
- ModelRGB
-
getSecondImage
public int getSecondImage()Returns address of TIFF header of second image if present in CZ-Private Tag of LSM 510 file Returns zero if not present.- Returns:
- secondImage
-
isQuiet
public boolean isQuiet()Refers to whether or not the FileIO will send alerts to the user about progress or errors.- Returns:
- Whether to suppress GUI elements which would require user interaction (ie, error dialogs).
-
readDicom
Reads a list of DICOM files. DICOM images have all their slices in separate files (except multi-frame), with different information in each header. The position of the slice in the image is determined by information found in the header so all the headers must be read before the images can be read. That's why this method goes through all the images twice.- Parameters:
selectedFileName- Name of the image file selected to be readinthis#fileDirto read. Used to ID study and series numberfileList- List of all the files to be read in.performSort-trueif this method is to sort the files in the list, or,falsewill apply the images in each file in the order they appear as the order to use in the ModelImage.- Returns:
- The image that was read in, or null if failure.
-
isDiffusionSeries
-
readDicomDTIParameters
-
sortDtiDicomData
private int sortDtiDicomData(String studyDescription, String seriesDescription, String scannerType, FileDicomTagTable tagTable, FileInfoDicom[] savedFileInfos, int[] indices, int instanceNumsLength, int[] zInst) -
generateGEID
-
tryPartitionByMediaUID
partition into image subsets using media instance uids -
removeFromImageList
-
getModality
Gets the value of the Dicom modality tag, 0008,0060. SR tags indicate a structured report file.- Parameters:
imageFile-- Returns:
-
readHeader
Reads generic file from an absolute filename.- Parameters:
absoluteFilename- String - the absolute filename, including the path- Returns:
- ModelImage
-
readHeader
Reads generic file from an absolute filename.- Parameters:
absoluteFilename- String - the absolute filename, including the pathmultiFile- Flag indicating multi file.- Returns:
- ModelImage
-
readHeader
Reads file, determines file type, and calls a read function specific to the file. That read function returns an image and this function stores it in ModelImage. File is not multi file, file info is not previously known, there's no "second address" for AFNI, and this is not an image B.- Parameters:
fileName- File name where image is located.fileDir- File directory where image is located.- Returns:
- The image that was read in from the file.
-
readHeader
Reads file, determines file type, and calls a read function specific to the file. That read function returns an image and this function stores it in ModelImage.- Parameters:
fileName- File name where image is located.fileDir- File directory where image is located.multiFile- Flag indicating multi file.- Returns:
- The image that was read in from the file.
-
readImage
Reads generic file from an absolute filename.- Parameters:
absoluteFilename- String - the absolute filename, including the path- Returns:
- ModelImage
-
readImage
Reads file, determines file type, and calls a read function specific to the file. That read function returns an image and this function stores it in ModelImage. File is not multi file, file info is not previously known, there's no "second address" for AFNI, and this is not an image B.- Parameters:
fileName- File name where image is located.fileDir- File directory where image is located.- Returns:
- The image that was read in from the file.
-
readImage
public ModelImage readImage(String fileName, String fileDir, boolean multiFile, FileInfoBase fileInfo) Reads file, determines file type, and calls a read function specific to the file. That read function returns an image and this function stores it in ModelImage.- Parameters:
fileName- File name where image is located.fileDir- File directory where image is located.multiFile- Flag indicating multi file.fileInfo- File info already known; will usually be null, but valid if called from script parser.- Returns:
- The image that was read in from the file.
-
readImage
public ModelImage readImage(String fileName, String fileDir, boolean multiFile, FileInfoBase fileInfo, boolean loadB) Reads file, determines file type, and calls a read function specific to the file. That read function returns an image and this function stores it in ModelImage.- Parameters:
fileName- File name where image is located.fileDir- File directory where image is located.multiFile- Flag indicating multi file.fileInfo- File info already known; will usually be null, but valid if called from script parser.loadB- Flag indicating if this is an image B.- Returns:
- The image that was read in from the file.
-
readImage
public ModelImage readImage(String fileName, String fileDir, boolean multiFile, FileInfoBase fileInfo, int secondAddress) Reads file, determines file type, and calls a read function specific to the file. That read function returns an image and this function stores it in ModelImage.- Parameters:
fileName- File name where image is located.fileDir- File directory where image is located.multiFile- Flag indicating multi file.fileInfo- File info already known; will usually be null, but valid if called from script parser.secondAddress- Address of second TIFF header- Returns:
- The image that was read in from the file.
-
readImage
public ModelImage readImage(String fileName, String fileDir, boolean multiFile, FileInfoBase fileInfo, int secondAddress, boolean loadB, boolean one) Reads file, determines file type, and calls a read function specific to the file. That read function returns an image and this function stores it in ModelImage.- Parameters:
fileName- File name where image is located.fileDir- File directory where image is located.multiFile- Flag indicating multi file loading of images from directory.trueis load images of this filetype to be loaded as a set (when this feature is supported).fileInfo- File info already known; will usually be null, but valid if called from script parser.secondAddress- Address of second TIFF headerloadB- Flag indicating if this is an image B.one- A load-single flag.trueindicates that the method is to load only the file that is defined by thefileName, rather than a multiple file load of a 3d Image.- Returns:
- The image that was read in from the file.
-
readFileType
-
readOneImage
Reads file, determines file type, and calls a read function specific to the file. That read function returns an image and this function stores it in ModelImage. File is not multi file, file info is not previously known, there's no "second address" for AFNI, and this is not an image B. This is just one image regardless of how many slices there are; the middle slice of a 3D dataset will be displayed.- Parameters:
fileName- File name where image is located.fileDir- File directory where image is located.- Returns:
- The image that was read in from the file.
-
readOrderedARGB
public ModelImage readOrderedARGB(File[] fileList, int numChannels, int[] channelMap, boolean showOrderedProgressBar, Dimension subsampleDimension, boolean forceUBYTE) This method examines parameter fileList and loads TIFF files according to the order in the list. It can load 2, 3, or 4 channel images. The method will examine channelMap to determine in which order the ARGB channels should be interleaved.- Parameters:
fileList- File[] - the list of File objects, preorderednumChannels- int - the number of channels the result image is to havechannelMap- int[] - a mapping of channels (ARGB) to positions. For example, a channelMap parameter of {2, 1, 0, 3} means the first channel will be G, the second will be R, the third will be A and the last will be B.showOrderedProgressBar- boolean - This parameter is used to control whether the local progress bar is shown. Note this is different than FileIO's global progress bar. The reason for the difference is because this method uses FileIO's readOneImage() method. That method uses the global progress bar. Its useless to have two progress bars, and FileIO isn't set up in a way that allows this method to directly control the global progress bar, hence the need for its own local one.subsampleDimension- - the dimensions of the result image if subsampling is desired. To skip subsampling, this parameter should be nullforceUBYTE- boolean - force the image to be constructed with an unsigned byte data type- Returns:
- ModelImage
-
readOrderedGrayscale
public ModelImage readOrderedGrayscale(File[] fileList, boolean showLocalProgressBar, Dimension subsampleDimension, boolean forceUBYTE) This method will load a group of files in the order of fileList. The result will be a grayscale ModelImage.- Parameters:
fileList- File[] - list of File objects, preorderedshowLocalProgressBar- boolean - This parameter is used to control whether the local progress bar is shown. Note this is different than FileIO's global progress bar. The reason for the difference is because this method uses FileIO's readOneImage() method. That method uses the global progress bar. Its useless to have two progress bars, and FileIO isn't set up in a way that allows this method to directly control the global progress bar, hence the need for its own local one.subsampleDimension- - the dimensions of the result image if subsampling is desired. To skip subsampling, this parameter should be nullforceUBYTE- boolean - force the image to be constructed with an unsigned byte data type- Returns:
- ModelImage
-
readOrderedGrayscale
public ModelImage readOrderedGrayscale(File[] fileList, boolean showLocalProgressBar, Dimension subsampleDimension, boolean forceUBYTE, int numSlices, int numTimePoints) This method will load a group of files in the order of fileList. The result will be a grayscale ModelImage.- Parameters:
fileList- File[] - list of File objects, preorderedshowLocalProgressBar- boolean - This parameter is used to control whether the local progress bar is shown. Note this is different than FileIO's global progress bar. The reason for the difference is because this method uses FileIO's readOneImage() method. That method uses the global progress bar. Its useless to have two progress bars, and FileIO isn't set up in a way that allows this method to directly control the global progress bar, hence the need for its own local one.subsampleDimension- - the dimensions of the result image if subsampling is desired. To skip subsampling, this parameter should be nullforceUBYTE- boolean - force the image to be constructed with an unsigned byte data type- Returns:
- ModelImage
-
readOrderedGrayscale2
public ModelImage readOrderedGrayscale2(File[] fileList, boolean showLocalProgressBar, Dimension subsampleDimension, boolean forceUBYTE, int numSlices, int numTimePoints) -
readXMLThumbnail
Reads a thumbnail image from an XML file. if thumbnail is empty, will returned FileImageXML will be null.- Parameters:
name- filenamedirectory- file's directory- Returns:
- FileImageXML containing thumbnail or null
-
setFileDir
Sets the directory where the file will be saved or opened.- Parameters:
dir- String directory
-
setModelLUT
Sets the LUT.- Parameters:
lut- the lookup table.
-
setModelRGB
Sets the RGB.- Parameters:
rgb- lut the lookup table.
-
setPBar
Sets the progress bar (either panel or frame) to be used in image opening to update status.- Parameters:
pBar- ProgressBarInterface
-
setQuiet
public void setQuiet(boolean q) Refers to whether or not the FileIO will send alerts to the user about progress or errors.- Parameters:
q- Indicates if the output from the methods in this object are to display dialogs interrupting flow in a locally-defined manner.trueindicates that the process is to NOT inform the user and therefore bequiet
.
-
setRawImageInfo
DOCUMENT ME!- Parameters:
rawInfo- DOCUMENT ME!
-
setUserDefinedFileTypes_textFieldPref
This method sets the userDefinedFileTypes_textField preference.- Parameters:
udefSuffix- the user defined suffix
-
setUserDefinedFileTypesPref
This method sets the userDefinedFileTypes preference.- Parameters:
udefSuffix- the user defined suffix
-
writeImage
Determines file type from the file name and calls different write functions based on the file type. Stores file in the specified file name and directory given by the options. Calls appropriate dialogs if necessary. Supports files of type raw, analyze, and DICOM.- Parameters:
image- Image to write.options- Needed info to write this image.
-
writeImage
public void writeImage(ModelImage image, FileWriteOptions options, boolean bDisplayProgress, boolean allowScriptRecording) Determines file type from the file name and calls different write functions based on the file type. Stores file in the specified file name and directory given by the options. Calls appropriate dialogs if necessary. Supports files of type raw, analyze, and DICOM.- Parameters:
image- Image to write.options- Needed info to write this image.bDisplayProgress- when true display the progress bar for writing.
-
getByteImageData
-
dataConversion
Provides a method of conversion fromFileInfoDicomtoFileInfoImageXML, by filling theFileInfoImageXMLwith sets of chosen image information (from the DICOM tags).The XML format suggests that each DICOM tag become a seperate set, and any multiple values stored in the DICOM tag, becomes parameter data. The set name is the DICOM tag name. Each value of the tag is stored as a separate parameter in the set, and its description is stored as the DICOM key (group and element number, as displayed in the file, "dicom.dictionary") along with its position in the value multiplicity. All values stored are stored as value-type "string", and neither date nor time are set. Order of entries is not guaranteed, as order is not meaningful in XML.
Be sure to see the image.xsd file for more information.
- Parameters:
sourceInfo- The FileInfoDicom which is the source for user-selectable tagsdestInfo- The FileInfoBase that holds the image information to be stored in XML (or MincHDF)format.- See Also:
-
getDicomSaveList
protected Hashtable<FileDicomKey,FileDicomTag> getDicomSaveList(FileInfoDicom sourceInfo, boolean isXML) Returns a list of tags that are a subset of the DICOM dictionary. This method chooses the tags to be saved by presenting a dialog for the user to select a list of tags or by reading thedicomsave.dictionary
file.- Parameters:
sourceInfo- Source of DICOM information.- Returns:
- The Hashtable filled as an XML
-
LSMDataConversion
Provides a method of conversion fromFileInfoLSMtoFileInfoImageXML, by filling theFileInfoImageXMLwith sets of chosen image information.- Parameters:
sourceInfo- the LSM-formatted Source informationdestInfo- the XML-format file information that is the output.
-
copyResolutions
private static void copyResolutions(ModelImage modelImageSrc, ModelImage modelImageResult, int sliceNum) DOCUMENT ME!- Parameters:
modelImageSrc- DOCUMENT ME!modelImageResult- DOCUMENT ME!sliceNum- DOCUMENT ME!
-
resample255
private static float[] resample255(float[] buffer, float min, float max) The purpose of this method is to take a buffer of float and resample the values to proper UBYTE values.- Parameters:
buffer- float[] - the buffer to be sampledmin- - the image's minimum pixel valuemax- - the image's maximum pixel value- Returns:
- float[] - the resampled buffer with min and max values in the range 0 - 255
-
sort
private static boolean sort(float[] A, int[] B, int size) Sorts an array of floats (using Arrays.sort), turns into array of ints used to sort images by A; thus, the final value of B[i] is for the ith image read in, put that image at location B[i] in the image buffer. This is necessary for images labeled dicom1, dicom2, etc because dicom11, dicom12, ... will come before dicom2. Also our only indication of the "true" ordering is slice location.- Parameters:
A- Array to be sorted.B- Array it goes into.size- Size of the array (both arrays are the same size).- Returns:
falseonly if any of the numbers in the array are equal.
-
sort
private static boolean sort(int[] A, int[] B, int size) Sorts an array of ints (using insertion sort), turns into array of ints used to sort images by image number; thus, the final value of B[i] is for the ith image read in, put that image at location B[i] in the image buffer. This is necessary for images labeled dicom1, dicom2, etc because dicom11, dicom12, ... will come before dicom2. Also our only indication of the "true" ordering is image number.- Parameters:
A- Array to be sorted.B- Array it goes into.size- Size of the array (both arrays are the same size).- Returns:
falseonly if any of the numbers in the array are equal.
-
absBiggest
private int absBiggest(double zero, double one, double two) Helper method for finding biggest (absolute value) of three numbers.- Parameters:
zero- First valueone- Second valuetwo- Third value- Returns:
- Index of argument that is the biggest. That is, if
zerois the largest of the three numbers, the value 0 is returned; alternatively, if the second argument is the largest of the three numbers, the value 1 is returned; and so on.
-
callDialog
Calls GUI dialogs based on what type of image this is and the number of dimensions.- Parameters:
extents- Extents of the image, used to determine what type of dialog to call and initialize variables.options- Options to get from the dialog and save.isTiff- Flag indicating if this is a TIFF file; TIFF files require more options.- Returns:
- DOCUMENT ME!
-
createProgressBar
Creates the progress bar and links (if not null) the progress bar to a FileBase for reading/writing if the progress bar should not be updated within the FileBase's readImage/writeImage, pass in null to the fBase and update within FileIO's read[ImageType] or write[ImageType] methods.- Parameters:
fBase- the FileBase that will add the Progress Bar as a listener (for fireProgressStateChanged())fName- the filename (will be displayed in the title and part of the message)message- this message should FILE_READ, FILE_OPEN
-
readAfni
Reads an AFNI file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.loadB- true if loading imageB- Returns:
- The image that was read in, or null if failure.
-
readAnalyze
Reads an analyze file by calling the read method of the file. Also checks if it's a Cheshire and if so, calls that method instead. This method contains special code to not display the progress bar should the image besplash.img
.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readSiemensText
Reads an siemenstext file by calling the read method of the file. Also checks if it's a Cheshire and if so, calls that method instead. This method contains special code to not display the progress bar should the image besplash.img
.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readAnalyzeMulti
Reads a multi Analyze file. Gets a list of the images from the file directory and reads them each in.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readAvi
Reads an AVI file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.readQT- Indicates that a QuickTime movie file is being read.trueif this file represents QuickTime.- Returns:
- The image that was read in, or null if failure.
-
readBioRad
Reads a BioRad PIC file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readBRUKER
Reads a BRUKER file by first reading in the d3proc header file, second the reco header file, third the acqp file, and finally the 2dseq binary file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readCheshire
Reads a Cheshire file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readCOR
Reads a COR file by first reading the header file then reading in each separate slice file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readDM3
Reads a Dm3 file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readFits
Reads a FITS file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readGEGenesis5XMulti
Reads in multiple GE Genesis 5x type files.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readGESigna4XMulti
Reads in multiple GE Signa 4x type files.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readICS
Reads an ICS file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readJPEG_LS
Reads an JPEG_LS file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readJPEG_XL
Reads an JPEG_XL file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readInterfile
Reads an Interfile file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readInterfileMulti
Reads a multi Interfile file. Gets a list of the images from the file directory and reads them each in.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readJimi
Reads a JIMI file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.multifile- Indication whether this file is be read alone, or if the reader is to read all matching filenames as a part of the dataset.trueif want to read all matching files to form an image into a 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readLSM
Reads a LSM file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.secondAddress- DOCUMENT ME!one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readLSMMulti
Reads a multi LSM file by first reading the headers then reading in each separate file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readMagnetomVisionMulti
Reads multiple Magnetom Vision files by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readMap
Reads a Map file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readMedVision
Reads a MedVision file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readMGH
Reads a MGH file by calling the read method of the file. if so, calls that method instead.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readMicroCat
Reads an Micro Cat file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readMinc
Reads a MINC file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readMincMulti
Reads a multi Minc file. Gets a list of the images from the file directory and reads them each in.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readMincHDF
-
readMRC
Reads a MRC file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readBFLOAT
Reads a BFLOAT file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- If true, read in only one middle slice- Returns:
- The image that was read in, or null if failure.
-
readNIFTI
public ModelImage readNIFTI(String fileName, String fileDir, boolean one, boolean niftiCompressed, boolean noImportData, boolean noReadPrivateTags) Reads a NIFTI file by calling the read method of the file. if so, calls that method instead.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.niftiCompressed-noImportData-- Returns:
- The image that was read in, or null if failure.
-
readMetaImage
Reads a MetaImage file by calling the read method of the file. if so, calls that method instead.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readNIFTIMulti
Reads a multi NIFTI file. Gets a list of the images from the file directory and reads them each in.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readNRRD
Reads a NRRD file by calling the read method of the file. if so, calls that method instead.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readNRRDMulti
Reads a multi NRRD file. Gets a list of the images from the file directory and reads them each in.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readGEGenesis5X
Reads in a single GE Genesis type file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readGESigna4X
Reads in a single GE Signa 4x type file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readMagnetomVision
Reads a Magnetom Vision file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readVista
-
readPARREC
Reads a PARREC file by calling the read method of the file. This method contains special code to not display the progress bar should the image besplash.img
.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readPARRECMulti
Reads a multi PARREC file. Gets a list of the images from the file directory and reads them each in.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readPGM
Reads a PGM file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readPPM
Reads a PPM file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readQT
Reads a QT file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readRaw
Reads a RAW file by calling the read method of the file. Gets the necessary information from a dialog, if thefileInfoparameter is null, and otherwise relies on the information stored infileInfoto properly read in the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.fileInfo- File info of the image file; usually null, but if defined no dialog appears.- Returns:
- The image that was read in, or null if failure.
-
readRawMulti
Reads a RAW file by calling the read method of the file. Gets the necessary information from a dialog, if thefileInfoparameter is null, and otherwise relies on the information stored infileInfoto properly read in the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.fileInfo- File info of the image file; usually null, but if defined no dialog appears.- Returns:
- The image that was read in, or null if failure.
-
readSpar
Reads a Spar file by calling the read method of the file.- Parameters:
fileInfo-fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readSPM
Reads an SPM file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readSTK
Reads a STK file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readTrackVis
Reads in a single TrackVis file.- Returns:
- The image that was read in, or null if failure.
-
readCZI
Reads a Zeiss ZISRAW (CZI) file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readLIFF
Reads a Improvision OpenLab LIFF file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readBMP
Reads a BMP file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readBMPMulti
-
createMultifile
private ModelImage createMultifile(FileInfoBase myFileInfo, ModelImage origImage, String fileDir, String fileName, boolean quiet) -
convertToMultifile
private ModelImage convertToMultifile(ModelImage existingMultifileImage, ModelImage origImage, int[] extents, int pos) -
readMATLAB
Reads a NATLAB file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readZVI
Reads a Zeiss ZVI file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
setTIFFOrientation
public void setTIFFOrientation(boolean doTIFFOrientation) -
readTiff
Reads a TIFF file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readTiffMulti
Reads a multi TIFF file by first reading the headers then reading in each separate file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readSVS
Reads a SVS file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readTMG
Reads a TMG file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
readXML
Reads an XML file by calling the read method of the file. This method contains special code to not display the progress bar should it loadsplash.xml
.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
readXMLMulti
Reads a multi XML file. Gets a list of the images from the file directory and reads them each in.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.- Returns:
- The image that was read in, or null if failure.
-
writeAfni
Writes an AFNI file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeAnalyze
Writes an analyze file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.zerofunused- If true, zero funused fields- Returns:
- Flag indicating that this was a successful write.
-
writeAvi
Writes an AVI file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeCOR
Writes a Freesurfer COR file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeDicomSlice
private boolean writeDicomSlice(ModelImage image, int sliceNumber, FileWriteOptions options, FileInfoDicom fileDicom, FileInfoBase originalFileInfo, int originalImageDataType, TransMatrix originalImageMatrix, double originalImageMin, double originalImageMax, boolean originalIsDicom, boolean originalIsColor) Writes a DICOM file on a slice basis. This method is specifically used in very large 3d datasets where memory becomes an issue DICOM images are each written to a separate file with a different header.- Parameters:
image- The 2D image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeDicom
Writes a DICOM file to store the image. Calls a dialog if the source isn't a DICOM image. DICOM images are each written to a separate file with a different header.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
reduceStringLengthTo16
-
removeEnhancedDicomInfo
-
insertEnhancedSequence
private void insertEnhancedSequence(FileInfoDicom myFileInfo, FileInfoDicom[][] infoAr, int dataType) -
writeFits
Writes a Fits file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeJPEG_LS
Writes a JPEG_LS file to store the image.- Parameters:
image- The image to write.- Returns:
- Flag indicating that this was a successful write.
-
writeGESigna4X
Writes a GESigna4X file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeGEGenesis5X
Writes a GESigna5X file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeICS
Writes an ICS file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeInterfile
Writes an Interfile file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeJimi
Writes a JIMI file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
getRenderedImage
-
writeMGH
Writes a MGH or MGZ file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeMinc
Writes a Minc file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeMincHDF
Writes out a MINC 2.0 HDF5 formatted file- Parameters:
image-options-- Returns:
-
writeMRC
Writes a MRC file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeMATLAB
Writes a MATLAB file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeNIFTI
Writes a NIFTI file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeMetaImage
Writes a MetaImage file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeRaw
Writes a raw file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeSPM
Writes a SPM file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeTiff
Writes a TIFF file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeSTK
Writes a STK file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeXML
Writes the image in our MIPAV XML format.- Parameters:
image- The image to be saved to the file.options- Write options that control aspects of writing the image.- Returns:
- True if the file was successfully saved to a file.
-
writeVista
writes Vista format files- Parameters:
image-options-- Returns:
-
writePARREC
Writes a PAR/REC file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
writeNRRD
Writes a NRRD file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
readJpeg2000
Reads a JPEG2000 file by calling the read method of the file.- Parameters:
fileName- Name of the image file to read.fileDir- Directory of the image file to read.one- Indicates that only the named file should be read, as opposed to reading the matching files in the directory, as defined by the filetype.trueif only want to read one image from 3D dataset.- Returns:
- The image that was read in, or null if failure.
-
writeJpeg2000
Writes a JPEG2000 file to store the image.- Parameters:
image- The image to write.options- The options to use to write the image.- Returns:
- Flag indicating that this was a successful write.
-
setDisplayRangeOfSlicesDialog
public void setDisplayRangeOfSlicesDialog(boolean displayRangeOfSlicesDialog) -
setSuppressUnknownFileTypeDialog
public void setSuppressUnknownFileTypeDialog(boolean val) If set to true, then unknown file type dialog is not shown and an error is returned instead.- Parameters:
val-
-
getDoubleValOrAsciiVal
-
convertNumbersToStr
-