creation of dicom with less size

Hello,

I am trying to reduce dicom file size when creating a new dicom by converting from bmp to png but I do not see the file size getting reduced, png use compession so logically I have less file size.

Best Regards
George

Hello @George_Z,

It is not clear what it is that you are attempting to do. Three file formats are mentioned in the post, DICOM, bmp and png. You can easily save an image to disk using these formats. Using the SimpleITK logo we read the image and save in each of the formats:

import SimpleITK as sitk

image = sitk.ReadImage("SimpleITK.jpg")

use_compression = True
sitk.WriteImage(image, "SimpleITK.dcm", use_compression)
sitk.WriteImage(image, "SimpleITK.bmp", use_compression)
sitk.WriteImage(image, "SimpleITK.png", use_compression)

Please provide additional details if this does not address your issue. For additional information and IO examples see this jupyter notebook, section titled Reading and Writing.

I am trying to generate a dicom file from png images with 22kb and I always get 8.2MB which is a very big dicom and I am trying to reduce that by converting to a proper number of samples per picture.

I do not want to use a compression because I am trying to get similar results to the original image which is 2.8MB. the transfer syntax is little endian, photometric interpretation is palaete color and depth of bits is 8.

Do you have a tool to convert the dicom to a different samples per pixel

Hello @George_Z,

All three component images in ITK/SimpleITK which use the GDCM library underneath the hood are saved using an “RGB” photometric interpretation, “0028|0004” (see code here), so unfortunately, you cannot save it using a value of “PALETTE COLOR”.

If you are looking for finer control of DICOM reading/writing, allowing you to configure all the settings, you can use packages that focus on that GDCM or pydicom.

Hello,

I can only use C++, so I noticed when I opened the dicom that it has many padding and spaces? do you have any idea to reduce that?
I noticed that it also not really valid to call on sample oer pixel as 3, so it must be corrupted.

Also, How do you recommend to craete a dicom from multiple png images

Best Regards
George

Hello @George_Z,

It is not clear what you mean by “has many padding and spaces”. With respect to samples per pixel as 3, that is a valid value when the photometric interpretation is set to RGB (see details here).

What exactly are you trying to do with the multiple png images? Based on your questions, it appears to be that you are looking for advanced control of the image writing process and that it be in C++. I would recommend that you go for GDCM and ask the questions on the GDCM mailing list.

Also, when asking a question you should provide as many details as you can so that someone can help you (programming language and specific task you want to perform).

1 Like