Class FileIO


  • public class FileIO
    extends java.lang.Object
    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:
    FileAnalyze, FileDicom, FileMedVision, FileRaw, FileTiff
    • Constructor Summary

      Constructors 
      Constructor Description
      FileIO()
      Creates the FileIO and displays Choose File Type unknown file dialog.
      FileIO​(ModelLUT _LUT)
      Creates the FileIO and displays Choose File Type unknown file dialog.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private int absBiggest​(double zero, double one, double two)
      Helper method for finding biggest (absolute value) of three numbers.
      private boolean callDialog​(int[] extents, int dataType, FileWriteOptions options)
      Calls GUI dialogs based on what type of image this is and the number of dimensions.
      static int chkMultiFile​(int fileType, boolean multiFile)
      Sets specific types to be multifile based on the input argument.
      private java.lang.String convertNumbersToStr​(java.lang.String dicomNumberString)  
      static ModelImage convertToARGB​(ModelImage modelImage)
      DOCUMENT ME!
      private ModelImage convertToMultifile​(ModelImage existingMultifileImage, ModelImage origImage, int[] extents, int pos)  
      static ModelImage convertToUBYTE​(ModelImage modelImageResult)
      DOCUMENT ME!
      private static void copyResolutions​(ModelImage modelImageSrc, ModelImage modelImageResult, int sliceNum)
      DOCUMENT ME!
      private ModelImage createMultifile​(FileInfoBase myFileInfo, ModelImage origImage, java.lang.String fileDir, java.lang.String fileName, boolean quiet)  
      private void createProgressBar​(FileBase fBase, java.lang.String fName, java.lang.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 boolean dataConversion​(FileInfoBase sourceInfo, FileInfoBase destInfo)
      Provides a method of conversion from FileInfoDicom to FileInfoImageXML, by filling the FileInfoImageXML with sets of chosen image information (from the DICOM tags).
      void dispose()  
      private static java.lang.String generateGEID​(FileDicomTagTable tagTable)  
      byte[] getByteImageData​(ModelImage image, int start, int length)  
      protected java.util.Hashtable<FileDicomKey,​FileDicomTag> getDicomSaveList​(FileInfoDicom sourceInfo, boolean isXML)
      Returns a list of tags that are a subset of the DICOM dictionary.
      private double getDoubleValOrAsciiVal​(java.lang.String value)  
      int getFileType()
      Presents a dialog for a user-entered definition of the image type.
      private java.lang.String getModality​(FileDicom imageFile)
      Gets the value of the Dicom modality tag, 0008,0060.
      ModelLUT getModelLUT()
      Returns LUT associated with the image file.
      ModelRGB getModelRGB()
      Gets the model RGB.
      private java.awt.image.BufferedImage getRenderedImage​(java.awt.Image in)  
      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.
      private void insertEnhancedSequence​(FileInfoDicom myFileInfo, FileInfoDicom[][] infoAr, int dataType)  
      private boolean isDiffusionSeries​(FileInfoDicom dicomInfo)  
      boolean isQuiet()
      Refers to whether or not the FileIO will send alerts to the user about progress or errors.
      protected void LSMDataConversion​(FileInfoLSM sourceInfo, FileInfoImageXML destInfo)
      Provides a method of conversion from FileInfoLSM to FileInfoImageXML, by filling the FileInfoImageXML with sets of chosen image information.
      private ModelImage readAfni​(java.lang.String fileName, java.lang.String fileDir, boolean loadB)
      Reads an AFNI file by calling the read method of the file.
      private ModelImage readAnalyze​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads an analyze file by calling the read method of the file.
      private ModelImage readAnalyzeMulti​(java.lang.String fileName, java.lang.String fileDir)
      Reads a multi Analyze file.
      private ModelImage readAvi​(java.lang.String fileName, java.lang.String fileDir, boolean one, boolean readQT)
      Reads an AVI file by calling the read method of the file.
      private ModelImage readBFLOAT​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads a BFLOAT file by calling the read method of the file.
      private ModelImage readBioRad​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads a BioRad PIC file by calling the read method of the file.
      private ModelImage readBMP​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads a BMP file by calling the read method of the file.
      private ModelImage readBMPMulti​(java.lang.String fileName, java.lang.String fileDir, boolean one)  
      private ModelImage readBRUKER​(java.lang.String fileName, java.lang.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 ModelImage readCheshire​(java.lang.String fileName, java.lang.String fileDir)
      Reads a Cheshire file by calling the read method of the file.
      private ModelImage readCOR​(java.lang.String fileName, java.lang.String fileDir)
      Reads a COR file by first reading the header file then reading in each separate slice file.
      private ModelImage readCZI​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads a Zeiss ZISRAW (CZI) file by calling the read method of the file.
      ModelImage readDicom​(java.lang.String selectedFileName, java.lang.String[] fileList, boolean performSort)
      Reads a list of DICOM files.
      private ModelImage readDM3​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads a Dm3 file by calling the read method of the file.
      private int readFileType​(boolean niftiCompressed, boolean multiFile, java.lang.String fileName, java.lang.String fDir)  
      private ModelImage readFits​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads a FITS file by calling the read method of the file.
      ModelImage readGEGenesis5X​(java.lang.String fileName, java.lang.String fileDir)
      Reads in a single GE Genesis type file.
      ModelImage readGEGenesis5XMulti​(java.lang.String fileName, java.lang.String fileDir)
      Reads in multiple GE Genesis 5x type files.
      ModelImage readGESigna4X​(java.lang.String fileName, java.lang.String fileDir)
      Reads in a single GE Signa 4x type file.
      private ModelImage readGESigna4XMulti​(java.lang.String fileName, java.lang.String fileDir)
      Reads in multiple GE Signa 4x type files.
      FileInfoBase readHeader​(java.lang.String absoluteFilename)
      Reads generic file from an absolute filename.
      FileInfoBase readHeader​(java.lang.String absoluteFilename, boolean multiFile)
      Reads generic file from an absolute filename.
      FileInfoBase readHeader​(java.lang.String fileName, java.lang.String fileDir)
      Reads file, determines file type, and calls a read function specific to the file.
      FileInfoBase readHeader​(java.lang.String fileName, java.lang.String fileDir, boolean multiFile)
      Reads file, determines file type, and calls a read function specific to the file.
      private ModelImage readICS​(java.lang.String fileName, java.lang.String fileDir)
      Reads an ICS file by calling the read method of the file.
      ModelImage readImage​(java.lang.String absoluteFilename)
      Reads generic file from an absolute filename.
      ModelImage readImage​(java.lang.String fileName, java.lang.String fileDir)
      Reads file, determines file type, and calls a read function specific to the file.
      ModelImage readImage​(java.lang.String fileName, java.lang.String fileDir, boolean multiFile, FileInfoBase fileInfo)
      Reads file, determines file type, and calls a read function specific to the file.
      ModelImage readImage​(java.lang.String fileName, java.lang.String fileDir, boolean multiFile, FileInfoBase fileInfo, boolean loadB)
      Reads file, determines file type, and calls a read function specific to the file.
      ModelImage readImage​(java.lang.String fileName, java.lang.String fileDir, boolean multiFile, FileInfoBase fileInfo, int secondAddress)
      Reads file, determines file type, and calls a read function specific to the file.
      ModelImage readImage​(java.lang.String fileName, java.lang.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 ModelImage readInterfile​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads an Interfile file by calling the read method of the file.
      private ModelImage readInterfileMulti​(java.lang.String fileName, java.lang.String fileDir)
      Reads a multi Interfile file.
      ModelImage readJimi​(java.lang.String fileName, java.lang.String fileDir, boolean multifile)
      Reads a JIMI file by calling the read method of the file.
      private ModelImage readJpeg2000​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads a JPEG2000 file by calling the read method of the file.
      private ModelImage readLIFF​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads a Improvision OpenLab LIFF file by calling the read method of the file.
      private ModelImage readLSM​(java.lang.String fileName, java.lang.String fileDir, int secondAddress, boolean one)
      Reads a LSM file by calling the read method of the file.
      private ModelImage readLSMMulti​(java.lang.String fileName, java.lang.String fileDir)
      Reads a multi LSM file by first reading the headers then reading in each separate file.
      private ModelImage readMagnetomVision​(java.lang.String fileName, java.lang.String fileDir)
      Reads a Magnetom Vision file by calling the read method of the file.
      private ModelImage readMagnetomVisionMulti​(java.lang.String fileName, java.lang.String fileDir)
      Reads multiple Magnetom Vision files by calling the read method of the file.
      private ModelImage readMap​(java.lang.String fileName, java.lang.String fileDir)
      Reads a Map file by calling the read method of the file.
      private ModelImage readMATLAB​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads a NATLAB file by calling the read method of the file.
      private ModelImage readMedVision​(java.lang.String fileName, java.lang.String fileDir)
      Reads a MedVision file by calling the read method of the file.
      private ModelImage readMetaImage​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads a MetaImage file by calling the read method of the file. if so, calls that method instead.
      private ModelImage readMGH​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads a MGH file by calling the read method of the file. if so, calls that method instead.
      private ModelImage readMicroCat​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads an Micro Cat file by calling the read method of the file.
      private ModelImage readMinc​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads a MINC file by calling the read method of the file.
      private ModelImage readMincHDF​(java.lang.String fileName, java.lang.String fileDir, boolean one)  
      private ModelImage readMincMulti​(java.lang.String fileName, java.lang.String fileDir)
      Reads a multi Minc file.
      private ModelImage readMRC​(java.lang.String fileName, java.lang.String fileDir)
      Reads a MRC file by calling the read method of the file.
      ModelImage readNIFTI​(java.lang.String fileName, java.lang.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 ModelImage readNIFTIMulti​(java.lang.String fileName, java.lang.String fileDir)
      Reads a multi NIFTI file.
      private ModelImage readNRRD​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads a NRRD file by calling the read method of the file. if so, calls that method instead.
      private ModelImage readNRRDMulti​(java.lang.String fileName, java.lang.String fileDir)
      Reads a multi NRRD file.
      ModelImage readOneImage​(java.lang.String fileName, java.lang.String fileDir)
      Reads file, determines file type, and calls a read function specific to the file.
      ModelImage readOrderedARGB​(java.io.File[] fileList, int numChannels, int[] channelMap, boolean showOrderedProgressBar, java.awt.Dimension subsampleDimension, boolean forceUBYTE)
      This method examines parameter fileList and loads TIFF files according to the order in the list.
      ModelImage readOrderedGrayscale​(java.io.File[] fileList, boolean showLocalProgressBar, java.awt.Dimension subsampleDimension, boolean forceUBYTE)
      This method will load a group of files in the order of fileList.
      ModelImage readOrderedGrayscale​(java.io.File[] fileList, boolean showLocalProgressBar, java.awt.Dimension subsampleDimension, boolean forceUBYTE, int numSlices, int numTimePoints)
      This method will load a group of files in the order of fileList.
      ModelImage readOrderedGrayscale2​(java.io.File[] fileList, boolean showLocalProgressBar, java.awt.Dimension subsampleDimension, boolean forceUBYTE, int numSlices, int numTimePoints)  
      private ModelImage readPARREC​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads a PARREC file by calling the read method of the file.
      private ModelImage readPARRECMulti​(java.lang.String fileName, java.lang.String fileDir)
      Reads a multi PARREC file.
      private ModelImage readPGM​(java.lang.String fileName, java.lang.String fileDir)
      Reads a PGM file by calling the read method of the file.
      private ModelImage readPPM​(java.lang.String fileName, java.lang.String fileDir)
      Reads a PPM file by calling the read method of the file.
      private ModelImage readQT​(java.lang.String fileName, java.lang.String fileDir)
      Reads a QT file by calling the read method of the file.
      private ModelImage readRaw​(java.lang.String fileName, java.lang.String fileDir, FileInfoBase fileInfo)
      Reads a RAW file by calling the read method of the file.
      private ModelImage readRawMulti​(java.lang.String fileName, java.lang.String fileDir, FileInfoBase fileInfo)
      Reads a RAW file by calling the read method of the file.
      private ModelImage readSiemensText​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads an siemenstext file by calling the read method of the file.
      private ModelImage readSpar​(FileInfoBase fileInfo, java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads a Spar file by calling the read method of the file.
      private ModelImage readSPM​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads an SPM file by calling the read method of the file.
      private ModelImage readSTK​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads a STK file by calling the read method of the file.
      private ModelImage readSVS​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads a SVS file by calling the read method of the file.
      ModelImage readTiff​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads a TIFF file by calling the read method of the file.
      private ModelImage readTiffMulti​(java.lang.String fileName, java.lang.String fileDir)
      Reads a multi TIFF file by first reading the headers then reading in each separate file.
      private ModelImage readTMG​(java.lang.String fileName, java.lang.String fileDir)
      Reads a TMG file by calling the read method of the file.
      private ModelImage readTrackVis​(java.lang.String fileName, java.lang.String fileDir)
      Reads in a single TrackVis file.
      private ModelImage readVista​(java.lang.String fileName, java.lang.String fileDir, boolean one)  
      ModelImage readXML​(java.lang.String fileName, java.lang.String fileDir, boolean one, boolean bDisplayProgress)
      Reads an XML file by calling the read method of the file.
      private ModelImage readXMLMulti​(java.lang.String fileName, java.lang.String fileDir)
      Reads a multi XML file.
      FileImageXML readXMLThumbnail​(java.lang.String name, java.lang.String directory)
      Reads a thumbnail image from an XML file. if thumbnail is empty, will returned FileImageXML will be null.
      private ModelImage readZVI​(java.lang.String fileName, java.lang.String fileDir, boolean one)
      Reads a Zeiss ZVI file by calling the read method of the file.
      (package private) java.lang.String reduceStringLengthTo16​(java.lang.String str)  
      private void removeEnhancedDicomInfo​(FileInfoDicom myFileInfo, FileInfoBase[] fileInfoBases)  
      private java.lang.String[] removeFromImageList​(java.lang.String selectedFileName, java.lang.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.
      void setDisplayRangeOfSlicesDialog​(boolean displayRangeOfSlicesDialog)  
      void setFileDir​(java.lang.String dir)
      Sets the directory where the file will be saved or opened.
      void setImageA​(ModelImage imageA)  
      void setModelLUT​(ModelLUT lut)
      Sets the LUT.
      void setModelRGB​(ModelRGB rgb)
      Sets the RGB.
      void setPBar​(ProgressBarInterface pBar)
      Sets the progress bar (either panel or frame) to be used in image opening to update status.
      void setQuiet​(boolean q)
      Refers to whether or not the FileIO will send alerts to the user about progress or errors.
      void setRawImageInfo​(RawImageInfo rawInfo)
      DOCUMENT ME!
      void setSuppressProgressBar​(boolean suppressProgressBar)  
      void setSuppressUnknownFileTypeDialog​(boolean val)
      If set to true, then unknown file type dialog is not shown and an error is returned instead.
      void setTIFFOrientation​(boolean doTIFFOrientation)  
      void setUserDefinedFileTypes_textFieldPref​(java.lang.String udefSuffix)
      This method sets the userDefinedFileTypes_textField preference.
      void setUserDefinedFileTypesPref​(java.lang.String udefSuffix)
      This method sets the userDefinedFileTypes preference.
      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.
      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.
      private int sortDtiDicomData​(java.lang.String studyDescription, java.lang.String seriesDescription, java.lang.String scannerType, FileDicomTagTable tagTable, FileInfoDicom[] savedFileInfos, int[] indices, int instanceNumsLength, int[] zInst)  
      static ModelImage subsample​(ModelImage modelImage, java.awt.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 uids
      private boolean writeAfni​(ModelImage image, FileWriteOptions options)
      Writes an AFNI file to store the image.
      private boolean writeAnalyze​(ModelImage image, FileWriteOptions options, boolean zerofunused)
      Writes an analyze file to store the image.
      private boolean writeAvi​(ModelImage image, FileWriteOptions options)
      Writes an AVI file to store the image.
      private boolean writeCOR​(ModelImage image, FileWriteOptions options)
      Writes a Freesurfer COR file to store the image.
      private boolean writeDicom​(ModelImage image, FileWriteOptions options)
      Writes a DICOM file to store the image.
      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.
      private boolean writeFits​(ModelImage image, FileWriteOptions options)
      Writes a Fits file to store the image.
      private boolean writeGEGenesis5X​(ModelImage image, FileWriteOptions options)
      Writes a GESigna5X file to store the image.
      private boolean writeGESigna4X​(ModelImage image, FileWriteOptions options)
      Writes a GESigna4X file to store the image.
      private boolean writeICS​(ModelImage image, FileWriteOptions options)
      Writes an ICS file to store the image.
      void writeImage​(ModelImage image, FileWriteOptions options)
      Determines file type from the file name and calls different write functions based on the file type.
      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.
      private boolean writeInterfile​(ModelImage image, FileWriteOptions options)
      Writes an Interfile file to store the image.
      private boolean writeJimi​(ModelImage image, FileWriteOptions options)
      Writes a JIMI file to store the image.
      private boolean writeJpeg2000​(ModelImage image, FileWriteOptions options)
      Writes a JPEG2000 file to store the image.
      private boolean writeMATLAB​(ModelImage image, FileWriteOptions options)
      Writes a MATLAB file to store the image.
      private boolean writeMetaImage​(ModelImage image, FileWriteOptions options)
      Writes a MetaImage file to store the image.
      private boolean writeMGH​(ModelImage image, FileWriteOptions options)
      Writes a MGH or MGZ file to store the image.
      private boolean writeMinc​(ModelImage image, FileWriteOptions options)
      Writes a Minc file to store the image.
      private boolean writeMincHDF​(ModelImage image, FileWriteOptions options)
      Writes out a MINC 2.0 HDF5 formatted file
      private boolean writeMRC​(ModelImage image, FileWriteOptions options)
      Writes a MRC file to store the image.
      private boolean writeNIFTI​(ModelImage image, FileWriteOptions options)
      Writes a NIFTI file to store the image.
      private boolean writeNRRD​(ModelImage image, FileWriteOptions options)
      Writes a NRRD file to store the image.
      private boolean writePARREC​(ModelImage image, FileWriteOptions options)
      Writes a PAR/REC file to store the image.
      private boolean writeRaw​(ModelImage image, FileWriteOptions options)
      Writes a raw file to store the image.
      private boolean writeSPM​(ModelImage image, FileWriteOptions options)
      Writes a SPM file to store the image.
      private boolean writeSTK​(ModelImage image, FileWriteOptions options)
      Writes a STK file to store the image.
      private boolean writeTiff​(ModelImage image, FileWriteOptions options)
      Writes a TIFF file to store the image.
      private boolean writeVista​(ModelImage image, FileWriteOptions options)
      writes Vista format files
      private boolean writeXML​(ModelImage image, FileWriteOptions options, boolean bDisplayProgress)
      Writes the image in our MIPAV XML format.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • FILE_WRITE

        public static final java.lang.String FILE_WRITE
        DOCUMENT ME!
        See Also:
        Constant Field Values
      • fileDir

        private java.lang.String fileDir
        Directory where the image file can be found.
      • LUT

        private ModelLUT LUT
        If a LUT is to be saved with the image it is stored here.
      • modelRGB

        private ModelRGB modelRGB
        DOCUMENT ME!
      • quiet

        private boolean quiet
        Refers to whether or not the FileIO reports progress or errors.
      • secondImage

        private int secondImage
        Address of second image in file.
      • unknownIODialog

        private JDialogUnknownIO 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

        private java.lang.String[] dataFileName
        For multi file formats where data is saved in a set of files
      • isDTISort

        private boolean isDTISort
      • doTIFFOrientation

        private boolean doTIFFOrientation
      • suppressProgressBar

        private boolean suppressProgressBar
      • suppressUnknownFileTypeDialog

        private boolean suppressUnknownFileTypeDialog
    • Constructor Detail

      • FileIO

        public FileIO()
        Creates the FileIO and displays Choose 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

        public FileIO​(ModelLUT _LUT)
        Creates the FileIO and displays Choose 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 Detail

      • 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 - If true, returns a new filetype corresponding to the input filetype + MULTIFILE. If false, returns the given filetype.
        Returns:
        The new or old fileType.
      • setImageA

        public void setImageA​(ModelImage imageA)
      • setSuppressProgressBar

        public void setSuppressProgressBar​(boolean suppressProgressBar)
        Parameters:
        suppressProgressBar -
      • convertToARGB

        public static final ModelImage convertToARGB​(ModelImage modelImage)
        DOCUMENT ME!
        Parameters:
        modelImage - ModelImage - the image to resample to UBYTE
        Returns:
        ModelImage
      • convertToUBYTE

        public static final ModelImage convertToUBYTE​(ModelImage modelImageResult)
        DOCUMENT ME!
        Parameters:
        modelImageResult - ModelImage - the image to resample to UBYTE
        Returns:
        ModelImage
      • subsample

        public static final ModelImage subsample​(ModelImage modelImage,
                                                 java.awt.Dimension subsampleDimension)
        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 algorithm
        subsampleDimension - 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:
        JDialogUnknownIO
      • getModelLUT

        public ModelLUT getModelLUT()
        Returns LUT associated with the image file.
        Returns:
        The LUT associated with the image although it may be null.
      • getModelRGB

        public ModelRGB 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

        public ModelImage readDicom​(java.lang.String selectedFileName,
                                    java.lang.String[] fileList,
                                    boolean performSort)
        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 readin this#fileDir to read. Used to ID study and series number
        fileList - List of all the files to be read in.
        performSort - true if this method is to sort the files in the list, or, false will 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

        private boolean isDiffusionSeries​(FileInfoDicom dicomInfo)
      • sortDtiDicomData

        private int sortDtiDicomData​(java.lang.String studyDescription,
                                     java.lang.String seriesDescription,
                                     java.lang.String scannerType,
                                     FileDicomTagTable tagTable,
                                     FileInfoDicom[] savedFileInfos,
                                     int[] indices,
                                     int instanceNumsLength,
                                     int[] zInst)
      • generateGEID

        private static java.lang.String generateGEID​(FileDicomTagTable tagTable)
      • tryPartitionByMediaUID

        private int[] tryPartitionByMediaUID​(FileInfoDicom[] savedFileInfos)
        partition into image subsets using media instance uids
      • removeFromImageList

        private java.lang.String[] removeFromImageList​(java.lang.String selectedFileName,
                                                       java.lang.String[] fileList)
      • getModality

        private java.lang.String getModality​(FileDicom imageFile)
        Gets the value of the Dicom modality tag, 0008,0060. SR tags indicate a structured report file.
        Parameters:
        imageFile -
        Returns:
      • readHeader

        public FileInfoBase readHeader​(java.lang.String absoluteFilename)
        Reads generic file from an absolute filename.
        Parameters:
        absoluteFilename - String - the absolute filename, including the path
        Returns:
        ModelImage
      • readHeader

        public FileInfoBase readHeader​(java.lang.String absoluteFilename,
                                       boolean multiFile)
        Reads generic file from an absolute filename.
        Parameters:
        absoluteFilename - String - the absolute filename, including the path
        multiFile - Flag indicating multi file.
        Returns:
        ModelImage
      • readHeader

        public FileInfoBase readHeader​(java.lang.String fileName,
                                       java.lang.String fileDir)
        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

        public FileInfoBase readHeader​(java.lang.String fileName,
                                       java.lang.String fileDir,
                                       boolean multiFile)
        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

        public ModelImage readImage​(java.lang.String absoluteFilename)
        Reads generic file from an absolute filename.
        Parameters:
        absoluteFilename - String - the absolute filename, including the path
        Returns:
        ModelImage
      • readImage

        public ModelImage readImage​(java.lang.String fileName,
                                    java.lang.String fileDir)
        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​(java.lang.String fileName,
                                    java.lang.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​(java.lang.String fileName,
                                    java.lang.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​(java.lang.String fileName,
                                    java.lang.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​(java.lang.String fileName,
                                    java.lang.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. true is 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 header
        loadB - Flag indicating if this is an image B.
        one - A load-single flag. true indicates that the method is to load only the file that is defined by the fileName, rather than a multiple file load of a 3d Image.
        Returns:
        The image that was read in from the file.
      • readFileType

        private int readFileType​(boolean niftiCompressed,
                                 boolean multiFile,
                                 java.lang.String fileName,
                                 java.lang.String fDir)
      • readOneImage

        public ModelImage readOneImage​(java.lang.String fileName,
                                       java.lang.String fileDir)
        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​(java.io.File[] fileList,
                                          int numChannels,
                                          int[] channelMap,
                                          boolean showOrderedProgressBar,
                                          java.awt.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, preordered
        numChannels - int - the number of channels the result image is to have
        channelMap - 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 null
        forceUBYTE - boolean - force the image to be constructed with an unsigned byte data type
        Returns:
        ModelImage
      • readOrderedGrayscale

        public ModelImage readOrderedGrayscale​(java.io.File[] fileList,
                                               boolean showLocalProgressBar,
                                               java.awt.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, preordered
        showLocalProgressBar - 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 null
        forceUBYTE - boolean - force the image to be constructed with an unsigned byte data type
        Returns:
        ModelImage
      • readOrderedGrayscale

        public ModelImage readOrderedGrayscale​(java.io.File[] fileList,
                                               boolean showLocalProgressBar,
                                               java.awt.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, preordered
        showLocalProgressBar - 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 null
        forceUBYTE - boolean - force the image to be constructed with an unsigned byte data type
        Returns:
        ModelImage
      • readOrderedGrayscale2

        public ModelImage readOrderedGrayscale2​(java.io.File[] fileList,
                                                boolean showLocalProgressBar,
                                                java.awt.Dimension subsampleDimension,
                                                boolean forceUBYTE,
                                                int numSlices,
                                                int numTimePoints)
      • readXMLThumbnail

        public FileImageXML readXMLThumbnail​(java.lang.String name,
                                             java.lang.String directory)
        Reads a thumbnail image from an XML file. if thumbnail is empty, will returned FileImageXML will be null.
        Parameters:
        name - filename
        directory - file's directory
        Returns:
        FileImageXML containing thumbnail or null
      • setFileDir

        public void setFileDir​(java.lang.String dir)
        Sets the directory where the file will be saved or opened.
        Parameters:
        dir - String directory
      • setModelLUT

        public void setModelLUT​(ModelLUT lut)
        Sets the LUT.
        Parameters:
        lut - the lookup table.
      • setModelRGB

        public void setModelRGB​(ModelRGB rgb)
        Sets the RGB.
        Parameters:
        rgb - lut the lookup table.
      • setPBar

        public void setPBar​(ProgressBarInterface pBar)
        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. true indicates that the process is to NOT inform the user and therefore be quiet.
      • setRawImageInfo

        public void setRawImageInfo​(RawImageInfo rawInfo)
        DOCUMENT ME!
        Parameters:
        rawInfo - DOCUMENT ME!
      • setUserDefinedFileTypes_textFieldPref

        public void setUserDefinedFileTypes_textFieldPref​(java.lang.String udefSuffix)
        This method sets the userDefinedFileTypes_textField preference.
        Parameters:
        udefSuffix - the user defined suffix
      • setUserDefinedFileTypesPref

        public void setUserDefinedFileTypesPref​(java.lang.String udefSuffix)
        This method sets the userDefinedFileTypes preference.
        Parameters:
        udefSuffix - the user defined suffix
      • writeImage

        public void writeImage​(ModelImage image,
                               FileWriteOptions options)
        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

        public byte[] getByteImageData​(ModelImage image,
                                       int start,
                                       int length)
      • dataConversion

        protected boolean dataConversion​(FileInfoBase sourceInfo,
                                         FileInfoBase destInfo)
        Provides a method of conversion from FileInfoDicom to FileInfoImageXML, by filling the FileInfoImageXML with 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 tags
        destInfo - The FileInfoBase that holds the image information to be stored in XML (or MincHDF)format.
        See Also:
        #getDicomSaveList(FileInfoDicom), JDialogDicom2XMLSelection
      • getDicomSaveList

        protected java.util.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 the dicomsave.dictionary file.
        Parameters:
        sourceInfo - Source of DICOM information.
        Returns:
        The Hashtable filled as an XML
      • LSMDataConversion

        protected void LSMDataConversion​(FileInfoLSM sourceInfo,
                                         FileInfoImageXML destInfo)
        Provides a method of conversion from FileInfoLSM to FileInfoImageXML, by filling the FileInfoImageXML with sets of chosen image information.
        Parameters:
        sourceInfo - the LSM-formatted Source information
        destInfo - 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 sampled
        min - - the image's minimum pixel value
        max - - 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:
        false only 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:
        false only 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 value
        one - Second value
        two - Third value
        Returns:
        Index of argument that is the biggest. That is, if zero is 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

        private boolean callDialog​(int[] extents,
                                   int dataType,
                                   FileWriteOptions options)
        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.
        isTiff - Flag indicating if this is a TIFF file; TIFF files require more options.
        options - Options to get from the dialog and save.
        Returns:
        DOCUMENT ME!
      • createProgressBar

        private void createProgressBar​(FileBase fBase,
                                       java.lang.String fName,
                                       java.lang.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.
        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

        private ModelImage readAfni​(java.lang.String fileName,
                                    java.lang.String fileDir,
                                    boolean loadB)
        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

        private ModelImage readAnalyze​(java.lang.String fileName,
                                       java.lang.String fileDir,
                                       boolean one)
        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 be splash.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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readSiemensText

        private ModelImage readSiemensText​(java.lang.String fileName,
                                           java.lang.String fileDir,
                                           boolean one)
        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 be splash.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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readAnalyzeMulti

        private ModelImage readAnalyzeMulti​(java.lang.String fileName,
                                            java.lang.String fileDir)
        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

        private ModelImage readAvi​(java.lang.String fileName,
                                   java.lang.String fileDir,
                                   boolean one,
                                   boolean readQT)
        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. true if only want to read one image from 3D dataset.
        readQT - Indicates that a QuickTime movie file is being read. true if this file represents QuickTime.
        Returns:
        The image that was read in, or null if failure.
      • readBioRad

        private ModelImage readBioRad​(java.lang.String fileName,
                                      java.lang.String fileDir,
                                      boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readBRUKER

        private ModelImage readBRUKER​(java.lang.String fileName,
                                      java.lang.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.
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readCheshire

        private ModelImage readCheshire​(java.lang.String fileName,
                                        java.lang.String fileDir)
        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

        private ModelImage readCOR​(java.lang.String fileName,
                                   java.lang.String fileDir)
        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

        private ModelImage readDM3​(java.lang.String fileName,
                                   java.lang.String fileDir,
                                   boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readFits

        private ModelImage readFits​(java.lang.String fileName,
                                    java.lang.String fileDir,
                                    boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readGEGenesis5XMulti

        public ModelImage readGEGenesis5XMulti​(java.lang.String fileName,
                                               java.lang.String fileDir)
        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

        private ModelImage readGESigna4XMulti​(java.lang.String fileName,
                                              java.lang.String fileDir)
        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

        private ModelImage readICS​(java.lang.String fileName,
                                   java.lang.String fileDir)
        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.
      • readInterfile

        private ModelImage readInterfile​(java.lang.String fileName,
                                         java.lang.String fileDir,
                                         boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readInterfileMulti

        private ModelImage readInterfileMulti​(java.lang.String fileName,
                                              java.lang.String fileDir)
        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

        public ModelImage readJimi​(java.lang.String fileName,
                                   java.lang.String fileDir,
                                   boolean multifile)
        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. true if 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

        private ModelImage readLSM​(java.lang.String fileName,
                                   java.lang.String fileDir,
                                   int secondAddress,
                                   boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readLSMMulti

        private ModelImage readLSMMulti​(java.lang.String fileName,
                                        java.lang.String fileDir)
        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

        private ModelImage readMagnetomVisionMulti​(java.lang.String fileName,
                                                   java.lang.String fileDir)
        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

        private ModelImage readMap​(java.lang.String fileName,
                                   java.lang.String fileDir)
        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

        private ModelImage readMedVision​(java.lang.String fileName,
                                         java.lang.String fileDir)
        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

        private ModelImage readMGH​(java.lang.String fileName,
                                   java.lang.String fileDir,
                                   boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readMicroCat

        private ModelImage readMicroCat​(java.lang.String fileName,
                                        java.lang.String fileDir,
                                        boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readMinc

        private ModelImage readMinc​(java.lang.String fileName,
                                    java.lang.String fileDir,
                                    boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readMincMulti

        private ModelImage readMincMulti​(java.lang.String fileName,
                                         java.lang.String fileDir)
        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

        private ModelImage readMincHDF​(java.lang.String fileName,
                                       java.lang.String fileDir,
                                       boolean one)
      • readMRC

        private ModelImage readMRC​(java.lang.String fileName,
                                   java.lang.String fileDir)
        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

        private ModelImage readBFLOAT​(java.lang.String fileName,
                                      java.lang.String fileDir,
                                      boolean one)
        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​(java.lang.String fileName,
                                    java.lang.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. true if only want to read one image from 3D dataset.
        niftiCompressed -
        noImportData -
        Returns:
        The image that was read in, or null if failure.
      • readMetaImage

        private ModelImage readMetaImage​(java.lang.String fileName,
                                         java.lang.String fileDir,
                                         boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readNIFTIMulti

        private ModelImage readNIFTIMulti​(java.lang.String fileName,
                                          java.lang.String fileDir)
        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

        private ModelImage readNRRD​(java.lang.String fileName,
                                    java.lang.String fileDir,
                                    boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readNRRDMulti

        private ModelImage readNRRDMulti​(java.lang.String fileName,
                                         java.lang.String fileDir)
        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

        public ModelImage readGEGenesis5X​(java.lang.String fileName,
                                          java.lang.String fileDir)
        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

        public ModelImage readGESigna4X​(java.lang.String fileName,
                                        java.lang.String fileDir)
        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

        private ModelImage readMagnetomVision​(java.lang.String fileName,
                                              java.lang.String fileDir)
        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

        private ModelImage readVista​(java.lang.String fileName,
                                     java.lang.String fileDir,
                                     boolean one)
      • readPARREC

        private ModelImage readPARREC​(java.lang.String fileName,
                                      java.lang.String fileDir,
                                      boolean one)
        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 be splash.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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readPARRECMulti

        private ModelImage readPARRECMulti​(java.lang.String fileName,
                                           java.lang.String fileDir)
        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

        private ModelImage readPGM​(java.lang.String fileName,
                                   java.lang.String fileDir)
        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

        private ModelImage readPPM​(java.lang.String fileName,
                                   java.lang.String fileDir)
        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

        private ModelImage readQT​(java.lang.String fileName,
                                  java.lang.String fileDir)
        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

        private ModelImage readRaw​(java.lang.String fileName,
                                   java.lang.String fileDir,
                                   FileInfoBase fileInfo)
        Reads a RAW file by calling the read method of the file. Gets the necessary information from a dialog, if the fileInfo parameter is null, and otherwise relies on the information stored in fileInfo to 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

        private ModelImage readRawMulti​(java.lang.String fileName,
                                        java.lang.String fileDir,
                                        FileInfoBase fileInfo)
        Reads a RAW file by calling the read method of the file. Gets the necessary information from a dialog, if the fileInfo parameter is null, and otherwise relies on the information stored in fileInfo to 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

        private ModelImage readSpar​(FileInfoBase fileInfo,
                                    java.lang.String fileName,
                                    java.lang.String fileDir,
                                    boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readSPM

        private ModelImage readSPM​(java.lang.String fileName,
                                   java.lang.String fileDir,
                                   boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readSTK

        private ModelImage readSTK​(java.lang.String fileName,
                                   java.lang.String fileDir,
                                   boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readTrackVis

        private ModelImage readTrackVis​(java.lang.String fileName,
                                        java.lang.String fileDir)
        Reads in a single TrackVis file.
        Returns:
        The image that was read in, or null if failure.
      • readCZI

        private ModelImage readCZI​(java.lang.String fileName,
                                   java.lang.String fileDir,
                                   boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readLIFF

        private ModelImage readLIFF​(java.lang.String fileName,
                                    java.lang.String fileDir,
                                    boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readBMP

        private ModelImage readBMP​(java.lang.String fileName,
                                   java.lang.String fileDir,
                                   boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readBMPMulti

        private ModelImage readBMPMulti​(java.lang.String fileName,
                                        java.lang.String fileDir,
                                        boolean one)
      • createMultifile

        private ModelImage createMultifile​(FileInfoBase myFileInfo,
                                           ModelImage origImage,
                                           java.lang.String fileDir,
                                           java.lang.String fileName,
                                           boolean quiet)
      • readMATLAB

        private ModelImage readMATLAB​(java.lang.String fileName,
                                      java.lang.String fileDir,
                                      boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readZVI

        private ModelImage readZVI​(java.lang.String fileName,
                                   java.lang.String fileDir,
                                   boolean one)
        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. true if 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

        public ModelImage readTiff​(java.lang.String fileName,
                                   java.lang.String fileDir,
                                   boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readTiffMulti

        private ModelImage readTiffMulti​(java.lang.String fileName,
                                         java.lang.String fileDir)
        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

        private ModelImage readSVS​(java.lang.String fileName,
                                   java.lang.String fileDir,
                                   boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readTMG

        private ModelImage readTMG​(java.lang.String fileName,
                                   java.lang.String fileDir)
        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

        public ModelImage readXML​(java.lang.String fileName,
                                  java.lang.String fileDir,
                                  boolean one,
                                  boolean bDisplayProgress)
        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 load splash.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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • readXMLMulti

        private ModelImage readXMLMulti​(java.lang.String fileName,
                                        java.lang.String fileDir)
        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

        private boolean writeAfni​(ModelImage image,
                                  FileWriteOptions options)
        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

        private boolean writeAnalyze​(ModelImage image,
                                     FileWriteOptions options,
                                     boolean zerofunused)
        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

        private boolean writeAvi​(ModelImage image,
                                 FileWriteOptions options)
        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

        private boolean writeCOR​(ModelImage image,
                                 FileWriteOptions options)
        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

        private boolean writeDicom​(ModelImage image,
                                   FileWriteOptions options)
        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

        java.lang.String reduceStringLengthTo16​(java.lang.String str)
      • removeEnhancedDicomInfo

        private void removeEnhancedDicomInfo​(FileInfoDicom myFileInfo,
                                             FileInfoBase[] fileInfoBases)
      • insertEnhancedSequence

        private void insertEnhancedSequence​(FileInfoDicom myFileInfo,
                                            FileInfoDicom[][] infoAr,
                                            int dataType)
      • writeFits

        private boolean writeFits​(ModelImage image,
                                  FileWriteOptions options)
        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.
      • writeGESigna4X

        private boolean writeGESigna4X​(ModelImage image,
                                       FileWriteOptions options)
        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

        private boolean writeGEGenesis5X​(ModelImage image,
                                         FileWriteOptions options)
        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

        private boolean writeICS​(ModelImage image,
                                 FileWriteOptions options)
        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

        private boolean writeInterfile​(ModelImage image,
                                       FileWriteOptions options)
        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

        private boolean writeJimi​(ModelImage image,
                                  FileWriteOptions options)
        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

        private final java.awt.image.BufferedImage getRenderedImage​(java.awt.Image in)
      • writeMGH

        private boolean writeMGH​(ModelImage image,
                                 FileWriteOptions options)
        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

        private boolean writeMinc​(ModelImage image,
                                  FileWriteOptions options)
        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

        private boolean writeMincHDF​(ModelImage image,
                                     FileWriteOptions options)
        Writes out a MINC 2.0 HDF5 formatted file
        Parameters:
        image -
        options -
        Returns:
      • writeMRC

        private boolean writeMRC​(ModelImage image,
                                 FileWriteOptions options)
        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

        private boolean writeMATLAB​(ModelImage image,
                                    FileWriteOptions options)
        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

        private boolean writeNIFTI​(ModelImage image,
                                   FileWriteOptions options)
        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

        private boolean writeMetaImage​(ModelImage image,
                                       FileWriteOptions options)
        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

        private boolean writeRaw​(ModelImage image,
                                 FileWriteOptions options)
        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

        private boolean writeSPM​(ModelImage image,
                                 FileWriteOptions options)
        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

        private boolean writeTiff​(ModelImage image,
                                  FileWriteOptions options)
        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

        private boolean writeSTK​(ModelImage image,
                                 FileWriteOptions options)
        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

        private boolean writeXML​(ModelImage image,
                                 FileWriteOptions options,
                                 boolean bDisplayProgress)
        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

        private boolean writeVista​(ModelImage image,
                                   FileWriteOptions options)
        writes Vista format files
        Parameters:
        image -
        options -
        Returns:
      • writePARREC

        private boolean writePARREC​(ModelImage image,
                                    FileWriteOptions options)
        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

        private boolean writeNRRD​(ModelImage image,
                                  FileWriteOptions options)
        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

        private ModelImage readJpeg2000​(java.lang.String fileName,
                                        java.lang.String fileDir,
                                        boolean one)
        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. true if only want to read one image from 3D dataset.
        Returns:
        The image that was read in, or null if failure.
      • writeJpeg2000

        private boolean writeJpeg2000​(ModelImage image,
                                      FileWriteOptions options)
        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

        private double getDoubleValOrAsciiVal​(java.lang.String value)
      • convertNumbersToStr

        private java.lang.String convertNumbersToStr​(java.lang.String dicomNumberString)