|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object gov.nih.mipav.model.file.FileUtility
public class FileUtility
Constants and static methods which relate to file input, output or processing.
Field Summary | |
---|---|
static int |
AFNI
AFNI file type. extension: .head, .brik |
static int |
ANALYZE
Analyze format (Mayo). extension: .img, .hdr |
static int |
ANALYZE_MULTIFILE
Multiple files of type analyze. |
static int |
AVI
AVI file type. |
static int |
BFLOAT
Extension: .hdr for header, .bfloat for data |
static int |
BIORAD
Used by the Bio-Rad Pic format. extension: .pic && fileID(54L)==12345 |
static int |
BMP
extension: .bmp. |
static int |
BRUKER
Bruker file format. |
static int |
CHESHIRE
Cheshire file type (a kind of Analyze). extension: .imc Can also have .img extension |
static int |
CHESHIRE_OVERLAY
Cheshire overlay file type. |
static int |
COR
Used by FreeSurfer software. extension: -.info or -.info~ for header file -.nnn for slice data file where nnn is the slice number |
static int |
CUR
extension: .cur. |
static int |
DIB
extension: .dib. |
static int |
DICOM
Digital Imaging and COmmunications in Medicine file type. |
static int |
DM3
Gatan's Digital Micrograph version 3 file format. extension: .dm3 |
static int |
ERROR
Ill defined file type. |
static int |
FITS
FITS file type. extension: .fits |
static int |
GE_GENESIS
GE Genesis 5X and LX. extension: .sig |
static int |
GE_GENESIS_MULTIFILE
Multiple files of type GE_GENESIS |
static int |
GE_SIGNA4X
GE Signa 4.x. |
static int |
GE_SIGNA4X_MULTIFILE
Multiple files of type GE_SIGNA4X |
static int |
GIF
extension: .gif. |
static int |
ICO
extension: .ico. |
static int |
ICS
Image Cytometry Standard. extension: .ics, .ids |
static int |
INTERFILE
Interfile file format used in Nuclear Medicine. extension: .hdr |
static int |
JIMI
Java Image Manangement Interface file type. |
static int |
JP2
|
static int |
JPEG
extension: .jpeg, .jpg. |
static int |
LIFF
Do not confuse with Leica image file format .lif |
static int |
LSM
Used by the Zeiss LSM 510 Dataserver. extension: .lsm |
static int |
LSM_MULTIFILE
Used by the Zeiss LSM 510 Dataserver. |
static int |
MAGNETOM_VISION
Siemens MAGNETOM VISION. extension: .ima |
static int |
MAGNETOM_VISION_MULTIFILE
Multiple files of type MAGNETOM_VISION |
static int |
MAP
Benes Trus special file type. extension: .map |
static int |
MEDIVISION
extension: .bin. |
static int |
MGH
MGH/MGZ volume format. |
static int |
MICRO_CAT
Micro CT format for small animal imaging. extension: .log, .ct |
static int |
MINC
MINC file type. |
static int |
MINC_HDF
MINC 2.0 (HDF5) |
static int |
MIPAV
Not presently implemented. |
static int |
MRC
extension: .mrc. |
static int |
NIFTI
NIFTI format. extension: .img, .hdr, .nii |
static int |
NIFTI_MULTIFILE
NIFTI multi-file format. |
static int |
NRRD
Nearly raw raster data. |
static int |
OSM
Washington University OSM dataset structure. extension: .wu |
static int |
PARREC
extension: "par","parv2","rec","frec". |
static int |
PCX
extension: .pcx. |
static int |
PIC
extension: .pic. |
static int |
PICT
extension: .pict. |
static int |
PNG
extension: .png. |
static int |
PROJECT
MIPAV project format. project file format (.xml) |
static int |
PSD
extension: .psd. |
static int |
QT
Quicktime file type. extension: .mov, .qt |
static int |
RAW
RAW image data, no header. extension: .raw |
static int |
RAW_MULTIFILE
RAW MULTIFLE image data, no header. |
static int |
SPM
SPM file format. |
static int |
STK
MetaMorph Stack (STK) file type. extension: .stk |
static int |
SURFACE_XML
MIPAV Surface XML file format. extension: .xml |
static int |
SURFACEREF_XML
MIPAV Surface XML file format. extension: .xml |
static int |
TGA
extension: .tga. |
static int |
TIFF
TIFF file; tagged header. extension: .tif, .tiff |
static int |
TIFF_MULTIFILE
Multiple files of TIFF images. |
static int |
TMG
Optical coherence tomography. extension: .tmg |
static int |
UNDEFINED
Undefined file type. |
static int |
VOI_FILE
VOI file, used to read VOIs. extension: .voi |
static int |
XBM
extension: .xbm. |
static int |
XML
MIPAV XML file format. mipav xml image format. extension: .xml |
static int |
XML_MULTIFILE
MIPAV XML file format. |
static int |
XPM
extension: .xpm. |
Constructor Summary | |
---|---|
FileUtility()
|
Method Summary | |
---|---|
static 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 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. |
static String |
getExtension(String absolutePath)
Returns the extension of the file name, if file name does not have extension, then return empty string. |
static String |
getFileDirectory(String fileName)
Returns the path information from the file name with the path information. |
static int |
getFileIndex(String fName)
Trims off the file extension and file name, but leaves the file index. |
static 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 String |
getFileName(String absolutePath)
Returns the file name without path information from file name with the path information. |
static List<String> |
getFileNameList(ModelImage image)
Gets the file name list from which this ModelImage is opened. |
static int |
getFileType(String fileName,
String fileDir,
boolean quiet)
Sets the FileBase. |
static int |
getFileType(String fileName,
String fileDir,
boolean doWrite,
boolean quiet)
Sets the FileBase. |
static int |
getFileTypeFromStr(String s)
Returns the file type associated with a string. |
static String |
getFileTypeStr(int m)
Return the string associated with a file type. |
static int |
isAnalyzeOrSPM(String fileName,
String fileDir,
boolean quiet)
Tests if the unknown file is of type Analyze. |
static int |
isDicom_ver2(String fileName,
String fileDir,
boolean quiet)
tests if unknown file is of type 2.0 dicom |
static int |
isDicom(String fileName,
String fileDir,
boolean quiet)
Tests if the unknown file is of type Dicom. |
static int |
isGESigna4X(String fileName,
String fileDir,
boolean quiet)
Tests if the unknown file is of type GE Signa 4X type. |
static int |
isGESigna5X(String fileName,
String fileDir,
boolean quiet)
Tests if the unknown file is of type GE Signa 5X type. |
static int |
isInterfile(String fileName,
String fileDir,
boolean quiet)
Tests if the unknown file is of type Interfile. |
static int |
isMagnetomVision(String fileName,
String fileDir,
boolean quiet)
Tests if the unknown file is of type Siemens Magnetom Vision. |
static int |
isMinc(String fileName,
String fileDir,
boolean quiet)
Tests if the unknown file is of type Minc. |
static int |
isMincHDF(String fileName,
String fileDir,
boolean quiet)
Determines whether the file on disk is of type MINC 2.0 |
static int |
isNIFTI(String fileName,
String fileDir,
boolean quiet)
Tests if the unknown file is of type Nifti. |
static int |
isSPM(String fileName,
String fileDir,
boolean quiet)
Tests if the unknown file is of type SPM. |
static 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). |
static String |
trimCOR(String fName)
Trims the numbers or file extension from COR file names. |
static String |
trimNumbersAndSpecial(String fName)
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 Detail |
---|
public static final int ERROR
public static final int UNDEFINED
public static final int AFNI
public static final int ANALYZE
public static final int ANALYZE_MULTIFILE
public static final int AVI
public static final int BIORAD
public static final int BMP
public static final int BRUKER
public static final int CHESHIRE
public static final int CHESHIRE_OVERLAY
public static final int COR
public static final int CUR
public static final int DIB
public static final int DICOM
public static final int DM3
public static final int FITS
public static final int GE_GENESIS
public static final int GE_GENESIS_MULTIFILE
public static final int GE_SIGNA4X
public static final int GE_SIGNA4X_MULTIFILE
public static final int GIF
public static final int ICO
public static final int ICS
public static final int INTERFILE
public static final int JIMI
public static final int JPEG
public static final int LSM
public static final int LSM_MULTIFILE
public static final int MAGNETOM_VISION
public static final int MAGNETOM_VISION_MULTIFILE
public static final int MAP
public static final int MEDIVISION
public static final int MGH
public static final int MICRO_CAT
public static final int MINC
public static final int MIPAV
public static final int MRC
public static final int NIFTI
public static final int NIFTI_MULTIFILE
public static final int NRRD
public static final int OSM
public static final int PCX
public static final int PIC
public static final int PICT
public static final int PNG
public static final int PROJECT
public static final int PSD
public static final int QT
public static final int RAW
public static final int RAW_MULTIFILE
public static final int SPM
public static final int STK
public static final int SURFACE_XML
public static final int TGA
public static final int TIFF
public static final int TIFF_MULTIFILE
public static final int TMG
public static final int VOI_FILE
public static final int XBM
public static final int XML
public static final int XML_MULTIFILE
public static final int XPM
public static final int PARREC
public static final int SURFACEREF_XML
public static final int MINC_HDF
public static final int LIFF
public static final int BFLOAT
public static final int JP2
Constructor Detail |
---|
public FileUtility()
Method Detail |
---|
public static int getFileTypeFromStr(String s)
s
- String to test
public static String getFileTypeStr(int m)
m
- int representing the file type (see the above static definitions)
public static final String[] getCORFileList(String fileDir, String fileName, boolean quiet) throws OutOfMemoryError
nImages
) for the
calling program.
fileDir
- Directory to look for images.fileName
- File name of the image.quiet
- Whether to avoid displaying errors using the GUI.
OutOfMemoryError
- If there is a problem allocating required memory.public static final String getCORSuffixFrom(String fn)
fn
- The filename.
-info. Note that suffix includes the separator '-'
public static final String getExtension(String absolutePath)
absolutePath
- the file name.
public static final String getFileDirectory(String fileName)
fileName
- the file name wiht the path information.
public static final int getFileIndex(String fName)
fName
- String file name to get index
public static final String[] getFileList(String fileDir, String fileName, boolean quiet) throws OutOfMemoryError
fileName
, sorted in
lexicographical order.
fileDir
- Directory to look for images.fileName
- File name of the image.quiet
- Whether to avoid displaying errors using the GUI.
OutOfMemoryError
- If there is a problem allocating required memory.public static final String getFileName(String absolutePath)
absolutePath
- the file name with the path information.
public static final int getFileType(String fileName, String fileDir, boolean quiet)
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).
FileBase
public static final int getFileType(String fileName, String fileDir, boolean doWrite, boolean quiet)
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).
FileBase
public static final int isAnalyzeOrSPM(String fileName, String fileDir, boolean quiet) throws IOException
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).
FileUtility.ANALYZE
if the file is a ANALYZE type,
FileUtility.SPM
if the file is a SPM type,
and FileUtility.UNDEFINED
otherwise
IOException
- If there is a problem determining the type of the given file.public static final int isDicom(String fileName, String fileDir, boolean quiet) throws IOException
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).
FileUtility.DICOM
if the file is a DICOM file, and FileUtility.UNDEFINED
otherwise
IOException
- If there is a problem determining the type of the given file.public static final int isDicom_ver2(String fileName, String fileDir, boolean quiet) throws IOException
fileName
- fileDir
- quiet
-
IOException
public static final int isGESigna4X(String fileName, String fileDir, boolean quiet) throws IOException
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).
FileUtility.GE_SIGNA4X
if the file is a GE MR Signa 4.x file, and
FileUtility.UNDEFINED
otherwise
IOException
- If there is a problem determining the type of the given file.public static final int isGESigna5X(String fileName, String fileDir, boolean quiet) throws IOException
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).
FileUtility.GE_GENESIS
if the file is a GE MR Signa 5.x file, and
FileUtility.UNDEFINED
otherwise
IOException
- If there is a problem determining the type of the given file.public static final int isInterfile(String fileName, String fileDir, boolean quiet) throws IOException
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).
FileUtility.Interfile
if the file is a Interfile type, and
FileUtility.UNDEFINED
otherwise
IOException
- If there is a problem determining the type of the given file.public static final int isMagnetomVision(String fileName, String fileDir, boolean quiet) throws IOException
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).
FileUtility.MAGNETOM_VISION
if the file is a Siemens Magnetom Vision type, and
FileUtility.UNDEFINED
otherwise
IOException
- If there is a problem determining the type of the given file.public static final int isMinc(String fileName, String fileDir, boolean quiet) throws IOException
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).
FileUtility.MINC
if the file is a MINC type, and FileUtility.UNDEFINED
otherwise
IOException
- If there is a problem determining the type of the given file.public static final int isMincHDF(String fileName, String fileDir, boolean quiet)
fileName
- name of the filefileDir
- directoryquiet
-
public static final int isNIFTI(String fileName, String fileDir, boolean quiet) throws IOException
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).
FileUtility.NIFTI
if the file is a NIFTI type, and FileUtility.UNDEFINED
otherwise
IOException
- If there is a problem determining the type of the given file.public static final int isSPM(String fileName, String fileDir, boolean quiet) throws IOException
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).
FileUtility.SPM
if the file is a SPM type, and FileUtility.UNDEFINED
otherwise
IOException
- If there is a problem determining the type of the given file.public static final String stripExtension(String fileName)
fileName
- Original name.
public static final String trimCOR(String fName)
.infoor
.info~will be removed from after a hyphen in the given fname.
fName
- File name where the last characters are alpha-numerics indicating the image number or .info or
.info~
public static final String trimNumbersAndSpecial(String fName)
[ - _
.
are removed from the end of the file.
fName
- File name where the last characters are alpha-numerics indicating the image number.
public static final List<String> getFileNameList(ModelImage image)
image
- the ModelImage object.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |