how can i get pixel data from a file in tag (7FE0,0010)

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
deepujames
Posts: 19
Joined: Wed, 2005-02-09, 08:44

how can i get pixel data from a file in tag (7FE0,0010)

#1 Post by deepujames »

Hi
I am creating a DcmTag() with group and element as (7FE0,0010)

how can I insert value of pixel data available in a file to this tag?

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#2 Post by Jörg Riesmeier »

For 8 bit pixel data (VR=OB) you could use something like the following (example taken from the documentation):

Code: Select all

dataset->putAndInsertUint8Array(DCM_PixelData, pixelData, pixelLength);
In order to get the value of the pixel data element use findAndGetUint8Array() accordingly.

deepujames
Posts: 19
Joined: Wed, 2005-02-09, 08:44

thanks for your help, how can i put sequence & valus 4datase

#3 Post by deepujames »

in the example given what is pixelData and pixelLength in function
putAndInsertUint8Array()
how can we provide pixel data to this program? Should we store it in a seperate file?
dataset->putAndInsertUint8Array(DCM_PixelData, pixelData, pixelLength);


How can I put values to a sequence like ref image sequence and put values to diffrent elements of the sequence (SOP class and Ist UID)
inside a dataset
dataset->putAndInsertStrig(DM_ReferencedImageSequence, "Doe^John");

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

#4 Post by Michael Onken »

Hi,

take a look at the API documentation for DcmItem shipped with your DCMTK release or online (class DcmItem). pixelData and pixelLength is documented there, too. You don't need (are not able) to load a speparate file directly into an element value.

Use findOrCreateSequenceItem() of class DcmItem to insert items in a sequence. To insert an element into an existing sequence item, use findAndGetSequenceItem() to get the item and insert elements into the resulting item like you did before with e.g. pixelData.

Regards,
Michael :)

deepujames
Posts: 19
Joined: Wed, 2005-02-09, 08:44

how to put data inside diffrent items in a sequence

#5 Post by deepujames »

Hi Michael
Thanks for your help. I am not getting a clear picture of sequence even now. I am able to create a sequence with findOrCreateSequenceItem(). I am able to explicitly specify the size of the sequence also.
But what ever DcmElement values i am putting inside a DcmItem object it is all going inside 1st Item. how can I add more items with diffrent elemnts in it. Like how can I insert into 4th item of sequence etc...Could you please demonstrate with an example?

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#6 Post by Jörg Riesmeier »

Here's an example from module "dcmsr":

Code: Select all

/* create a new item (and a sequence if required) */
result = dataset.findOrCreateSequenceItem(DCM_ReferencedSOPSequence, item, -2 /*append new*/);
if (result.good())
{
    /* store the instance level attributes */
    item->putAndInsertOFStringArray(DCM_ReferencedSOPClassUID, instance->SOPClassUID);
    item->putAndInsertOFStringArray(DCM_ReferencedSOPInstanceUID, instance->InstanceUID);
}
For more details please consult the documentation of the method.

Post Reply

Who is online

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