write Jpeg image file into dicom file format

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
junaid
Posts: 7
Joined: Fri, 2006-04-28, 11:51

write Jpeg image file into dicom file format

#1 Post by junaid » Sat, 2006-04-29, 06:31

hello
how can i write jpeg file into dicom using dcmtk.i recently start work on DCMTK library so i m beginner and i have no idea how to deal with jpeg images.Is there are some specific function that can load jpeg file and write into dicom file format.

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

#2 Post by Michael Onken » Tue, 2006-05-02, 10:40

Hi,

there is no read-to-use tool in DCMTK to convert JPEG files to DICOM. You could write a tool on your own using the functions integrated mainly in dcmdata. Try to search the forum and look at the corresponding FAQ Entry

Regards,
Michael

Alexander Fedotov
Posts: 53
Joined: Thu, 2005-04-14, 15:07
Location: St. Petersburg, Russia

Re: write Jpeg image file into dicom file format

#3 Post by Alexander Fedotov » Tue, 2006-05-02, 14:48

[quote="junaid"]hello
how can i write jpeg file into dicom using dcmtk.i recently start work on DCMTK library so i m beginner and i have no idea how to deal with jpeg images.Is there are some specific function that can load jpeg file and write into dicom file format.[/quote]

1) Load jpeg file.
In MS Windows it can be done using gdiplus.dll

2) Get (create) image data

3) Use DCMTK to create and save DICOM file:

DcmFileFormat fileFormat;
DcmDataset *pDataset = fileFormat.getDataset();

// 0008 Group
// Add SOP Instance UID (0008,0018)
pDataset->putAndInsertString(DCM_SOPInstanceUID, Create_DICOM_UID());
// Add SOP Class UID (0008,0016)
pDataset->putAndInsertString(DCM_SOPClassUID, "1.2.840.10008.5.1.4.1.1.1");
....

pDataset->putAndInsertUint8Array(DCM_PixelData, pImageData, lSize);

fileFormat.saveFile(...);

junaid
Posts: 7
Joined: Fri, 2006-04-28, 11:51

how to get image data of a jpg file

#4 Post by junaid » Fri, 2006-05-05, 06:18

the procedure to write image data i understand from the viewtopic.php?t=56.But how can i get the image data of a jpeg image.If i choose c# to program then how can i get the image data using GDIPLUS.If i load the jpg file into Image type object then what can i do.If i program in c,c++ then where i start to get image data.

Alexander Fedotov
Posts: 53
Joined: Thu, 2005-04-14, 15:07
Location: St. Petersburg, Russia

Re: how to get image data of a jpg file

#5 Post by Alexander Fedotov » Fri, 2006-05-05, 07:39

[quote="junaid"]
If i program in c,c++ then where i start to get image data.
[/quote]

Use, for example CImage class, defined in atlimage.h.
All necessary documentation and examples
you can find in MSDN.

Regards,
Alexander.

junaid
Posts: 7
Joined: Fri, 2006-04-28, 11:51

#6 Post by junaid » Fri, 2006-05-05, 15:16

thank u Alexander Fedotov.
currently i using c# but i cannot find the way to get the image data but i load jpg file into image object.So pleasse let me tell how can i get image data in bytes to write it in dicom file.

Alexander Fedotov
Posts: 53
Joined: Thu, 2005-04-14, 15:07
Location: St. Petersburg, Russia

#7 Post by Alexander Fedotov » Sat, 2006-05-06, 08:53

[quote="junaid"]
currently i using c# but i cannot find the way to get the image data but i load jpg file into image object.So pleasse let me tell how can i get image data in bytes to write it in dicom file.[/quote]

Frankly say, I don't like C# :)
In gdiplus there is a Bitmap class wich is inherited from Image.
One can use Bitmap::GetPixel() or Bitmap::LockBits and BitmapData class.
I think there is the same way in C#.

Regards,
Alexander.

Post Reply

Who is online

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