ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Imageen and ordering dicom tags
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

jwest

Brazil
67 Posts

Posted - May 25 2016 :  14:59:05  Show Profile  Reply
Hi,

I am creating some dicom tags at runtime and saving into dicom file.
Here is my creation order:

    //AddTagXXX is similar to SetTagXXXX without check and replace
    Children := TObjectList.Create();
    //add patient tags
    subtags := TIEDicomTags.Create();
    with subtags do begin
     AddTagNumeric($4, $1400, 0);
     AddTagNumeric($4, $1410, 65535);
     AddTagNumeric($4, $1420, 0);
     AddTagString($4, $1430, 'PATIENT');
     //other patient tags added here 
     //study
     AddTagNumeric($4, $1400, 0);
     AddTagNumeric($4, $1410, 65535);
     AddTagNumeric($4, $1420, 0);
     AddTagString($4, $1430, 'STUDY');
     //other study tags added here 
 
    //serie
    AddTagNumeric($4, $1400, 0);
    AddTagNumeric($4, $1410, 65535);
    AddTagNumeric($4, $1420, 0);
    AddTagString($4, $1430, 'SERIES');
    //other serie tags added here 
 
    //image
   AddTagNumeric($4, $1400, 0);
   AddTagNumeric($4, $1410, 65535);
   AddTagNumeric($4, $1420, 0);
   AddTagString($4, $1430, 'IMAGE');
   AddTagString($4, $1500, sFileName);
  end;
  Children.Add(subtags);
  subtags.AddTag(4, $1220,dvSQ,nil,-1, Children);
  //here I Create a Stream and save the stream created to disk
  // using IEDicomWrite_init(stream ...) and IEDicomWrite_finalize(context) staffs. I also tried it using TImageEnVect and changing your tags to save after;
  //Stream.SaveToFile(fname);
  //Stream.free;


The problem is that after I save the dicom file and read back with inputoutput sample app from demo folder of ImageEn, I can see the tags I just create are grouped for group/element and my creation order is missing.

I expected the tags in the order I save them originally.

I know Imageen doesn´t support dicomdir.

But, I need just create a dicom file and save it with my tags saved in the order I just created.

Some help would be appreciated.

Luiz

xequte

38943 Posts

Posted - May 25 2016 :  17:37:09  Show Profile  Reply
Hi Luiz

To maintain your insertion sequence set the Sorted property to false in the 6.3.1 beta.

  Children := TObjectList.Create();
  SubTags := TIEDicomTags.Create();
  SubTags.Sorted := false;

  SubTags.SetTagNumeric( $4, $1400, 0, False );
  SubTags.SetTagNumeric( $4, $1410, 65535, False );
  SubTags.SetTagNumeric( $4, $1420, 0, False );
  SubTags.SetTagString( $4, $1430, 'PATIENT', False );

  SubTags.SetTagNumeric( $4, $1400, 0, False );
  SubTags.SetTagNumeric( $4, $1410, 65535, False );
  SubTags.SetTagNumeric( $4, $1420, 0, False );
  SubTags.SetTagString( $4, $1430, 'STUDY', False );

  SubTags.SetTagNumeric( $4, $1400, 0, False );
  SubTags.SetTagNumeric( $4, $1410, 65535, False );
  SubTags.SetTagNumeric( $4, $1420, 0, False );
  SubTags.SetTagString( $4, $1430, 'SERIES', False );

  SubTags.SetTagNumeric( $4, $1400, 0, False );
  SubTags.SetTagNumeric( $4, $1410, 65535, False );
  SubTags.SetTagNumeric( $4, $1420, 0, False );
  SubTags.SetTagString( $4, $1430, 'IMAGE', False );
  SubTags.SetTagString( $4, $1500, 'C:\FileName.jpg', False );

  Children.Add( SubTags );
  ImageEnMView1.MIO.Params[0].DICOM_Tags.AddTag( 4, $1220, dvSQ, nil, -1, Children );



Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

jwest

Brazil
67 Posts

Posted - May 27 2016 :  07:23:15  Show Profile  Reply
I did an update and now, I can show my tags before save in dicom file and the tags read with dicom sample in inoputoutput folder:
My tags just before save the dicom file:

(0002,0000) File Meta Information Group Length (UL) : "0"
(0002,0001) File Meta Information Version (OB) : ""
(0002,0010) Transfer Syntax UID (UI) : "1.2.840.10008.1.2.1"
(0004,1220) Directory Record Sequence (SQ) : ""
(0004,1400) Offset of the Next Directory Record (UL) : "0"
(0004,1410) Record In-use Flag (US) : "65535"
(0004,1420) Offset of Referenced Lower-Level Directory Entity (UL) : "0"
(0004,1430) Directory Record Type (CS) : "PATIENT "
(0010,0010) Patient's Name (PN) : "Doe^John"
(0010,0020) Patient ID (LO) : "Genesis-1000"
(0010,0030) Patient's Birth Date (DA) : "19501214"
(0010,0040) Patient's Sex (CS) : "O "
(0004,1400) Offset of the Next Directory Record (UL) : "0"
(0004,1410) Record In-use Flag (US) : "65535"
(0004,1420) Offset of Referenced Lower-Level Directory Entity (UL) : "0"
(0004,1430) Directory Record Type (CS) : "STUDY "
(0008,0020) Study Date (DA) : "20091214"
(0008,0030) Study Time (TM) : "160058.0"
(0008,0050) Accession Number (SH) : " "
(0008,1030) Study Description (LO) : "Chest "
(0020,000D) Study Instance UID (UI) : "1.2.410.200013.1.215.1.200912141600580008"
(0020,0010) Study ID (SH) : "unknown "
(0004,1400) Offset of the Next Directory Record (UL) : "0"
(0004,1410) Record In-use Flag (US) : "65535"
(0004,1420) Offset of Referenced Lower-Level Directory Entity (UL) : "0"
(0004,1430) Directory Record Type (CS) : "SERIES"
(0008,0021) Series Date (DA) : "20091214"
(0008,0031) Series Time (TM) : "160058.0"
(0008,0060) Modality (CS) : "SC"
(0020,000E) Series Instance UID (UI) : "1.2.410.200013.1.215.1.200912141600580009"
(0020,0011) Series Number (IS) : "1 "
(0020,000D) Study Instance UID (UI) : "1.2.410.200013.1.215.1.200912141600580008"
(0020,0010) Study ID (SH) : "unknown "
(0008,103E) Series Description (LO) : "unknown "
(0004,1400) Offset of the Next Directory Record (UL) : "0"
(0004,1410) Record In-use Flag (US) : "65535"
(0004,1420) Offset of Referenced Lower-Level Directory Entity (UL) : "0"
(0004,1430) Directory Record Type (CS) : "IMAGE "
(0004,1500) Referenced File ID (CS) : "FILE0.DCM "
(0020,0013) Instance Number (IS) : "1 "
(0008,0023) Content Date (DA) : "20091214"
(0008,0033) Content Time (TM) : "160058.0"
(0088,0200) Icon Image Sequence (SQ) : ""
(0028,0011) Columns (US) : "128"
(0028,0010) Rows (US) : "128"
(0028,0002) Samples per Pixel (US) : "1"
(0028,0004) Photometric Interpretation (CS) : "MONOCHROME2 "
(0028,0100) Bits Allocated (US) : "8"
(0028,0101) Bits Stored (US) : "8"
(0028,0102) High Bit (US) : "7"
(7FE0,0010) Pixel Data (OW) : ""
(0008,0016) SOP Class UID (UI) : "1.2.840.10008.5.1.4.1.1.7"
(0028,0002) Samples per Pixel (US) : "0"
(0028,0008) Number of Frames (IS) : "1 "
(0028,0010) Rows (US) : "0"
(0028,0011) Columns (US) : "192"
(0028,0103) Pixel Representation (US) : "0"
(0028,2110) Lossy Image Compression (CS) : "00"

tags read with dicom sample in inputoutput folder:
(0002,0000) File Meta Information Group Length (UL) : "42"
(0002,0001) File Meta Information Version (OB) : ""
(0002,0010) Transfer Syntax UID (UI) : "1.2.840.10008.1.2.1"
(0004,1220) Directory Record Sequence (SQ) : ""
(0004,1400) Offset of the Next Directory Record (UL) : "0"
(0004,1400) Offset of the Next Directory Record (UL) : "0"
(0004,1400) Offset of the Next Directory Record (UL) : "0"
(0004,1400) Offset of the Next Directory Record (UL) : "0"
(0004,1410) Record In-use Flag (US) : "65535"
(0004,1410) Record In-use Flag (US) : "65535"
(0004,1410) Record In-use Flag (US) : "65535"
(0004,1410) Record In-use Flag (US) : "65535"
(0004,1420) Offset of Referenced Lower-Level Directory Entity (UL) : "0"
(0004,1420) Offset of Referenced Lower-Level Directory Entity (UL) : "0"
(0004,1420) Offset of Referenced Lower-Level Directory Entity (UL) : "0"
(0004,1420) Offset of Referenced Lower-Level Directory Entity (UL) : "0"
(0004,1430) Directory Record Type (CS) : "PATIENT "
(0004,1430) Directory Record Type (CS) : "IMAGE "
(0004,1430) Directory Record Type (CS) : "SERIES"
(0004,1430) Directory Record Type (CS) : "STUDY "
(0004,1500) Referenced File ID (CS) : "FILE0.DCM "
(0008,0020) Study Date (DA) : "20091214"
(0008,0021) Series Date (DA) : "20091214"
(0008,0023) Content Date (DA) : "20091214"
(0008,0030) Study Time (TM) : "160058.0"
(0008,0031) Series Time (TM) : "160058.0"
(0008,0033) Content Time (TM) : "160058.0"
(0008,0050) Accession Number (SH) : " "
(0008,0060) Modality (CS) : "SC"
(0008,1030) Study Description (LO) : "Chest "
(0008,103E) Series Description (LO) : "unknown "
(0010,0010) Patient's Name (PN) : "Doe^John"
(0010,0020) Patient ID (LO) : "Genesis-1000"
(0010,0030) Patient's Birth Date (DA) : "19501214"
(0010,0040) Patient's Sex (CS) : "O "
(0020,000D) Study Instance UID (UI) : "1.2.410.200013.1.215.1.200912141600580008"
(0020,000D) Study Instance UID (UI) : "1.2.410.200013.1.215.1.200912141600580008"
(0020,000E) Series Instance UID (UI) : "1.2.410.200013.1.215.1.200912141600580009"
(0020,0010) Study ID (SH) : "unknown "
(0020,0010) Study ID (SH) : "unknown "
(0020,0011) Series Number (IS) : "1 "
(0020,0013) Instance Number (IS) : "1 "
(0088,0200) Icon Image Sequence (SQ) : ""
(0028,0002) Samples per Pixel (US) : "1"
(0028,0004) Photometric Interpretation (CS) : "MONOCHROME2 "
(0028,0010) Rows (US) : "128"
(0028,0011) Columns (US) : "128"
(0028,0100) Bits Allocated (US) : "8"
(0028,0101) Bits Stored (US) : "8"
(0028,0102) High Bit (US) : "7"
(7FE0,0010) Pixel Data (OW) : ""
(0008,0016) SOP Class UID (UI) : "1.2.840.10008.5.1.4.1.1.7"
(0028,0002) Samples per Pixel (US) : "0"
(0028,0008) Number of Frames (IS) : "1 "
(0028,0010) Rows (US) : "0"
(0028,0011) Columns (US) : "192"

The wrong(??) dicom file is attached.

Please, can you looking at the two next dicom files to see what is wrong?

Why the first file is read wrong and the second is read ok with dicom sample in inputoutput folder?

I tried see what is wrong but I didn´t had success.

Luiz

Wrong dicomdir created with imageen showing with dicom sample in inputoutput folder:

attach/jwest/20165277249_DICOMDIR.zip
983 Bytes

The next dicomdir file shows correctly into dicom sample in inputoutput folder(created with dcmcache app):

attach/jwest/201652792942_dicomdir.zip
13.61 KB
Go to Top of Page

xequte

38943 Posts

Posted - Jun 06 2016 :  20:08:45  Show Profile  Reply
Hi

Please email me for the latest source. We've made a number of changes to DICOM meta data handling.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

jwest

Brazil
67 Posts

Posted - Jun 07 2016 :  15:18:59  Show Profile  Reply
Hi,

Thank you but, the sorted property will affect all tags already inserted or only the current tags being inserted/added?

Luiz
Go to Top of Page

xequte

38943 Posts

Posted - Jun 07 2016 :  21:26:37  Show Profile  Reply
Hi Luiz

Only the tags being added.


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: