Class DicomDirectory
- All Implemented Interfaces:
TreeModel
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreate an empty DicomDirectoryDicomDirectory
(AttributeList list) Create a DicomDirectory from a DICOMDIR instance already read as an AttributeListDicomDirectory
(AttributeList list, boolean doConcatenations) Create a DicomDirectory from a DICOMDIR instance already read as an AttributeList, optionally creating synthetic concatenation recordsDicomDirectory
(File rootDirectory, String[] fileNames) Create a new DicomDirectory from a list of existing DICOM files contained within a specified root directory.DicomDirectory
(String[] fileNames) Create a new DicomDirectory from a list of existing DICOM files contained within the current working directory. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAttributeListFromDicomFileToDirectory
(AttributeList list, String fileName) Add an instance described by a list of attributes to this directory.void
findAllContainedReferencedFileNames
(DicomDirectoryRecord record, String parentFilePath) Get all the referenced file names at or below the specified directory record.findAllContainedReferencedFileNames
(String parentFilePath) Get all the referenced file names in the entire directory.static HashMap<String,
DicomDirectoryRecord> findAllContainedReferencedFileNamesAndTheirRecords
(DicomDirectoryRecord record, String parentFilePath) Get all the referenced file names at or below the specified directory record, and a map to the directory records that reference them.findAllContainedReferencedFileNamesAndTheirRecords
(String parentFilePath) Get all the referenced file names in the entire directory, and a map to the directory records that reference them.findAllImagesForFrameOfReference
(String frameOfReferenceUID) Get the attribute lists from all the IMAGE level directory records which have a particular FrameOfReferenceUID.int
getChildCount
(Object parent) int
getIndexOfChild
(Object parent, Object child) getMapOfSOPInstanceUIDToReferencedFileName
(String parentFilePath) Build a map of file names indexed by SOP Instance UID.getReferencedFileNameForSOPInstanceUID
(String sopInstanceUID) Get the file name for the specified SOP Instance UID.getRoot()
boolean
static void
Read DICOM files and create a DICOMDIR.void
readDicomFileAndAddToDirectory
(File rootDirectory, String fileName) Read DICOM file and add it to this directory.void
readDicomFileAndAddToDirectory
(String fileName) Read DICOM file and add it to this directory.void
toString()
void
valueForPathChanged
(TreePath path, Object newValue) void
Write the directory to the named file.
-
Field Details
-
mapOfDirectoryRecordsToSequenceItems
-
-
Constructor Details
-
DicomDirectory
Create a new DicomDirectory from a list of existing DICOM files contained within the current working directory.
The filenames must be relative to the current working directory, and not absolute paths, since the full name will be used in the DICOMDIR records.
Filenames are NOT checked for compliance with restrictions on length and character set.
- Parameters:
fileNames
- the names of the DICOM files (relative to the current working directory)
-
DicomDirectory
Create a new DicomDirectory from a list of existing DICOM files contained within a specified root directory.
The specified root directory will NOT be included in the referenced file name in the DICOMDIR records.
Filenames are NOT checked for compliance with restrictions on length and character set.
- Parameters:
rootDirectory
- the name of the directory to use as the root, which contains the DICOM filefileNames
- the names of the DICOM files (relative to rootDirectory)
-
DicomDirectory
public DicomDirectory()Create an empty DicomDirectory -
DicomDirectory
Create a DicomDirectory from a DICOMDIR instance already read as an AttributeList- Parameters:
list
- a list of attributes describing a DICOMDIR instance- Throws:
DicomException
- if error in DICOM encoding
-
DicomDirectory
Create a DicomDirectory from a DICOMDIR instance already read as an AttributeList, optionally creating synthetic concatenation records- Parameters:
list
- a list of attributes describing a DICOMDIR instancedoConcatenations
- true if synthetic concatenation records are to be created- Throws:
DicomException
- if error in DICOM encoding
-
-
Method Details
-
getChild
-
getIndexOfChild
- Specified by:
getIndexOfChild
in interfaceTreeModel
-
getRoot
-
getChildCount
- Specified by:
getChildCount
in interfaceTreeModel
-
isLeaf
-
valueForPathChanged
- Specified by:
valueForPathChanged
in interfaceTreeModel
-
addTreeModelListener
- Specified by:
addTreeModelListener
in interfaceTreeModel
-
removeTreeModelListener
- Specified by:
removeTreeModelListener
in interfaceTreeModel
-
readDicomFileAndAddToDirectory
public void readDicomFileAndAddToDirectory(File rootDirectory, String fileName) throws DicomException, IOException Read DICOM file and add it to this directory.- Parameters:
rootDirectory
- the name of the directory to use as the root, which contains the DICOM filefileName
- the name of the DICOM file (relative to rootDirectory)- Throws:
IOException
- if an I/O error occursDicomException
- if error in DICOM encoding
-
readDicomFileAndAddToDirectory
Read DICOM file and add it to this directory.- Parameters:
fileName
- the name of the DICOM file (relative to the current working directory)- Throws:
IOException
- if an I/O error occursDicomException
- if error in DICOM encoding
-
addAttributeListFromDicomFileToDirectory
public void addAttributeListFromDicomFileToDirectory(AttributeList list, String fileName) throws DicomException, IOException Add an instance described by a list of attributes to this directory. Builds the necessary patient, study, series and instance level directory records, with the instance level record being the appropriate type for the SOP Class.- Parameters:
list
- the list of attributes containing the attributes to add to this directoryfileName
- the name of the DICOM file- Throws:
IOException
- if an I/O error occursDicomException
- if error in DICOM encoding, or the SOP Class is not recognized, or the instance already exists in the directory
-
write
Write the directory to the named file.
- Parameters:
name
- the file name to write to- Throws:
IOException
- if an I/O error occursDicomException
- if error in DICOM encoding
-
toString
-
getMapOfSOPInstanceUIDToReferencedFileName
Build a map of file names indexed by SOP Instance UID.
- Parameters:
parentFilePath
- the path to the root of the file names encoded in this directory- Returns:
- a map of SOP Instance UID keys to file names including the supplied parentFilePath
-
getReferencedFileNameForSOPInstanceUID
Get the file name for the specified SOP Instance UID.
- Parameters:
sopInstanceUID
- the SOP Instance UID wanted- Returns:
- the referenced file name, or null if not found
- Throws:
DicomException
- if map has not been initialized
-
findAllContainedReferencedFileNamesAndTheirRecords
public static HashMap<String,DicomDirectoryRecord> findAllContainedReferencedFileNamesAndTheirRecords(DicomDirectoryRecord record, String parentFilePath) Get all the referenced file names at or below the specified directory record, and a map to the directory records that reference them.
-
findAllContainedReferencedFileNamesAndTheirRecords
public HashMap<String,DicomDirectoryRecord> findAllContainedReferencedFileNamesAndTheirRecords(String parentFilePath) Get all the referenced file names in the entire directory, and a map to the directory records that reference them.
-
findAllContainedReferencedFileNames
public static Vector<String> findAllContainedReferencedFileNames(DicomDirectoryRecord record, String parentFilePath) Get all the referenced file names at or below the specified directory record.
-
findAllContainedReferencedFileNames
Get all the referenced file names in the entire directory.
-
findAllImagesForFrameOfReference
Get the attribute lists from all the IMAGE level directory records which have a particular FrameOfReferenceUID.
Useful for finding potential localizers and orthogonal images.
Note that even though FrameOfReference is a series level entity, in the CT/MR profiles it is specified at the IMAGE directory record level.
- Parameters:
frameOfReferenceUID
- the frame of reference UID to search for- Returns:
- a
Vector
ofAttributeList
-
main
Read DICOM files and create a DICOMDIR.
- Parameters:
arg
- optionally the folder in which the files and DICOMDIR are rooted, the filename of the DICOMDIR to be created, then optionally a list of all the filenames of the DICOM files to include (otherwise the folder will be searched)
-