Create Dicomdir From Dicom Files
I will read more about how to send files in DICOM standard. I am starting to create a really small dicom server to receive DICOM files and my first concern is how to classify the files I receive and store them in folders, ordered by patient information and things like this. But I can't find this information in DICOM files but in DICOMDIR files. The dcmmkdir utility creates a DICOMDIR file from the specified referenced DICOM files according to the DICOM Part 11 Media Storage Application Profiles. Currently the following profiles are supported (others might be added later): General Purpose CD-R Interchange (STD-GEN-CD) General Purpose Interchange on DVD-RAM Media (STD-GEN-DVD-RAM). Provided by: dcmtk3.6.0-15amd64 NAME dcmgpdir - Create a general purpose DICOMDIR SYNOPSIS dcmgpdir options dcmfile-in. DESCRIPTION The dcmgpdir utility creates a DICOMDIR file from the specified referenced DICOM files according to the DICOM Part 11 Media Storage Application Profiles. If rescale is True the voxels will be cast to float32, if set to False, the original dtype will be preserved even if DICOM rescaling information is present. The returned array has the column-major byte-order. Datasets produced by reading DICOMDIR files are ignored. This function requires that the datasets. On removable media. It specifies the contents of a DICOM File Set, the format of a DICOM File and the policies associated with the maintenance of a DICOM Media Storage Directory (DICOMDIR) structure. A Quick Walk Through DICOM. IMAIOS Dicom Viewer (IDV) is a free online dicom viewer browsing your medical images from computer, cd or dvd, and delivering lightning-fast 2D rendering previews highly optimized for any desktop device. This is especially useful to either create an archive of compressed files (for long-term archiving), or to create a DICOM buffer with uncompressed files (for interfacing with DICOM modalities that do not support compressed transfer syntaxes). If the transcoding fails, the DICOM instance is still stored using its original transfer syntax.
When DICOM Application Entities participate in the exchange of information by the interchange of Storage Media, they perform through the DICOM File Service a number of Media Storage Services:
M-WRITE, to create new files in a File-set and assign them a File ID;
M-READ to read existing files based on their File ID;
M-DELETE to delete existing files based on their File ID;
M-INQUIRE FILE-SET to inquire free space available for creating new files within the File-set;
M-INQUIRE FILE to inquire date and time of file creation (or last update if applicable) for any file within the File-set.
A DICOM Application Entity may take one or more of the following three roles:
File-set Creator (FSC). Such an Application Entity, exercises this role by means of M-WRITE Operations to create the DICOMDIR File (see Section 8.6) and zero or more DICOM Files;
File-set Reader (FSR). Such an Application Entity, exercises this role by means of M-READ Operations to access one or more Files in a File-set. A File-set Reader shall not modify any of the files of the File-set (including the DICOMDIR File);
File-set Updater (FSU). Such an Application Entity, exercises this role by means of M-READ, M-WRITE, and M-DELETE Operations. It reads, but shall not modify, the content of any of the DICOM files in a File-set except for the DICOMDIR File. It may create additional Files by means of an M-WRITE or delete existing Files in a File-set by means of an M-DELETE.
Note
Although a File-set Updater (FSU) may include the functions corresponding to a File-set Creator (FSC) and a File-set Reader (FSR), it is not required that implementations supporting an FSU role also support an FSC or an FSR role.
The use of the concept of roles in DICOM Conformance Statements will result in a more precise expression of the capabilities of implementations supporting DICOM Media Storage. Conforming implementations shall support one of the following choices:
File-set Creator,
File-set Reader,
File-set Creator and File-set Reader,
File-set Updater,
File-set Updater and File-set Creator,
File-set Updater and File-set Reader,
File-set Updater, File-set Creator and File-set Reader.
Based on the roles supported by a DICOM Application Entity, the DICOM File Service shall support the Media Operations defined in Table 8.3-1.
Table 8.3-1. Media Operations and Roles
Create Dicomdir From Dicom Files File
Media Operations Roles | M-WRITE | M-READ | M-DELETE | M-INQUIRE FILE-SET | M-INQUIRE FILE |
---|---|---|---|---|---|
FSC | Mandatory | Not required | Not required | Mandatory | Not required |
FSR | Not required | Mandatory | Not required | Not required | Mandatory |
FSC+FSR | Mandatory | Mandatory | Not required | Mandatory | Mandatory |
FSU | Mandatory | Mandatory | Mandatory | Mandatory | Mandatory |
FSU+FSC | Mandatory | Mandatory | Mandatory | Mandatory | Mandatory |
FSU+FSR | Mandatory | Mandatory | Mandatory | Mandatory | Mandatory |
FSU+FSC+FSR | Mandatory | Mandatory | Mandatory | Mandatory | Mandatory |
Note
Media Preparation is outside the scope of this Part of the DICOM Standard. However it is assumed to be performed by the FS Creator.
The DICOM File Service does not require that file update capabilities (e.g., append) be supported by every Media Format Definition selected. The non-support of such file update capabilities to the DICOMDIR File may simply result in having to delete and create a new file in order to keep the directory information consistent.
If the content of a file needs to be updated or changed by an FSU, it is considered by this Part of the DICOM Standard as an M-DELETE Operation followed by an M-WRITE Operation. The FSU is responsible for ensuring the internal consistency of the File and its conformance to PS3.10 and the specific SOP Class stored, exactly as if the FSU was creating a new File. In particular, if an FSU implementation needs to update the file content but is not able to recognize and fully process the content of the File Preamble (see Section 7.1), it may consider setting the first four bytes of the Preamble to 'DICM' followed by 124 bytes to 00H. This would avoid introducing inconsistencies between the content of the File Preamble and the remainder of the file content. An example of this situation may occur when a TIFF IFD 0 Offset in the File Preamble points at a further TIFF IFD embedded in the DICOM Data Set, and the update operation changes the location of this embedded TIFF IFD.

When DICOM Application Entities participate in the exchange of information by the interchange of Storage Media, they perform through the DICOM File Service a number of Media Storage Services:
M-WRITE, to create new files in a File-set and assign them a File ID;
M-READ to read existing files based on their File ID;
M-DELETE to delete existing files based on their File ID;
M-INQUIRE FILE-SET to inquire free space available for creating new files within the File-set;
M-INQUIRE FILE to inquire date and time of file creation (or last update if applicable) for any file within the File-set.
A DICOM Application Entity may take one or more of the following three roles:
File-set Creator (FSC). Such an Application Entity, exercises this role by means of M-WRITE Operations to create the DICOMDIR File (see Section 8.6) and zero or more DICOM Files;
File-set Reader (FSR). Such an Application Entity, exercises this role by means of M-READ Operations to access one or more Files in a File-set. A File-set Reader shall not modify any of the files of the File-set (including the DICOMDIR File);
File-set Updater (FSU). Such an Application Entity, exercises this role by means of M-READ, M-WRITE, and M-DELETE Operations. It reads, but shall not modify, the content of any of the DICOM files in a File-set except for the DICOMDIR File. It may create additional Files by means of an M-WRITE or delete existing Files in a File-set by means of an M-DELETE.
Note
Although a File-set Updater (FSU) may include the functions corresponding to a File-set Creator (FSC) and a File-set Reader (FSR), it is not required that implementations supporting an FSU role also support an FSC or an FSR role.
The use of the concept of roles in DICOM Conformance Statements will result in a more precise expression of the capabilities of implementations supporting DICOM Media Storage. Conforming implementations shall support one of the following choices:
File-set Creator,
File-set Reader,
File-set Creator and File-set Reader,
File-set Updater,
File-set Updater and File-set Creator,
File-set Updater and File-set Reader,
File-set Updater, File-set Creator and File-set Reader.
Based on the roles supported by a DICOM Application Entity, the DICOM File Service shall support the Media Operations defined in Table 8.3-1.
Table 8.3-1. Media Operations and Roles
Media Operations Roles | M-WRITE | M-READ | M-DELETE | M-INQUIRE FILE-SET | M-INQUIRE FILE |
---|---|---|---|---|---|
FSC | Mandatory | Not required | Not required | Mandatory | Not required |
FSR | Not required | Mandatory | Not required | Not required | Mandatory |
FSC+FSR | Mandatory | Mandatory | Not required | Mandatory | Mandatory |
FSU | Mandatory | Mandatory | Mandatory | Mandatory | Mandatory |
FSU+FSC | Mandatory | Mandatory | Mandatory | Mandatory | Mandatory |
FSU+FSR | Mandatory | Mandatory | Mandatory | Mandatory | Mandatory |
FSU+FSC+FSR | Mandatory | Mandatory | Mandatory | Mandatory | Mandatory |

Create Dicomdir From Dicom Files Software
Note
Create Dicomdir From Dicom Files
Media Preparation is outside the scope of this Part of the DICOM Standard. However it is assumed to be performed by the FS Creator.
The DICOM File Service does not require that file update capabilities (e.g., append) be supported by every Media Format Definition selected. The non-support of such file update capabilities to the DICOMDIR File may simply result in having to delete and create a new file in order to keep the directory information consistent.
If the content of a file needs to be updated or changed by an FSU, it is considered by this Part of the DICOM Standard as an M-DELETE Operation followed by an M-WRITE Operation. The FSU is responsible for ensuring the internal consistency of the File and its conformance to PS3.10 and the specific SOP Class stored, exactly as if the FSU was creating a new File. In particular, if an FSU implementation needs to update the file content but is not able to recognize and fully process the content of the File Preamble (see Section 7.1), it may consider setting the first four bytes of the Preamble to 'DICM' followed by 124 bytes to 00H. This would avoid introducing inconsistencies between the content of the File Preamble and the remainder of the file content. An example of this situation may occur when a TIFF IFD 0 Offset in the File Preamble points at a further TIFF IFD embedded in the DICOM Data Set, and the update operation changes the location of this embedded TIFF IFD.