Unable to retrieve a single string value

42 views
Skip to first unread message

Picasso

unread,
Aug 30, 2024, 7:53:26 PM8/30/24
to Fellow Oak DICOM

I am running into an issue that I am searching for second opinion.

I have a DCM file that I would like to retrieve some values.

The following  code  works:

 

var sopUID = dicomDataset.GetSingleValueOrDefault<string>(DicomTag.SOPInstanceUID, "");

if (sopUID == "")

{

    sopUID = "(not set/found)";

}

 

editing code also works for retrieving:

  • DicomTag.SOPInstanceUID
  • DicomTag.StudyInstanceUID
  • DicomTag.FrameOfReferenceUID

However, when trying to retrieve DicomTag.MediaStorageSOPInstanceUID:

var sopInstUID = dicomDataset.GetSingleValueOrDefault<string>(DicomTag.MediaStorageSOPInstanceUID, "");

if (sopInstUID == "")

{

    sopInstUID = "(not set/found)";

}

always returns not set/found

Same behavior for “DicomTag.ImplementationClassUID”

Why can't I read these values?

arnon dukeman

unread,
Sep 1, 2024, 2:19:20 AM9/1/24
to Fellow Oak DICOM
Most probably the DCM file does not contain the 0002 group.
example:
(0002,0000) Group Length                                     VR: UL Length: 4  Value: 198
(0002,0001) File Meta Information Version                   VR: OB Length: 2  Value: 0
(0002,0002) Media Storage SOP Class UID                     VR: UI Length: 26  Value: 1.2.840.10008.5.1.4.1.1.4
(0002,0003) Media Storage SOP Instance UID                   VR: UI Length: 58  Value: 1.2.528.1.1001.100.4.4817.4013.113246216.20121031212851640
(0002,0010) Transfer Syntax UID                             VR: UI Length: 20  Value: 1.2.840.10008.1.2.1
....

(0008,0016) SOP Class UID                                   VR: UI Length: 26  Value: 1.2.840.10008.5.1.4.1.1.4
(0008,0018) SOP Instance UID                                 VR: UI Length: 58  Value: 1.2.528.1.1001.100.4.4817.4013.113246216.20121031212851640

ב-יום שבת, 31 באוגוסט 2024 בשעה 02:53:26 UTC+3, Picasso כתב/ה:

Picasso

unread,
Sep 1, 2024, 1:16:35 PM9/1/24
to Fellow Oak DICOM

Many thanks for the prompt reply.

The file seems to have the Group Length values.


dcmFile.jpg

Reinhard Gruber

unread,
Sep 19, 2025, 2:48:17 AMSep 19
to Fellow Oak DICOM
It's exactly how  dukema...@gmail.com had posted:
the 0002 group is not part of the DicomDataset. 

DicomDatasets are the objects that hold all the informations. they are sent via network or can be stored on file. 
In case they are stored in file, then first a Dicom File Meta Information has to be written into the file (the group 0002) https://dicom.nema.org/dicom/2013/output/chtml/part10/chapter_7.html, and then after that Dicom File Meta Information the actual Dicom Dataset is written.

So when opening a DicomFile, then this DicomFile has two properties: DicomDataset, that contains the actual dicom data, and FileMetaInfo, which contains all the tags from group 0002.
Reply all
Reply to author
Forward
0 new messages