Updated dicom plugin to solve problems with import into external programs (e.g. OsiriX)

This commit is contained in:
Dov Grobgeld 2013-05-19 23:53:33 +03:00
parent b2f318de57
commit 91b51117fe
1 changed files with 25 additions and 5 deletions

View File

@ -18,7 +18,7 @@
/* /*
* The dicom reading and writing code was written from scratch * The dicom reading and writing code was written from scratch
* by Dov Grobgeld. (dov@imagic.weizman.ac.il). * by Dov Grobgeld. (dov.grobgeld@gmail.com).
*/ */
#include "config.h" #include "config.h"
@ -1218,12 +1218,17 @@ dicom_ensure_required_elements_present (GSList *elements,
/* 0002, 0001 - File Meta Information Version */ /* 0002, 0001 - File Meta Information Version */
{ 0x0002, 0x0001, "OB", 2, (guint8 *) "\0\1" }, { 0x0002, 0x0001, "OB", 2, (guint8 *) "\0\1" },
/* 0002, 0010 - Transfer syntax uid */ /* 0002, 0010 - Transfer syntax uid */
{ 0x0002, 0x0001, "UI", { 0x0002, 0x0010, "UI",
strlen ("1.2.840.10008.1.2.1"), (guint8 *) "1.2.840.10008.1.2.1"}, strlen ("1.2.840.10008.1.2.1"), (guint8 *) "1.2.840.10008.1.2.1"},
/* 0002, 0013 - Implementation version name */ /* 0002, 0013 - Implementation version name */
{ 0x0002, 0x0013, "SH", { 0x0002, 0x0013, "SH",
strlen ("GIMP Dicom Plugin 1.0"), (guint8 *) "GIMP Dicom Plugin 1.0" }, strlen ("GIMP Dicom Plugin 1.0"), (guint8 *) "GIMP Dicom Plugin 1.0" },
/* Identifying group */ /* Identifying group */
/* ImageType */
{ 0x0008, 0x0008, "CS",
strlen ("ORIGINAL\\PRIMARY"), (guint8 *) "ORIGINAL\\PRIMARY" },
{ 0x0008, 0x0016, "UI",
strlen ("1.2.840.10008.5.1.4.1.1.7"), (guint8 *) "1.2.840.10008.5.1.4.1.1.7" },
/* Study date */ /* Study date */
{ 0x0008, 0x0020, "DA", { 0x0008, 0x0020, "DA",
strlen (today_string), (guint8 *) today_string }, strlen (today_string), (guint8 *) today_string },
@ -1236,14 +1241,23 @@ dicom_ensure_required_elements_present (GSList *elements,
/* Content Date */ /* Content Date */
{ 0x0008, 0x0023, "DA", { 0x0008, 0x0023, "DA",
strlen (today_string), (guint8 *) today_string}, strlen (today_string), (guint8 *) today_string},
/* Modality - I have to add something.. */ /* Content Time */
{ 0x0008, 0x0030, "TM",
strlen ("000000.000000"), (guint8 *) "000000.000000"},
/* AccessionNumber */
{ 0x0008, 0x0050, "SH", strlen (""), (guint8 *) "" },
/* Modality */
{ 0x0008, 0x0060, "CS", strlen ("MR"), (guint8 *) "MR" }, { 0x0008, 0x0060, "CS", strlen ("MR"), (guint8 *) "MR" },
/* ConversionType */
{ 0x0008, 0x0064, "CS", strlen ("WSD"), (guint8 *) "WSD" },
/* ReferringPhysiciansName */
{ 0x0008, 0x0090, "PN", strlen (""), (guint8 *) "" },
/* Patient group */ /* Patient group */
/* Patient name */ /* Patient name */
{ 0x0010, 0x0010, "PN", { 0x0010, 0x0010, "PN",
strlen ("DOE^WILBER"), (guint8 *) "DOE^WILBER" }, strlen ("DOE^WILBER"), (guint8 *) "DOE^WILBER" },
/* Patient ID */ /* Patient ID */
{ 0x0010, 0x0020, "CS", { 0x0010, 0x0020, "LO",
strlen ("314159265"), (guint8 *) "314159265" }, strlen ("314159265"), (guint8 *) "314159265" },
/* Patient Birth date */ /* Patient Birth date */
{ 0x0010, 0x0030, "DA", { 0x0010, 0x0030, "DA",
@ -1251,6 +1265,12 @@ dicom_ensure_required_elements_present (GSList *elements,
/* Patient sex */ /* Patient sex */
{ 0x0010, 0x0040, "CS", strlen (""), (guint8 *) "" /* unknown */ }, { 0x0010, 0x0040, "CS", strlen (""), (guint8 *) "" /* unknown */ },
/* Relationship group */ /* Relationship group */
/* StudyId */
{ 0x0020, 0x0010, "IS", strlen ("1"), (guint8 *) "1" },
/* SeriesNumber */
{ 0x0020, 0x0011, "IS", strlen ("1"), (guint8 *) "1" },
/* AcquisitionNumber */
{ 0x0020, 0x0012, "IS", strlen ("1"), (guint8 *) "1" },
/* Instance number */ /* Instance number */
{ 0x0020, 0x0013, "IS", strlen ("1"), (guint8 *) "1" }, { 0x0020, 0x0013, "IS", strlen ("1"), (guint8 *) "1" },
@ -1576,7 +1596,7 @@ add_tag_pointer (GByteArray *group_stream,
*/ */
if (strstr ("UI|OB", value_rep) != NULL) if (strstr ("UI|OB", value_rep) != NULL)
{ {
g_byte_array_append (group_stream, (guint8 *) 0x0000, 1); g_byte_array_append (group_stream, (guint8 *) "\0", 1);
} }
else else
{ {