com.pixelmed.dicom

## Class DicomFileUtilities

- java.lang.Object
- - com.pixelmed.dicom.DicomFileUtilities

    public class DicomFileUtilities
    extends java.lang.Object

Various static methods helpful for handling DICOM files.

### Method Summary

Methods
`static boolean` `isDicomOrAcrNemaFile(java.io.File file)` Does the file contain a DICOM (or DICOM-like ACR-NEMA) dataset ?
`static boolean` `isDicomOrAcrNemaFile(java.lang.String filename)` Does the file contain a DICOM (or DICOM-like ACR-NEMA) dataset ?
`static void` `main(java.lang.String[] arg)` Iterate through a list of files and report which are DICOM and which are not.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### isDicomOrAcrNemaFile

    public static boolean isDicomOrAcrNemaFile(java.lang.String filename)

Does the file contain a DICOM (or DICOM-like ACR-NEMA) dataset ?

Any exceptions during attempts to read are caught and false returned.

Parameters:
  `filename` - the file
Returns:
  true if file exists, can be read, and seems to contain a DICOM or ACR-NEMA dataset (with or without a PS 3.10 preamble and meta information header)

#### isDicomOrAcrNemaFile

    public static boolean isDicomOrAcrNemaFile(java.io.File file)

Does the file contain a DICOM (or DICOM-like ACR-NEMA) dataset ?

Any exceptions during attempts to read are (silently) caught and false returned.

Note that this method may return true but `DicomInputStream` and `AttributeList` may fail to read the file, since it may be "bad" ways that are not supported, e.g., missing TransferSyntaxUID in meta information header, etc.

Will detect files with:

- PS 3.10 meta-header (even if in invalid big-endian transfer syntax and even if 1st meta information header attribute is not group length)
- no meta-header but in little or big endian and explicit or implicit VR starting with a group 0x0008 attribute element <= 0x0018 (SOPInstanceUID)

Will reject everything else, including files with:

- no meta-header and not starting with a group 0x0008 attribute, e.g. that have command (group 0x0000) elements at the start of the dataset

Parameters:
  `file` - the file
Returns:
  true if file exists, can be read, and seems to contain a DICOM or ACR-NEMA dataset (with or without a PS 3.10 preamble and meta information header)

#### main

    public static void main(java.lang.String[] arg)

Iterate through a list of files and report which are DICOM and which are not.

Parameters:
  `arg` - a list of files to test