write Jpeg image file into dicom file format
Moderator: Moderator Team
write Jpeg image file into dicom file format
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.
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.
-
- DCMTK Developer
- Posts: 2070
- Joined: Fri, 2004-11-05, 13:47
- Location: Oldenburg, Germany
- Contact:
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
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
-
- Posts: 53
- Joined: Thu, 2005-04-14, 15:07
- Location: St. Petersburg, Russia
Re: write Jpeg image file into dicom file format
[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(...);
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(...);
how to get image data of a jpg file
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.
-
- Posts: 53
- Joined: Thu, 2005-04-14, 15:07
- Location: St. Petersburg, Russia
Re: how to get image data of a jpg file
[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.
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.
-
- Posts: 53
- Joined: Thu, 2005-04-14, 15:07
- Location: St. Petersburg, Russia
[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.
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.
Who is online
Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest