Creating new DICOM file in memory and exporting.

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
anilta
Posts: 60
Joined: Thu, 2014-04-10, 08:50

Creating new DICOM file in memory and exporting.

#1 Post by anilta »

Hi, I am creating a new DICOM file from JPEG file. Without saving to disk, i am exporting the DICOM memory contents.
In the exported file in server, there is no meta header information and TransferSyntax is Unknown Transfer Syntax.
If i save to DISK, i see all the information.

Step 1: Create new DICOM file object.
-------
DcmFileFormat dfile;
DcmDataset *resultObject = dfile.getDataset();

Step 2: Then, using Image2Dcm, i get the DICOM file pixel data.
------
I2DOutputPlug *outPlug = new I2DOutputPlugSC();
I2DImgSource *inputPlug = new I2DJpegSource();
OFCondition cond = i2d.convert(inputPlug, outPlug, resultObject, writeXfer);

Step 3: Then export,
-------
OFCondition cond = DIMSE_storeUser(assoc, presID, &req,
NULL, resultObject, progressCallback, NULL,
m_blockMode, m_dimseTimeout,
&rsp, &statusDetail, NULL);

Am i missing any step here?

Regards,
Anil TA

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

Re: Creating new DICOM file in memory and exporting.

#2 Post by Michael Onken »

Hi Anil,

what's the error?

One possible reason could be that your dataset does not know it's own transfer syntax (based on pixel data); try calling updateOriginalXfer() on the dataset before trying to send it. In img2dcm this is not necessary since we tell saveFile() directly which transfer syntax to use.

Best,
Michael

anilta
Posts: 60
Joined: Thu, 2014-04-10, 08:50

Re: Creating new DICOM file in memory and exporting.

#3 Post by anilta »

Thanks Michael. Using updateOriginalXfer() did not solve the problem.

When i transfer in-memory contents, i get the file dump as,
.........................................................................................................................
# Dicom-File-Format

# Dicom-Meta-Information-Header
# Used TransferSyntax: Unknown Transfer Syntax

# Dicom-Data-Set
# Used TransferSyntax: Little Endian Explicit
(0008,0005) CS [ISO_IR 100] # 10, 1 SpecificCharacterSet
(0008,0016) UI =SecondaryCaptureImageStorage # 26, 1 SOPClassUID
.........................................................................................................................

When i save the memory contents to disk as a file,
.........................................................................................................................
# Dicom-Meta-Information-Header
# Used TransferSyntax: Little Endian Explicit
(0002,0000) UL 200 # 4, 1 FileMetaInformationGroupLength
(0002,0001) OB 00\01 # 2, 1 FileMetaInformationVersion
(0002,0002) UI =SecondaryCaptureImageStorage # 26, 1 MediaStorageSOPClassUID
(0002,0003) UI [1.2.276.0.7230010.3.1.4.1205869540.3592.1448037364.764] # 54, 1 MediaStorageSOPInstanceUID
(0002,0010) UI =JPEGBaseline # 22, 1 TransferSyntaxUID
(0002,0012) UI [1.2.276.0.7230010.3.0.3.6.1] # 28, 1 ImplementationClassUID
(0002,0013) SH [OFFIS_DCMTK_361] # 16, 1 ImplementationVersionName

# Dicom-Data-Set
# Used TransferSyntax: JPEG Baseline
(0008,0005) CS [ISO_IR 100] # 10, 1 SpecificCharacterSet
(0008,0016) UI =SecondaryCaptureImageStorage # 26, 1 SOPClassUID
.........................................................................................................................

anilta
Posts: 60
Joined: Thu, 2014-04-10, 08:50

Re: Creating new DICOM file in memory and exporting.

#4 Post by anilta »

Hi Michael,

I was testing this scenario using JDicom server. This seems to be a bug in JDicom :)
I tested in storescp tool, the meta information is generated.

Also, thanks for suggesting me to us updateOriginalXfer() for memory created DICOM file.
I missed this function call in my implementation.

Thanks,
Anil TA
GE Healthcare

avpai
Posts: 7
Joined: Fri, 2016-02-26, 08:21

Re: Creating new DICOM file in memory and exporting.

#5 Post by avpai »

Hey can you provide me with the code of the conversion?
I am trying something similar. I have a bmp file that i need to convert to dicom, and I a have a separate dataset stored in the memory to update the tags on the new dicom image.

Post Reply

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest