Package gov.nih.mipav.model.file
Class FileUtility
- java.lang.Object
-
- gov.nih.mipav.model.file.FileUtility
-
public class FileUtility extends java.lang.ObjectConstants and static methods which relate to file input, output or processing.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classFileUtility.nameSliceComparatorprivate static classFileUtility.nameSliceItem
-
Field Summary
Fields Modifier and Type Field Description static intAFNIAFNI file type. extension: .head, .brikstatic intANALYZEAnalyze format (Mayo). extension: .img, .hdrstatic intANALYZE_MULTIFILEMultiple files of type analyze.static intAVIAVI file type.static intBFLOATExtension: .hdr for header, .bfloat for datastatic intBIORADUsed by the Bio-Rad Pic format. extension: .pic && fileID(54L)==12345static intBMPextension: .bmp.static intBMP_MULTIFILEBmp multifilestatic intBRUKERBruker file format.static intCHESHIRECheshire file type (a kind of Analyze). extension: .imc Can also have .img extensionstatic intCHESHIRE_OVERLAYCheshire overlay file type.static intCORUsed by FreeSurfer software. extension: -.info or -.info~ for header file -.nnn for slice data file where nnn is the slice numberstatic intCURextension: .cur.static intCZIZeiss ZISRAW (CZI) file format extension .czistatic intDIBextension: .dib.static intDICOMDigital Imaging and COmmunications in Medicine file type.static intDM3Gatan's Digital Micrograph version 3 file format. extension: .dm3static intERRORIll defined file type.private static java.lang.String[]fileTypeStrstatic intFITSFITS file type. extension: .fitsstatic intGE_GENESISGE Genesis 5X and LX. extension: .sigstatic intGE_GENESIS_MULTIFILEMultiple files of type GE_GENESISstatic intGE_SIGNA4XGE Signa 4.x.static intGE_SIGNA4X_MULTIFILEMultiple files of type GE_SIGNA4Xstatic intGIFextension: .gif.static intICOextension: .ico.static intICSImage Cytometry Standard. extension: .ics, .idsstatic intINTERFILEInterfile file format used in Nuclear Medicine. extension: .hdrstatic intINTERFILE_MULTIFILEMultiple files of type INTERFILEstatic intJIMIJava Image Manangement Interface file type.static intJP2static intJPEGextension: .jpeg, .jpg.static intJSONextension .jsonstatic intLIFFDo not confuse with Leica image file format .lifstatic intLSMUsed by the Zeiss LSM 510 Dataserver. extension: .lsmstatic intLSM_MULTIFILEUsed by the Zeiss LSM 510 Dataserver.static intMAGNETOM_VISIONSiemens MAGNETOM VISION. extension: .imastatic intMAGNETOM_VISION_MULTIFILEMultiple files of type MAGNETOM_VISIONstatic intMAPBenes Trus special file type. extension: .mapstatic intMATLABextension .matstatic intMEDIVISIONextension: .bin.static intMETAIMAGEMetaimage files are either separate .mhd header and .raw image data files or combined .mha header and image data filestatic intMGHMGH/MGZ volume format.static intMICRO_CATMicro CT format for small animal imaging. extension: .log, .ctstatic intMINCMINC file type.static intMINC_HDFMINC 2.0 (HDF5)static intMINC_MULTIFILEMultiple files of type MINC.static intMIPAVNot presently implemented.static intMRCextension: .mrc.static intNIFTINIFTI format. extension: .img, .hdr, .niistatic intNIFTI_MULTIFILENIFTI multi-file format.static intNRRDNearly raw raster data.static intNRRD_MULTIFILENearly raw raster data.static intOSMWashington University OSM dataset structure. extension: .wustatic intPARRECextension: "par","parv2","rec","frec".static intPARREC_MULTIFILEextension: "par","parv2","rec","frec".static intPCXextension: .pcx.static intPGMPortable Gray Map extension .pgmstatic intPICextension: .pic.static intPICTextension: .pict.static intPNGextension: .png.static intPPMPortable Pixmap Utilities .ppmstatic intPSDextension: .psd.static intQTQuicktime file type. extension: .mov, .qtstatic intRAWRAW image data, no header. extension: .rawstatic intRAW_MULTIFILERAW MULTIFLE image data, no header.static intSIEMENSTEXTExtension: .hdr for header, .img for datastatic intSPARSPAR file format for use with PARREC imagesstatic intSPMSPM file format.static intSTKMetaMorph Stack (STK) file type. extension: .stkstatic intSURFACE_XMLMIPAV Surface XML file format. extension: .xmlstatic intSURFACEREF_XMLMIPAV Surface XML file format. extension: .xmlstatic intSVSAperio TIFF based .svsstatic intTGAextension: .tga.static intTIFFTIFF file; tagged header. extension: .tif, .tiffstatic intTIFF_MULTIFILEMultiple files of TIFF images.static intTMGOptical coherence tomography. extension: .tmgstatic intTRACKVISExtension: .trk, TrackVis track datastatic intUNDEFINEDUndefined file type.static intVISTAVista file extension .vstatic intVOI_FILEVOI file, used to read VOIs. extension: .voistatic intXBMextension: .xbm.static intXMLMIPAV XML file format. mipav xml image format. extension: .xmlstatic intXML_MULTIFILEMIPAV XML file format.static intXPMextension: .xpm.static intZVIZeiss ZVI has extension .zvi
-
Constructor Summary
Constructors Constructor Description FileUtility()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String[]getCORFileList(java.lang.String fileDir, java.lang.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 java.lang.StringgetCORSuffixFrom(java.lang.String fn)Only used for COR volume files with hyphen in name Breaks the filename into basename and suffix, then returns the suffix.static java.lang.StringgetExtension(java.lang.String absolutePath)Returns the extension of the file name (including the dot), if file name does not have extension, then return empty string.static java.lang.StringgetFileDirectory(java.lang.String fileName)Returns the path information from the file name with the path information.static intgetFileIndex(java.lang.String fName)Trims off the file extension and file name, but leaves the file index.static java.lang.String[]getFileList(java.lang.String fileDir, java.lang.String fileName, boolean quiet)Looks in the image directory and returns all images with the same suffix asfileName, sorted in lexicographical order.static java.lang.StringgetFileName(java.lang.String absolutePath)Returns the file name without path information from file name with the path information.static java.util.List<java.lang.String>getFileNameList(FileInfoBase[] fileInfoList)Gets the file name list from which this ModelImage is opened.static java.util.List<java.lang.String>getFileNameList(ModelImage image)Gets the file name list from which this ModelImage is opened.static intgetFileType(java.lang.String fileName, java.lang.String fileDir, boolean quiet)Sets the FileBase.static intgetFileType(java.lang.String fileName, java.lang.String fileDir, boolean doWrite, boolean quiet, boolean[] zerofunused)Sets the FileBase.static intgetFileTypeFromStr(java.lang.String s)Returns the file type associated with a string.static java.lang.StringgetFileTypeStr(int m)Return the string associated with a file type.static intisAnalyzeOrSPM(java.lang.String fileName, java.lang.String fileDir, boolean quiet)Tests if the unknown file is of type Analyze.static intisDicom(java.lang.String fileName, java.lang.String fileDir, boolean quiet)Tests if the unknown file is of type Dicom.static intisDicom_ver2(java.lang.String fileName, java.lang.String fileDir, boolean quiet)tests if unknown file is of type 2.0 dicomstatic intisGESigna4X(java.lang.String fileName, java.lang.String fileDir, boolean quiet)Tests if the unknown file is of type GE Signa 4X type.static intisGESigna5X(java.lang.String fileName, java.lang.String fileDir, boolean quiet)Tests if the unknown file is of type GE Signa 5X type.static intisInterfile(java.lang.String fileName, java.lang.String fileDir, boolean quiet)Tests if the unknown file is of type Interfile.static intisMagnetomVision(java.lang.String fileName, java.lang.String fileDir, boolean quiet)Tests if the unknown file is of type Siemens Magnetom Vision.static intisMinc(java.lang.String fileName, java.lang.String fileDir, boolean quiet)Tests if the unknown file is of type Minc.static intisMincHDF(java.lang.String fileName, java.lang.String fileDir, boolean quiet)Determines whether the file on disk is of type MINC 2.0static intisNIFTI(java.lang.String fileName, java.lang.String fileDir, boolean quiet)Tests if the unknown file is of type Nifti.static intisSPM(java.lang.String fileName, java.lang.String fileDir, boolean quiet)Tests if the unknown file is of type SPM.static java.lang.StringstripExtension(java.lang.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).static java.lang.StringtrimCOR(java.lang.String fName)Trims the numbers or file extension from COR file names.static java.lang.StringtrimNumbersAndSpecial(java.lang.String fName)Trims the numbers and special character from the file name.
-
-
-
Field Detail
-
ERROR
public static final int ERROR
Ill defined file type.- See Also:
- Constant Field Values
-
UNDEFINED
public static final int UNDEFINED
Undefined file type.- See Also:
- Constant Field Values
-
AFNI
public static final int AFNI
AFNI file type. extension: .head, .brik- See Also:
- Constant Field Values
-
ANALYZE
public static final int ANALYZE
Analyze format (Mayo). extension: .img, .hdr- See Also:
- Constant Field Values
-
ANALYZE_MULTIFILE
public static final int ANALYZE_MULTIFILE
Multiple files of type analyze.- See Also:
- Constant Field Values
-
AVI
public static final int AVI
AVI file type. Windows Media. extension: .avi- See Also:
- Constant Field Values
-
BIORAD
public static final int BIORAD
Used by the Bio-Rad Pic format. extension: .pic && fileID(54L)==12345- See Also:
- Constant Field Values
-
BMP
public static final int BMP
extension: .bmp.- See Also:
- Constant Field Values
-
BMP_MULTIFILE
public static final int BMP_MULTIFILE
Bmp multifile- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
CHESHIRE
public static final int CHESHIRE
Cheshire file type (a kind of Analyze). extension: .imc Can also have .img extension- See Also:
- Constant Field Values
-
CHESHIRE_OVERLAY
public static final int CHESHIRE_OVERLAY
Cheshire overlay file type. Contains VOIs. extension: .oly- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
CUR
public static final int CUR
extension: .cur.- See Also:
- Constant Field Values
-
DIB
public static final int DIB
extension: .dib.- See Also:
- Constant Field Values
-
DICOM
public static final int DICOM
Digital Imaging and COmmunications in Medicine file type. Fully implemented versions 2 & 3. extension: .dcm- See Also:
- Constant Field Values
-
DM3
public static final int DM3
Gatan's Digital Micrograph version 3 file format. extension: .dm3- See Also:
- Constant Field Values
-
FITS
public static final int FITS
FITS file type. extension: .fits- See Also:
- Constant Field Values
-
GE_GENESIS
public static final int GE_GENESIS
GE Genesis 5X and LX. extension: .sig- See Also:
- Constant Field Values
-
GE_GENESIS_MULTIFILE
public static final int GE_GENESIS_MULTIFILE
Multiple files of type GE_GENESIS- See Also:
- Constant Field Values
-
GE_SIGNA4X
public static final int GE_SIGNA4X
GE Signa 4.x.- See Also:
- Constant Field Values
-
GE_SIGNA4X_MULTIFILE
public static final int GE_SIGNA4X_MULTIFILE
Multiple files of type GE_SIGNA4X- See Also:
- Constant Field Values
-
GIF
public static final int GIF
extension: .gif.- See Also:
- Constant Field Values
-
ICO
public static final int ICO
extension: .ico.- See Also:
- Constant Field Values
-
ICS
public static final int ICS
Image Cytometry Standard. extension: .ics, .ids- See Also:
- Constant Field Values
-
INTERFILE
public static final int INTERFILE
Interfile file format used in Nuclear Medicine. extension: .hdr- See Also:
- Constant Field Values
-
INTERFILE_MULTIFILE
public static final int INTERFILE_MULTIFILE
Multiple files of type INTERFILE- See Also:
- Constant Field Values
-
JIMI
public static final int JIMI
Java Image Manangement Interface file type.- See Also:
- Constant Field Values
-
JPEG
public static final int JPEG
extension: .jpeg, .jpg.- See Also:
- Constant Field Values
-
LSM
public static final int LSM
Used by the Zeiss LSM 510 Dataserver. extension: .lsm- See Also:
- Constant Field Values
-
LSM_MULTIFILE
public static final int LSM_MULTIFILE
Used by the Zeiss LSM 510 Dataserver.- See Also:
- Constant Field Values
-
MAGNETOM_VISION
public static final int MAGNETOM_VISION
Siemens MAGNETOM VISION. extension: .ima- See Also:
- Constant Field Values
-
MAGNETOM_VISION_MULTIFILE
public static final int MAGNETOM_VISION_MULTIFILE
Multiple files of type MAGNETOM_VISION- See Also:
- Constant Field Values
-
MAP
public static final int MAP
Benes Trus special file type. extension: .map- See Also:
- Constant Field Values
-
MEDIVISION
public static final int MEDIVISION
extension: .bin.- See Also:
- Constant Field Values
-
MGH
public static final int MGH
MGH/MGZ volume format.- See Also:
- Constant Field Values
-
MICRO_CAT
public static final int MICRO_CAT
Micro CT format for small animal imaging. extension: .log, .ct- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
MINC_MULTIFILE
public static final int MINC_MULTIFILE
Multiple files of type MINC.- See Also:
- Constant Field Values
-
MIPAV
public static final int MIPAV
Not presently implemented.- See Also:
- Constant Field Values
-
MRC
public static final int MRC
extension: .mrc.- See Also:
- Constant Field Values
-
NIFTI
public static final int NIFTI
NIFTI format. extension: .img, .hdr, .nii- See Also:
- Constant Field Values
-
NIFTI_MULTIFILE
public static final int NIFTI_MULTIFILE
NIFTI multi-file format.- See Also:
- Constant Field Values
-
NRRD
public static final int NRRD
Nearly raw raster data.- See Also:
- Constant Field Values
-
NRRD_MULTIFILE
public static final int NRRD_MULTIFILE
Nearly raw raster data.- See Also:
- Constant Field Values
-
OSM
public static final int OSM
Washington University OSM dataset structure. extension: .wu- See Also:
- Constant Field Values
-
PCX
public static final int PCX
extension: .pcx.- See Also:
- Constant Field Values
-
PIC
public static final int PIC
extension: .pic.- See Also:
- Constant Field Values
-
PICT
public static final int PICT
extension: .pict.- See Also:
- Constant Field Values
-
PNG
public static final int PNG
extension: .png.- See Also:
- Constant Field Values
-
PSD
public static final int PSD
extension: .psd.- See Also:
- Constant Field Values
-
QT
public static final int QT
Quicktime file type. extension: .mov, .qt- See Also:
- Constant Field Values
-
RAW
public static final int RAW
RAW image data, no header. extension: .raw- See Also:
- Constant Field Values
-
RAW_MULTIFILE
public static final int RAW_MULTIFILE
RAW MULTIFLE image data, no header.- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
STK
public static final int STK
MetaMorph Stack (STK) file type. extension: .stk- See Also:
- Constant Field Values
-
SURFACE_XML
public static final int SURFACE_XML
MIPAV Surface XML file format. extension: .xml- See Also:
- Constant Field Values
-
TGA
public static final int TGA
extension: .tga.- See Also:
- Constant Field Values
-
TIFF
public static final int TIFF
TIFF file; tagged header. extension: .tif, .tiff- See Also:
- Constant Field Values
-
TIFF_MULTIFILE
public static final int TIFF_MULTIFILE
Multiple files of TIFF images.- See Also:
- Constant Field Values
-
TMG
public static final int TMG
Optical coherence tomography. extension: .tmg- See Also:
- Constant Field Values
-
VOI_FILE
public static final int VOI_FILE
VOI file, used to read VOIs. extension: .voi- See Also:
- Constant Field Values
-
XBM
public static final int XBM
extension: .xbm.- See Also:
- Constant Field Values
-
XML
public static final int XML
MIPAV XML file format. mipav xml image format. extension: .xml- See Also:
- Constant Field Values
-
XML_MULTIFILE
public static final int XML_MULTIFILE
MIPAV XML file format.- See Also:
- Constant Field Values
-
XPM
public static final int XPM
extension: .xpm.- See Also:
- Constant Field Values
-
PARREC
public static final int PARREC
extension: "par","parv2","rec","frec".- See Also:
- Constant Field Values
-
PARREC_MULTIFILE
public static final int PARREC_MULTIFILE
extension: "par","parv2","rec","frec".- See Also:
- Constant Field Values
-
SPAR
public static final int SPAR
SPAR file format for use with PARREC images- See Also:
- Constant Field Values
-
SURFACEREF_XML
public static final int SURFACEREF_XML
MIPAV Surface XML file format. extension: .xml- See Also:
- Constant Field Values
-
MINC_HDF
public static final int MINC_HDF
MINC 2.0 (HDF5)- See Also:
- Constant Field Values
-
LIFF
public static final int LIFF
Do not confuse with Leica image file format .lif- See Also:
- Constant Field Values
-
BFLOAT
public static final int BFLOAT
Extension: .hdr for header, .bfloat for data- See Also:
- Constant Field Values
-
SIEMENSTEXT
public static final int SIEMENSTEXT
Extension: .hdr for header, .img for data- See Also:
- Constant Field Values
-
ZVI
public static final int ZVI
Zeiss ZVI has extension .zvi- See Also:
- Constant Field Values
-
JP2
public static final int JP2
- See Also:
- Constant Field Values
-
MATLAB
public static final int MATLAB
extension .mat- See Also:
- Constant Field Values
-
VISTA
public static final int VISTA
Vista file extension .v- See Also:
- Constant Field Values
-
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:
- Constant Field Values
-
TRACKVIS
public static final int TRACKVIS
Extension: .trk, TrackVis track data- See Also:
- Constant Field Values
-
CZI
public static final int CZI
Zeiss ZISRAW (CZI) file format extension .czi- See Also:
- Constant Field Values
-
PGM
public static final int PGM
Portable Gray Map extension .pgm- See Also:
- Constant Field Values
-
PPM
public static final int PPM
Portable Pixmap Utilities .ppm- See Also:
- Constant Field Values
-
SVS
public static final int SVS
Aperio TIFF based .svs- See Also:
- Constant Field Values
-
JSON
public static final int JSON
extension .json- See Also:
- Constant Field Values
-
fileTypeStr
private static final java.lang.String[] fileTypeStr
-
-
Method Detail
-
getFileTypeFromStr
public static int getFileTypeFromStr(java.lang.String s)
Returns the file type associated with a string.- Parameters:
s- String to test- Returns:
- axis orientation
-
getFileTypeStr
public static java.lang.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 java.lang.String[] getCORFileList(java.lang.String fileDir, java.lang.String fileName, boolean quiet) throws java.lang.OutOfMemoryErrorOnly 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:
java.lang.OutOfMemoryError- If there is a problem allocating required memory.
-
getCORSuffixFrom
public static final java.lang.String getCORSuffixFrom(java.lang.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 java.lang.String getExtension(java.lang.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 java.lang.String getFileDirectory(java.lang.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(java.lang.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 java.lang.String[] getFileList(java.lang.String fileDir, java.lang.String fileName, boolean quiet) throws java.lang.OutOfMemoryErrorLooks in the image directory and returns all images with the same suffix asfileName, 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:
java.lang.OutOfMemoryError- If there is a problem allocating required memory.
-
getFileName
public static final java.lang.String getFileName(java.lang.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(java.lang.String fileName, java.lang.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:
FileBase
-
getFileType
public static final int getFileType(java.lang.String fileName, java.lang.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 filequiet- 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:
FileBase
-
isAnalyzeOrSPM
public static final int isAnalyzeOrSPM(java.lang.String fileName, java.lang.String fileDir, boolean quiet) throws java.io.IOExceptionTests 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.ANALYZEif the file is a ANALYZE type,FileUtility.SPMif the file is a SPM type, andFileUtility.UNDEFINEDotherwise- Throws:
java.io.IOException- If there is a problem determining the type of the given file.
-
isDicom
public static final int isDicom(java.lang.String fileName, java.lang.String fileDir, boolean quiet) throws java.io.IOExceptionTests 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.DICOMif the file is a DICOM file, andFileUtility.UNDEFINEDotherwise- Throws:
java.io.IOException- If there is a problem determining the type of the given file.
-
isDicom_ver2
public static final int isDicom_ver2(java.lang.String fileName, java.lang.String fileDir, boolean quiet) throws java.io.IOExceptiontests if unknown file is of type 2.0 dicom- Parameters:
fileName-fileDir-quiet-- Returns:
- Throws:
java.io.IOException
-
isGESigna4X
public static final int isGESigna4X(java.lang.String fileName, java.lang.String fileDir, boolean quiet) throws java.io.IOExceptionTests 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_SIGNA4Xif the file is a GE MR Signa 4.x file, andFileUtility.UNDEFINEDotherwise- Throws:
java.io.IOException- If there is a problem determining the type of the given file.
-
isGESigna5X
public static final int isGESigna5X(java.lang.String fileName, java.lang.String fileDir, boolean quiet) throws java.io.IOExceptionTests 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_GENESISif the file is a GE MR Signa 5.x file, andFileUtility.UNDEFINEDotherwise- Throws:
java.io.IOException- If there is a problem determining the type of the given file.
-
isInterfile
public static final int isInterfile(java.lang.String fileName, java.lang.String fileDir, boolean quiet) throws java.io.IOExceptionTests 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.Interfileif the file is a Interfile type, andFileUtility.UNDEFINEDotherwise- Throws:
java.io.IOException- If there is a problem determining the type of the given file.
-
isMagnetomVision
public static final int isMagnetomVision(java.lang.String fileName, java.lang.String fileDir, boolean quiet) throws java.io.IOExceptionTests 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_VISIONif the file is a Siemens Magnetom Vision type, andFileUtility.UNDEFINEDotherwise- Throws:
java.io.IOException- If there is a problem determining the type of the given file.
-
isMinc
public static final int isMinc(java.lang.String fileName, java.lang.String fileDir, boolean quiet) throws java.io.IOExceptionTests 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.MINCif the file is a MINC type, andFileUtility.UNDEFINEDotherwise- Throws:
java.io.IOException- If there is a problem determining the type of the given file.
-
isMincHDF
public static final int isMincHDF(java.lang.String fileName, java.lang.String fileDir, boolean quiet)Determines whether the file on disk is of type MINC 2.0- Parameters:
fileName- name of the filefileDir- directoryquiet-- Returns:
- whether the file is HDF5 type
-
isNIFTI
public static final int isNIFTI(java.lang.String fileName, java.lang.String fileDir, boolean quiet) throws java.io.IOExceptionTests 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.NIFTIif the file is a NIFTI type, andFileUtility.UNDEFINEDotherwise- Throws:
java.io.IOException- If there is a problem determining the type of the given file.
-
isSPM
public static final int isSPM(java.lang.String fileName, java.lang.String fileDir, boolean quiet) throws java.io.IOExceptionTests 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.SPMif the file is a SPM type, andFileUtility.UNDEFINEDotherwise- Throws:
java.io.IOException- If there is a problem determining the type of the given file.
-
stripExtension
public static final java.lang.String stripExtension(java.lang.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 java.lang.String trimCOR(java.lang.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 java.lang.String trimNumbersAndSpecial(java.lang.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 java.util.List<java.lang.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 java.util.List<java.lang.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.
-
-