Invalid sop instance uid - bad Dicom file

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
bkasmai
Posts: 20
Joined: Tue, 2009-07-28, 11:48

Invalid sop instance uid - bad Dicom file

#1 Post by bkasmai »

The Dicom documentation(https://dicom.nema.org/dicom/2013/outpu ... ter_B.html) states that:
Because of the flexibility allowed by the DICOM Standard in creating organizationally derived UIDs, implementations should not depend on any assumed structure of UIDs and should not attempt to parse UIDs to extract the semantics of some of its components."
I have anonymised a study and changed its sop instance uid using a private SOP Instance UID for re-export to PACS for teaching purposes. I get the following error:


dcmsend -v -r -aet MYSCPU -aec PACSSCP 10.145.92.63 4006 test.dcm
I: checking input files ...
E: cannot add DICOM file to the transfer list: test.dcm: Invalid SOP Instance UID
F: bad DICOM file: test.dcm: Invalid SOP Instance UID

The study could be loaded to a few known Dicom browsers with no plroblem.

Any help on this would be appreciated.

Michael Onken
DCMTK Developer
Posts: 2048
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: Invalid sop instance uid - bad Dicom file

#2 Post by Michael Onken »

Hi,

can you post the generated UID? e.g. run dcmdump +P SOPInstanceUID <yourfile.dcm>

Best regards,
Michael

bkasmai
Posts: 20
Joined: Tue, 2009-07-28, 11:48

Re: Invalid sop instance uid - bad Dicom file

#3 Post by bkasmai »

dcmdump +P SOPInstanceUID test.dcm
(0008,0018) UI [1.2.826.0.1.3680043.2.1012.00.637.30.08.2022.11.45.50] # 54, 1 SOPInstanceUID

Thanks for looking into this.

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Invalid sop instance uid - bad Dicom file

#4 Post by J. Riesmeier »

The ".00." in the UID is not allowed. It violates the definition of the "Unique Identifier" (UI) Value Representation.

bkasmai
Posts: 20
Joined: Tue, 2009-07-28, 11:48

Re: Invalid sop instance uid - bad Dicom file

#5 Post by bkasmai »

Thank you! Mystery solved!

bkasmai
Posts: 20
Joined: Tue, 2009-07-28, 11:48

Re: Invalid sop instance uid - bad Dicom file

#6 Post by bkasmai »

I am puzzled. My applcation only changes Study and Series Instance UID. I think the SOPInstanceUId is changed by Pydicom package which is supposed to be the bread and butter of medical image datasets!

bkasmai
Posts: 20
Joined: Tue, 2009-07-28, 11:48

Re: Invalid sop instance uid - bad Dicom file

#7 Post by bkasmai »

Sorry, ignore my last message. Nothing to do with pydicom, I am a lousy programmer!

bkasmai
Posts: 20
Joined: Tue, 2009-07-28, 11:48

Re: Invalid sop instance uid - bad Dicom file

#8 Post by bkasmai »

Sorry to reopen this again. I changed the program to avoid .00. but still the same problem
dcmdump +P SOPInstanceUID test.dcm
(0008,0018) UI [1.2.826.0.1.3680043.2.1012.0.542.06.09.2022.10.50.16] # 52, 1 SOPInstanceUID

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: Invalid sop instance uid - bad Dicom file

#9 Post by J. Riesmeier »

Leading zeros ("0") are also not allowed, e.g. in ".06.09.". See UID Encoding Rules in DICOM PS3.5.

bkasmai
Posts: 20
Joined: Tue, 2009-07-28, 11:48

Re: Invalid sop instance uid - bad Dicom file

#10 Post by bkasmai »

So did i misunderstand the quote below from Dicom documentation?
implementations should not depend on any assumed structure of UIDs and should not attempt to parse UIDs to extract the semantics of some of its components

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1437
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

Re: Invalid sop instance uid - bad Dicom file

#11 Post by Marco Eichelberg »

That quote only means that applications are not supposed to read meaning into the structure of the UIDs (e.g. they must not assume that UID 1.2.3.4 is in any way related to UID 1.2.3). That does not prevent an application to check whether or not a UID is syntactically valid, i.e. contains no leading zeroes, is not longer than 64 characters, uses a zero byte instead of a space character as a pad byte if necessary.

bkasmai
Posts: 20
Joined: Tue, 2009-07-28, 11:48

Re: Invalid sop instance uid - bad Dicom file

#12 Post by bkasmai »

Thank you for your help. This was educational for me.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], Semrush [Bot] and 1 guest