Hi,
Is it possible to compress the image in memory the image object? In dcmcjpeg function where does the actual compression take place? Is it possible to save the file object to memory as opposed to directly to disk via saveFile()?
What methods should I use?
Sending image from memory
Moderator: Moderator Team
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
First of all, I would suggest that you read the relevant part of the documentation. The call to chooseRepresentation() does the trick.
The chooseRepresentation() function did do the compression but the problem that I find is that the transfer syntax is not getting in the dicom dataset itself until it is directly saved into file.
I tested with this code.
The output always comes out to be "The conversion did not happen."
How can I write the transfer syntax immediately after the image is compressed without saving into a file?
I tested with this code.
Code: Select all
dataset->chooseRepresentation(opt_oxfer, rp);
DcmXfer original_xfer2(dataset->getOriginalXfer());
if (original_xfer2.isNotEncapsulated())
printf("The conversion did not happen.\n");
else if (original_xfer2.isEncapsulated())
printf("Compression was successful.\n");
How can I write the transfer syntax immediately after the image is compressed without saving into a file?
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
Hi Jorg,
Thanks for your response. In general, I'd like to just compress the DcmFileFormat object in memory, then immediately transfer the object.
I find that if I load the uncompressed file, run the compression routine, save the file, then reload it, yes it is then interpreted as a compressed image. I check for this condition with the following code:
It seems that the isNotEncapsulated() function returns true after calling chooseRepresentation(), however if I save this same DcmFileFormat object to disk, reload it, and call isNotEncapsulated(), it does then return that it is compressed.
I'm wondering, what must I do in the dataset object after calling chooseRepresentation() for the rest of my routines to interpret the object as compressed?
Thanks
Thanks for your response. In general, I'd like to just compress the DcmFileFormat object in memory, then immediately transfer the object.
I find that if I load the uncompressed file, run the compression routine, save the file, then reload it, yes it is then interpreted as a compressed image. I check for this condition with the following code:
Code: Select all
DcmXfer original_xfer2(dataset->getOriginalXfer());
if (original_xfer2.isNotEncapsulated())
printf("The conversion did not happen.\n");
else if (original_xfer2.isEncapsulated())
printf("Compression was successful.\n");
I'm wondering, what must I do in the dataset object after calling chooseRepresentation() for the rest of my routines to interpret the object as compressed?
Thanks
-
- ICSMED DICOM Services
- Posts: 2217
- Joined: Fri, 2004-10-29, 21:38
- Location: Oldenburg, Germany
Who is online
Users browsing this forum: Baidu [Spider], Google [Bot] and 1 guest