Skip to content

Scan the containing folder when a DICOMDIR is opened - #173

Open
loxK wants to merge 1 commit into
ayselafsar:masterfrom
Gecka-Apps:fix/dicomdir-folder-scan
Open

Scan the containing folder when a DICOMDIR is opened#173
loxK wants to merge 1 commit into
ayselafsar:masterfrom
Gecka-Apps:fix/dicomdir-folder-scan

Conversation

@loxK

@loxK loxK commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Opening a DICOMDIR returns an empty study list and a blank viewer.

A DICOMDIR holds no image of its own. It indexes the content of the media through its Directory Record Sequence (0004,1220) and carries none of the study, series and instance UIDs that generateDICOMJson() requires, so it is dropped at DisplayController.php:302:

if (!$StudyInstanceUID || !$SeriesInstanceUID || !$SOPInstanceUID) {
    // Skip if any of the required tags are missing
    continue;
}

Nothing tells users this cannot work. RegisterMimeType maps the dcm extension to application/dicom, so a DICOMDIR named *.dcm shows the app icon, opens in the viewer and gets the View button on a public share, exactly like an image would. It is also frequently the only file of a burned medical media carrying a readable name, the images around it having no extension at all, which keeps them out of the folder scan. That is the layout described in #108.

Opening a DICOMDIR now turns on the extensionless scan already used for folders and for public shares, so the files it indexes are picked up. Detection reads MediaStorageSOPClassUID (0002,0002) and compares it to 1.2.840.10008.1.3.10, the Media Storage Directory Storage SOP class.

Tested on Nextcloud 33, on an MR study of 343 instances laid out as images/pat00000/st000000/se00000X/mr0000XX, sitting next to 343 JPEG previews and a PDF report which are both discarded by is_dicom() before any parsing.

A DICOMDIR carries no image of its own: it indexes the content of the media
through its Directory Record Sequence, and holds none of the study, series and
instance UIDs generateDICOMJson() requires. Opening one therefore returned an
empty study list and a blank viewer.

Since the app registers the dcm extension as application/dicom, such a file
shows the app icon and opens in the viewer like any image, so nothing tells
users it cannot work. It is also the one file of a burned medical media that
carries a readable name, the images around it usually having no extension at
all, which keeps them out of the folder scan.

Opening a DICOMDIR now scans its folder with the extensionless mode already
used for folders and public shares, so the files it indexes are picked up.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant