Class FileUtility

java.lang.Object
gov.nih.mipav.model.file.FileUtility

public class FileUtility extends Object
Constants and static methods which relate to file input, output or processing.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static class 
     
    private static class 
     
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    AFNI file type. extension: .head, .brik
    static final int
    Analyze format (Mayo). extension: .img, .hdr
    static final int
    Multiple files of type analyze.
    static final int
    AVI file type.
    static final int
    Extension: .hdr for header, .bfloat for data
    static final int
    Used by the Bio-Rad Pic format. extension: .pic invalid input: '&'invalid input: '&' fileID(54L)==12345
    static final int
    extension: .bmp.
    static final int
    Bmp multifile
    static final int
    Bruker file format.
    static final int
    Cheshire file type (a kind of Analyze). extension: .imc Can also have .img extension
    static final int
    Cheshire overlay file type.
    static final int
    Used by FreeSurfer software. extension: -.info or -.info~ for header file -.nnn for slice data file where nnn is the slice number
    static final int
    extension: .cur.
    static final int
    Zeiss ZISRAW (CZI) file format extension .czi
    static final int
    extension: .dib.
    static final int
    Digital Imaging and COmmunications in Medicine file type.
    static final int
    Gatan's Digital Micrograph version 3 file format. extension: .dm3
    static final int
    Ill defined file type.
    private static final String[]
     
    static final int
    FITS file type. extension: .fits
    static final int
    GE Genesis 5X and LX. extension: .sig
    static final int
    Multiple files of type GE_GENESIS
    static final int
    GE Signa 4.x.
    static final int
    Multiple files of type GE_SIGNA4X
    static final int
    extension: .gif.
    static final int
    extension: .ico.
    static final int
    Image Cytometry Standard. extension: .ics, .ids
    static final int
    Interfile file format used in Nuclear Medicine. extension: .hdr
    static final int
    Multiple files of type INTERFILE
    static final int
    Java Image Manangement Interface file type.
    static final int
     
    static final int
    extension: .jpeg, .jpg.
    static final int
     
    static final int
     
    static final int
    extension .json
    static final int
    Do not confuse with Leica image file format .lif
    static final int
    Used by the Zeiss LSM 510 Dataserver. extension: .lsm
    static final int
    Used by the Zeiss LSM 510 Dataserver.
    static final int
    Siemens MAGNETOM VISION. extension: .ima
    static final int
    Multiple files of type MAGNETOM_VISION
    static final int
    Benes Trus special file type. extension: .map
    static final int
    extension .mat
    static final int
    extension: .bin.
    static final int
    Metaimage files are either separate .mhd header and .raw image data files or combined .mha header and image data file
    static final int
    MGH/MGZ volume format.
    static final int
    Micro CT format for small animal imaging. extension: .log, .ct
    static final int
    MINC file type.
    static final int
    MINC 2.0 (HDF5)
    static final int
    Multiple files of type MINC.
    static final int
    Not presently implemented.
    static final int
    extension: .mrc.
    static final int
    NIFTI format. extension: .img, .hdr, .nii
    static final int
    NIFTI multi-file format.
    static final int
    Nearly raw raster data.
    static final int
    Nearly raw raster data.
    static final int
    Washington University OSM dataset structure. extension: .wu
    static final int
    extension: "par","parv2","rec","frec".
    static final int
    extension: "par","parv2","rec","frec".
    static final int
    extension: .pcx.
    static final int
    Portable Gray Map extension .pgm
    static final int
    extension: .pic.
    static final int
    extension: .pict.
    static final int
    extension: .png.
    static final int
    Portable Pixmap Utilities .ppm
    static final int
    extension: .psd.
    static final int
    Quicktime file type. extension: .mov, .qt
    static final int
    RAW image data, no header. extension: .raw
    static final int
    RAW MULTIFLE image data, no header.
    static final int
    Extension: .hdr for header, .img for data
    static final int
    SPAR file format for use with PARREC images
    static final int
    SPM file format.
    static final int
    MetaMorph Stack (STK) file type. extension: .stk
    static final int
    MIPAV Surface XML file format. extension: .xml
    static final int
    MIPAV Surface XML file format. extension: .xml
    static final int
    Aperio TIFF based .svs
    static final int
    extension: .tga.
    static final int
    TIFF file; tagged header. extension: .tif, .tiff
    static final int
    Multiple files of TIFF images.
    static final int
    Optical coherence tomography. extension: .tmg
    static final int
    Extension: .trk, TrackVis track data
    static final int
    Undefined file type.
    static final int
    Vista file extension .v
    static final int
    VOI file, used to read VOIs. extension: .voi
    static final int
    extension: .xbm.
    static final int
    MIPAV XML file format. mipav xml image format. extension: .xml
    static final int
    MIPAV XML file format.
    static final int
    extension: .xpm.
    static final int
    Zeiss ZVI has extension .zvi
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static final String[]
    getCORFileList(String fileDir, String fileName, boolean quiet)
    Only for FreeSurfer COR volume files Looks in the image directory and returns all images with the same root up to the hyphen, sorted in lexicographical order.
    static final String
    Only used for COR volume files with hyphen in name Breaks the filename into basename and suffix, then returns the suffix.
    static final String
    getExtension(String absolutePath)
    Returns the extension of the file name (including the dot), if file name does not have extension, then return empty string.
    static final String
    Returns the path information from the file name with the path information.
    static final int
    Trims off the file extension and file name, but leaves the file index.
    static final String[]
    getFileList(String fileDir, String fileName, boolean quiet)
    Looks in the image directory and returns all images with the same suffix as fileName, sorted in lexicographical order.
    static final String
    getFileName(String absolutePath)
    Returns the file name without path information from file name with the path information.
    static final List<String>
    getFileNameList(FileInfoBase[] fileInfoList)
    Gets the file name list from which this ModelImage is opened.
    static final List<String>
    Gets the file name list from which this ModelImage is opened.
    static final int
    getFileType(String fileName, String fileDir, boolean quiet)
    Sets the FileBase.
    static final int
    getFileType(String fileName, String fileDir, boolean doWrite, boolean quiet, boolean[] zerofunused)
    Sets the FileBase.
    static int
    Returns the file type associated with a string.
    static String
    Return the string associated with a file type.
    static final int
    isAnalyzeOrSPM(String fileName, String fileDir, boolean quiet)
    Tests if the unknown file is of type Analyze.
    static final int
    isDicom(String fileName, String fileDir, boolean quiet)
    Tests if the unknown file is of type Dicom.
    static final int
    isDicom_ver2(String fileName, String fileDir, boolean quiet)
    tests if unknown file is of type 2.0 dicom
    static final int
    isGESigna4X(String fileName, String fileDir, boolean quiet)
    Tests if the unknown file is of type GE Signa 4X type.
    static final int
    isGESigna5X(String fileName, String fileDir, boolean quiet)
    Tests if the unknown file is of type GE Signa 5X type.
    static final int
    isInterfile(String fileName, String fileDir, boolean quiet)
    Tests if the unknown file is of type Interfile.
    static final int
    isMagnetomVision(String fileName, String fileDir, boolean quiet)
    Tests if the unknown file is of type Siemens Magnetom Vision.
    static final int
    isMinc(String fileName, String fileDir, boolean quiet)
    Tests if the unknown file is of type Minc.
    static final int
    isMincHDF(String fileName, String fileDir, boolean quiet)
    Determines whether the file on disk is of type MINC 2.0
    static final int
    isNIFTI(String fileName, String fileDir, boolean quiet)
    Tests if the unknown file is of type Nifti.
    static final int
    isSPM(String fileName, String fileDir, boolean quiet)
    Tests if the unknown file is of type SPM.
    static final String
    Helper method to strip the image name of the extension, so when we save we don't have double extensions (like genormcor.img.tif).
    static final String
    trimCOR(String fName)
    Trims the numbers or file extension from COR file names.
    static final String
    Trims the numbers and special character from the file name.

    Methods inherited from class java.lang.Object

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

    • ERROR

      public static final int ERROR
      Ill defined file type.
      See Also:
    • UNDEFINED

      public static final int UNDEFINED
      Undefined file type.
      See Also:
    • AFNI

      public static final int AFNI
      AFNI file type. extension: .head, .brik
      See Also:
    • ANALYZE

      public static final int ANALYZE
      Analyze format (Mayo). extension: .img, .hdr
      See Also:
    • ANALYZE_MULTIFILE

      public static final int ANALYZE_MULTIFILE
      Multiple files of type analyze.
      See Also:
    • AVI

      public static final int AVI
      AVI file type. Windows Media. extension: .avi
      See Also:
    • BIORAD

      public static final int BIORAD
      Used by the Bio-Rad Pic format. extension: .pic invalid input: '&'invalid input: '&' fileID(54L)==12345
      See Also:
    • BMP

      public static final int BMP
      extension: .bmp.
      See Also:
    • BMP_MULTIFILE

      public static final int BMP_MULTIFILE
      Bmp multifile
      See Also:
    • BRUKER

      public static final int BRUKER
      Bruker file format. Reads a BRUKER file by first reading in the d3proc header file, second the reco header file, third the acqp file int the same directory or up one or two two parent directories, and finally the 2dseq binary file.
      See Also:
    • CHESHIRE

      public static final int CHESHIRE
      Cheshire file type (a kind of Analyze). extension: .imc Can also have .img extension
      See Also:
    • CHESHIRE_OVERLAY

      public static final int CHESHIRE_OVERLAY
      Cheshire overlay file type. Contains VOIs. extension: .oly
      See Also:
    • COR

      public static final int COR
      Used by FreeSurfer software. extension: -.info or -.info~ for header file -.nnn for slice data file where nnn is the slice number
      See Also:
    • CUR

      public static final int CUR
      extension: .cur.
      See Also:
    • DIB

      public static final int DIB
      extension: .dib.
      See Also:
    • DICOM

      public static final int DICOM
      Digital Imaging and COmmunications in Medicine file type. Fully implemented versions 2 invalid input: '&' 3. extension: .dcm
      See Also:
    • DM3

      public static final int DM3
      Gatan's Digital Micrograph version 3 file format. extension: .dm3
      See Also:
    • FITS

      public static final int FITS
      FITS file type. extension: .fits
      See Also:
    • GE_GENESIS

      public static final int GE_GENESIS
      GE Genesis 5X and LX. extension: .sig
      See Also:
    • GE_GENESIS_MULTIFILE

      public static final int GE_GENESIS_MULTIFILE
      Multiple files of type GE_GENESIS
      See Also:
    • GE_SIGNA4X

      public static final int GE_SIGNA4X
      GE Signa 4.x.
      See Also:
    • GE_SIGNA4X_MULTIFILE

      public static final int GE_SIGNA4X_MULTIFILE
      Multiple files of type GE_SIGNA4X
      See Also:
    • GIF

      public static final int GIF
      extension: .gif.
      See Also:
    • ICO

      public static final int ICO
      extension: .ico.
      See Also:
    • ICS

      public static final int ICS
      Image Cytometry Standard. extension: .ics, .ids
      See Also:
    • INTERFILE

      public static final int INTERFILE
      Interfile file format used in Nuclear Medicine. extension: .hdr
      See Also:
    • INTERFILE_MULTIFILE

      public static final int INTERFILE_MULTIFILE
      Multiple files of type INTERFILE
      See Also:
    • JIMI

      public static final int JIMI
      Java Image Manangement Interface file type.
      See Also:
    • JPEG

      public static final int JPEG
      extension: .jpeg, .jpg.
      See Also:
    • LSM

      public static final int LSM
      Used by the Zeiss LSM 510 Dataserver. extension: .lsm
      See Also:
    • LSM_MULTIFILE

      public static final int LSM_MULTIFILE
      Used by the Zeiss LSM 510 Dataserver.
      See Also:
    • MAGNETOM_VISION

      public static final int MAGNETOM_VISION
      Siemens MAGNETOM VISION. extension: .ima
      See Also:
    • MAGNETOM_VISION_MULTIFILE

      public static final int MAGNETOM_VISION_MULTIFILE
      Multiple files of type MAGNETOM_VISION
      See Also:
    • MAP

      public static final int MAP
      Benes Trus special file type. extension: .map
      See Also:
    • MEDIVISION

      public static final int MEDIVISION
      extension: .bin.
      See Also:
    • MGH

      public static final int MGH
      MGH/MGZ volume format.
      See Also:
    • MICRO_CAT

      public static final int MICRO_CAT
      Micro CT format for small animal imaging. extension: .log, .ct
      See Also:
    • MINC

      public static final int MINC
      MINC file type. MINC is a medical imaging oriented extension of the NetCDF file format. NetCDF stands for 'Network Common Data Form'. extension: .mnc
      See Also:
    • MINC_MULTIFILE

      public static final int MINC_MULTIFILE
      Multiple files of type MINC.
      See Also:
    • MIPAV

      public static final int MIPAV
      Not presently implemented.
      See Also:
    • MRC

      public static final int MRC
      extension: .mrc.
      See Also:
    • NIFTI

      public static final int NIFTI
      NIFTI format. extension: .img, .hdr, .nii
      See Also:
    • NIFTI_MULTIFILE

      public static final int NIFTI_MULTIFILE
      NIFTI multi-file format.
      See Also:
    • NRRD

      public static final int NRRD
      Nearly raw raster data.
      See Also:
    • NRRD_MULTIFILE

      public static final int NRRD_MULTIFILE
      Nearly raw raster data.
      See Also:
    • OSM

      public static final int OSM
      Washington University OSM dataset structure. extension: .wu
      See Also:
    • PCX

      public static final int PCX
      extension: .pcx.
      See Also:
    • PIC

      public static final int PIC
      extension: .pic.
      See Also:
    • PICT

      public static final int PICT
      extension: .pict.
      See Also:
    • PNG

      public static final int PNG
      extension: .png.
      See Also:
    • PSD

      public static final int PSD
      extension: .psd.
      See Also:
    • QT

      public static final int QT
      Quicktime file type. extension: .mov, .qt
      See Also:
    • RAW

      public static final int RAW
      RAW image data, no header. extension: .raw
      See Also:
    • RAW_MULTIFILE

      public static final int RAW_MULTIFILE
      RAW MULTIFLE image data, no header.
      See Also:
    • SPM

      public static final int SPM
      SPM file format. SPM99 and SPM2 are slight variants of analyze with the same .img, .hdr file extensions. The user could also change the extension .img to .spm to indicate SPM. The header extension would remain .hdr
      See Also:
    • STK

      public static final int STK
      MetaMorph Stack (STK) file type. extension: .stk
      See Also:
    • SURFACE_XML

      public static final int SURFACE_XML
      MIPAV Surface XML file format. extension: .xml
      See Also:
    • TGA

      public static final int TGA
      extension: .tga.
      See Also:
    • TIFF

      public static final int TIFF
      TIFF file; tagged header. extension: .tif, .tiff
      See Also:
    • TIFF_MULTIFILE

      public static final int TIFF_MULTIFILE
      Multiple files of TIFF images.
      See Also:
    • TMG

      public static final int TMG
      Optical coherence tomography. extension: .tmg
      See Also:
    • VOI_FILE

      public static final int VOI_FILE
      VOI file, used to read VOIs. extension: .voi
      See Also:
    • XBM

      public static final int XBM
      extension: .xbm.
      See Also:
    • XML

      public static final int XML
      MIPAV XML file format. mipav xml image format. extension: .xml
      See Also:
    • XML_MULTIFILE

      public static final int XML_MULTIFILE
      MIPAV XML file format.
      See Also:
    • XPM

      public static final int XPM
      extension: .xpm.
      See Also:
    • PARREC

      public static final int PARREC
      extension: "par","parv2","rec","frec".
      See Also:
    • PARREC_MULTIFILE

      public static final int PARREC_MULTIFILE
      extension: "par","parv2","rec","frec".
      See Also:
    • SPAR

      public static final int SPAR
      SPAR file format for use with PARREC images
      See Also:
    • SURFACEREF_XML

      public static final int SURFACEREF_XML
      MIPAV Surface XML file format. extension: .xml
      See Also:
    • MINC_HDF

      public static final int MINC_HDF
      MINC 2.0 (HDF5)
      See Also:
    • LIFF

      public static final int LIFF
      Do not confuse with Leica image file format .lif
      See Also:
    • BFLOAT

      public static final int BFLOAT
      Extension: .hdr for header, .bfloat for data
      See Also:
    • SIEMENSTEXT

      public static final int SIEMENSTEXT
      Extension: .hdr for header, .img for data
      See Also:
    • ZVI

      public static final int ZVI
      Zeiss ZVI has extension .zvi
      See Also:
    • JP2

      public static final int JP2
      See Also:
    • MATLAB

      public static final int MATLAB
      extension .mat
      See Also:
    • VISTA

      public static final int VISTA
      Vista file extension .v
      See Also:
    • METAIMAGE

      public static final int METAIMAGE
      Metaimage files are either separate .mhd header and .raw image data files or combined .mha header and image data file
      See Also:
    • TRACKVIS

      public static final int TRACKVIS
      Extension: .trk, TrackVis track data
      See Also:
    • CZI

      public static final int CZI
      Zeiss ZISRAW (CZI) file format extension .czi
      See Also:
    • PGM

      public static final int PGM
      Portable Gray Map extension .pgm
      See Also:
    • PPM

      public static final int PPM
      Portable Pixmap Utilities .ppm
      See Also:
    • SVS

      public static final int SVS
      Aperio TIFF based .svs
      See Also:
    • JSON

      public static final int JSON
      extension .json
      See Also:
    • JPEG_LS

      public static final int JPEG_LS
      See Also:
    • JPEG_XL

      public static final int JPEG_XL
      See Also:
    • fileTypeStr

      private static final String[] fileTypeStr
  • Constructor Details

    • FileUtility

      public FileUtility()
  • Method Details

    • getFileTypeFromStr

      public static int getFileTypeFromStr(String s)
      Returns the file type associated with a string.
      Parameters:
      s - String to test
      Returns:
      axis orientation
    • getFileTypeStr

      public static String getFileTypeStr(int m)
      Return the string associated with a file type.
      Parameters:
      m - int representing the file type (see the above static definitions)
      Returns:
      String representing the string associated with the file type.
    • getCORFileList

      public static final String[] getCORFileList(String fileDir, String fileName, boolean quiet) throws OutOfMemoryError
      Only for FreeSurfer COR volume files Looks in the image directory and returns all images with the same root up to the hyphen, sorted in lexicographical order. Will set the number of images (nImages) for the calling program.
      Parameters:
      fileDir - Directory to look for images.
      fileName - File name of the image.
      quiet - Whether to avoid displaying errors using the GUI.
      Returns:
      An array of the image names to be read in or saved as.
      Throws:
      OutOfMemoryError - If there is a problem allocating required memory.
    • getCORSuffixFrom

      public static final String getCORSuffixFrom(String fn)
      Only used for COR volume files with hyphen in name Breaks the filename into basename and suffix, then returns the suffix.
      Parameters:
      fn - The filename.
      Returns:
      The suffix or file-extension. For example, -info. Note that suffix includes the separator '-'
    • getExtension

      public static final String getExtension(String absolutePath)
      Returns the extension of the file name (including the dot), if file name does not have extension, then return empty string.
      Parameters:
      absolutePath - the file name.
      Returns:
      The file's extension.
    • getFileDirectory

      public static final String getFileDirectory(String fileName)
      Returns the path information from the file name with the path information.
      Parameters:
      fileName - the file name wiht the path information.
      Returns:
      The path information.
    • getFileIndex

      public static final int getFileIndex(String fName)
      Trims off the file extension and file name, but leaves the file index. An index might be 0001, or 140, for example.
      Parameters:
      fName - String file name to get index
      Returns:
      String (index string)
    • getFileList

      public static final String[] getFileList(String fileDir, String fileName, boolean quiet) throws OutOfMemoryError
      Looks in the image directory and returns all images with the same suffix as fileName, sorted in lexicographical order.
      Parameters:
      fileDir - Directory to look for images.
      fileName - File name of the image.
      quiet - Whether to avoid displaying errors using the GUI.
      Returns:
      An array of the image names to be read in or saved as.
      Throws:
      OutOfMemoryError - If there is a problem allocating required memory.
    • getFileName

      public static final String getFileName(String absolutePath)
      Returns the file name without path information from file name with the path information.
      Parameters:
      absolutePath - the file name with the path information.
      Returns:
      The file name without path information.
    • getFileType

      public static final int getFileType(String fileName, String fileDir, boolean quiet)
      Sets the FileBase.(filetype) based on the file extension of the given filename. Also sets file "suffix", if required.
      Parameters:
      fileName - Filename of the image to read in. Must include the file extension.
      fileDir - Directory where fileName exists.
      quiet - Whether to avoid any user interaction (ie, from error popups).
      Returns:
      Filetype from FileBase.
      See Also:
    • getFileType

      public static final int getFileType(String fileName, String fileDir, boolean doWrite, boolean quiet, boolean[] zerofunused)
      Sets the FileBase.(filetype) based on the file extension of the given filename. Also sets file "suffix", if required.
      Parameters:
      fileName - Filename of the image to read in. Must include the file extension.
      fileDir - Directory where fileName exists.
      doWrite - If true about to write a file
      quiet - Whether to avoid any user interaction (ie, from error popups).
      zerofunused - If true, zero funused fields in an analyze write
      Returns:
      Filetype from FileBase.
      See Also:
    • isAnalyzeOrSPM

      public static final int isAnalyzeOrSPM(String fileName, String fileDir, boolean quiet) throws IOException
      Tests if the unknown file is of type Analyze.
      Parameters:
      fileName - Name of the image file to read.
      fileDir - Directory of the image file to read.
      quiet - Whether to avoid any user interaction (ie, from error popups).
      Returns:
      FileUtility.ANALYZE if the file is a ANALYZE type, FileUtility.SPM if the file is a SPM type, and FileUtility.UNDEFINED otherwise
      Throws:
      IOException - If there is a problem determining the type of the given file.
    • isDicom

      public static final int isDicom(String fileName, String fileDir, boolean quiet) throws IOException
      Tests if the unknown file is of type Dicom.
      Parameters:
      fileName - Name of the image file to read.
      fileDir - Directory of the image file to read.
      quiet - Whether to avoid any user interaction (ie, from error popups).
      Returns:
      FileUtility.DICOM if the file is a DICOM file, and FileUtility.UNDEFINED otherwise
      Throws:
      IOException - If there is a problem determining the type of the given file.
    • isDicom_ver2

      public static final int isDicom_ver2(String fileName, String fileDir, boolean quiet) throws IOException
      tests if unknown file is of type 2.0 dicom
      Parameters:
      fileName -
      fileDir -
      quiet -
      Returns:
      Throws:
      IOException
    • isGESigna4X

      public static final int isGESigna4X(String fileName, String fileDir, boolean quiet) throws IOException
      Tests if the unknown file is of type GE Signa 4X type.
      Parameters:
      fileName - Name of the image file to read.
      fileDir - Directory of the image file to read.
      quiet - Whether to avoid any user interaction (ie, from error popups).
      Returns:
      FileUtility.GE_SIGNA4X if the file is a GE MR Signa 4.x file, and FileUtility.UNDEFINED otherwise
      Throws:
      IOException - If there is a problem determining the type of the given file.
    • isGESigna5X

      public static final int isGESigna5X(String fileName, String fileDir, boolean quiet) throws IOException
      Tests if the unknown file is of type GE Signa 5X type.
      Parameters:
      fileName - Name of the image file to read.
      fileDir - Directory of the image file to read.
      quiet - Whether to avoid any user interaction (ie, from error popups).
      Returns:
      FileUtility.GE_GENESIS if the file is a GE MR Signa 5.x file, and FileUtility.UNDEFINED otherwise
      Throws:
      IOException - If there is a problem determining the type of the given file.
    • isInterfile

      public static final int isInterfile(String fileName, String fileDir, boolean quiet) throws IOException
      Tests if the unknown file is of type Interfile.
      Parameters:
      fileName - Name of the image file to read.
      fileDir - Directory of the image file to read.
      quiet - Whether to avoid any user interaction (ie, from error popups).
      Returns:
      FileUtility.Interfile if the file is a Interfile type, and FileUtility.UNDEFINED otherwise
      Throws:
      IOException - If there is a problem determining the type of the given file.
    • isMagnetomVision

      public static final int isMagnetomVision(String fileName, String fileDir, boolean quiet) throws IOException
      Tests if the unknown file is of type Siemens Magnetom Vision.
      Parameters:
      fileName - Name of the image file to read.
      fileDir - Directory of the image file to read.
      quiet - Whether to avoid any user interaction (ie, from error popups).
      Returns:
      FileUtility.MAGNETOM_VISION if the file is a Siemens Magnetom Vision type, and FileUtility.UNDEFINED otherwise
      Throws:
      IOException - If there is a problem determining the type of the given file.
    • isMinc

      public static final int isMinc(String fileName, String fileDir, boolean quiet) throws IOException
      Tests if the unknown file is of type Minc.
      Parameters:
      fileName - Name of the image file to read.
      fileDir - Directory of the image file to read.
      quiet - Whether to avoid any user interaction (ie, from error popups).
      Returns:
      FileUtility.MINC if the file is a MINC type, and FileUtility.UNDEFINED otherwise
      Throws:
      IOException - If there is a problem determining the type of the given file.
    • isMincHDF

      public static final int isMincHDF(String fileName, String fileDir, boolean quiet)
      Determines whether the file on disk is of type MINC 2.0
      Parameters:
      fileName - name of the file
      fileDir - directory
      quiet -
      Returns:
      whether the file is HDF5 type
    • isNIFTI

      public static final int isNIFTI(String fileName, String fileDir, boolean quiet) throws IOException
      Tests if the unknown file is of type Nifti.
      Parameters:
      fileName - Name of the image file to read.
      fileDir - Directory of the image file to read.
      quiet - Whether to avoid any user interaction (ie, from error popups).
      Returns:
      FileUtility.NIFTI if the file is a NIFTI type, and FileUtility.UNDEFINED otherwise
      Throws:
      IOException - If there is a problem determining the type of the given file.
    • isSPM

      public static final int isSPM(String fileName, String fileDir, boolean quiet) throws IOException
      Tests if the unknown file is of type SPM.
      Parameters:
      fileName - Name of the image file to read.
      fileDir - Directory of the image file to read.
      quiet - Whether to avoid any user interaction (ie, from error popups).
      Returns:
      FileUtility.SPM if the file is a SPM type, and FileUtility.UNDEFINED otherwise
      Throws:
      IOException - If there is a problem determining the type of the given file.
    • stripExtension

      public static final String stripExtension(String fileName)
      Helper method to strip the image name of the extension, so when we save we don't have double extensions (like genormcor.img.tif).
      Parameters:
      fileName - Original name.
      Returns:
      Name without extension, or original name if there was no extension.
    • trimCOR

      public static final String trimCOR(String fName)
      Trims the numbers or file extension from COR file names. Any numbers or .info or .info~ will be removed from after a hyphen in the given fname.
      Parameters:
      fName - File name where the last characters are alpha-numerics indicating the image number or .info or .info~
      Returns:
      File name without numbers on the end.
    • trimNumbersAndSpecial

      public static final String trimNumbersAndSpecial(String fName)
      Trims the numbers and special character from the file name. Numerics and some special characters [ - _ . are removed from the end of the file.
      Parameters:
      fName - File name where the last characters are alpha-numerics indicating the image number.
      Returns:
      File name without numbers on the end.
    • getFileNameList

      public static final List<String> getFileNameList(ModelImage image)
      Gets the file name list from which this ModelImage is opened.
      Parameters:
      image - the ModelImage object.
      Returns:
      the actual file name list.
    • getFileNameList

      public static final List<String> getFileNameList(FileInfoBase[] fileInfoList)
      Gets the file name list from which this ModelImage is opened.
      Parameters:
      image - the ModelImage object.
      Returns:
      the actual file name list.