LEADTOOLS Support
General
General Questions
"Compressing" DICOM files without losing tags?
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Thursday, June 5, 2008 9:58:28 AM(UTC)
Groups: Registered
Posts: 5
I'm fairly new to LEADTools. I've got an application which needs to compress image files before transmission. Mostly we're dealing with JPEG and DICOM files. I'm using the LEADTools main OCX control and the Load and Save methods. I load the image file and then save it using an appropriate Quality Factor. For DICOM files, I change the saved file format to the appropriate DICOM JPEG compression format (FILE_DICOM_JPEG_GRAY or FILE_DICOM_JPEG_COLOR). Our DICOM files have custom tags in them.
What we're finding is that in the case of the DICOM files, the non-standard tags are being lost. From what I've read of DICOM, it is not really an image file format, it's a tagged data storage format, and one of the tagged elements can be an image. I assume that the Load/Save API is treating it as an image file, and only loading/saving the image element, resulting in the loss of the other tags.
A couple of questions. The generic image Load/Save "view" has a concept of Comments for an image. For DICOM files, do these correspond to the non-image tags in the DICOM file? If so, would reading the comments from the orginal file and inserting them in the Comments property before saving result in all the tags being transferred to the new file? Or am I going to have to deal with this via the DICOM API?
If the latter, what's the best way of avoiding overwriting the compressed image? I.e. if I merely load the whole dataset from the original file, and write it to the output file, I may overwrite the compressed image element in the output file with the original, uncompressed image (as the image is one of the elements in the dataset). Would it be viable to load the dataset from the original DICOM file, load another dataset from the new, compressed DICOM file, move the compressed image element in place of the uncompressed image element in the first dataset, and the save the first dataset into the new file?
I'm trying to figure out a fairly uncomplicated way of getting this done, and being new to LEADTools means I'm not quite sure what tools are available to me for this.
#2
Posted
:
Sunday, June 8, 2008 11:28:44 PM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
The imaging part of our toolkits mainly deals with the pixel
data (bitmap images). It is not meant for handling other parts of the DICOM
data set. To build a medical application, you must use the DICOM Data Set group
of functions or objects in LEADTOOLS.
The tags of the data set are either volatile or
non-volatile. The volatile tags are directly related to the image (like width,
height, resolution, compression, etc.), these tags will be updated by the
toolkit when a new DICOM data set is generated. It is strongly recommended that
you don't try to modify these tags.
Non-volatile tags (like patient name, sex, age, address,
etc.) are safe to be modified.
If you want to recompress the image without losing the
non-volatile tags, then you can use the ChangeTransferSyntax function. Volatile
tags will be updated to match the new image compression.
Do you have a DICOM dataset? If yes, what does it contain,
and what exactly do you want it to contain?
Is the image to be compressed already in the DICOM Data Set,
or is it in a second data set, or is it in an image (non-DICOM) file?
#3
Posted
:
Friday, June 13, 2008 8:33:42 AM(UTC)
Groups: Registered
Posts: 5
Yasir Alani wrote:If you want to recompress the image without losing the
non-volatile tags, then you can use the ChangeTransferSyntax function. Volatile
tags will be updated to match the new image compression.
Do I understand that this function actually performs the compression? I.e. I can call this function using UID_JPEG2000 as the UID, and the image in the dataset will be changed to JPEG2000 using the specified quality factor?
I'm a bit wary of the warning 'After this function is called all previous references to data elements in the
data set will no longer be valid.', but I presume this is talking about references from variables outside the dataset object.
Do you have a DICOM dataset? If yes, what does it contain,
and what exactly do you want it to contain?
Yes, it contains an image, and a number of custom Veterinary-related elements
Is the image to be compressed already in the DICOM Data Set,
or is it in a second data set, or is it in an image (non-DICOM) file?
It is in the same dataset.
#4
Posted
:
Sunday, June 15, 2008 3:33:35 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
The ChangeTransferSyntax function will only change the compression of a dicom file image and will update volatile tags only. The non-volatile tags (such as patient name, sex, age) will be copied unchanged to the new dicom file.
Since you want to change the compression of an image which is already in a dicom file, then this function should work for you.
LEADTOOLS Support
General
General Questions
"Compressing" DICOM files without losing tags?
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.