RGB pixel value
Moderator: Moderator Team
RGB pixel value
Hi,
I need to obtain the RGB value of a RGB DICOM Image pixel.
I've my DicomImage and I create my Canvas Image with getOuputData() function. The problem is that I lost the original pixel data when I scale my Canvas Image.
With MONOCHROME DICOM image I can get the original pixel value with getInterData().
How can I obtain the original RGB pixel data from my DicomImage ?
I need to obtain the RGB value of a RGB DICOM Image pixel.
I've my DicomImage and I create my Canvas Image with getOuputData() function. The problem is that I lost the original pixel data when I scale my Canvas Image.
With MONOCHROME DICOM image I can get the original pixel value with getInterData().
How can I obtain the original RGB pixel data from my DicomImage ?
-
- DCMTK Developer
- Posts: 2506
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
-
- DCMTK Developer
- Posts: 2506
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
No, getInterData() returns a pointer to an DiPixel object which has various get methods. For color images, you get direct access to the internal pixel data array:
I know that I already wrote that many times in other similar postings: getInterData() is not the preferred way of accessing the pixel data. This "hack" has only been introduced because many people asked for direct access to "raw data" of CT images (i.e. Hounsfield Units). I don't see any use case for color images (unless you convince me).
Code: Select all
/// pointer to pixel data (3 components)
T *Data[3];
Yes, I'm sorry....
the getInterDat() returns a DiPixel * which has:
getData() to retrieve a pointer to pixel data.
I've seen that for RGB images this pixelData has the size of ( image->width() * image->height()), so I've seen that this pixelData is not the complete array of all RGB pixel data ( but only the first plane).
The getDataArrayPtr() get pointer to array of pixel data. The number of planes in the returned array can be determined using 'getPlanes()'.
I think this is the correct array of all three RGB planes....but I can't use the getDataArrayPtr().
I use the getInterData() to get the value of Monochrome DICOM Images, but I can't for RGB images.
So my question is....to get the RGB value of the nth pixel of a RGB Dicom image...which is the correct procedure ?
the getInterDat() returns a DiPixel * which has:
getData() to retrieve a pointer to pixel data.
I've seen that for RGB images this pixelData has the size of ( image->width() * image->height()), so I've seen that this pixelData is not the complete array of all RGB pixel data ( but only the first plane).
The getDataArrayPtr() get pointer to array of pixel data. The number of planes in the returned array can be determined using 'getPlanes()'.
I think this is the correct array of all three RGB planes....but I can't use the getDataArrayPtr().
I use the getInterData() to get the value of Monochrome DICOM Images, but I can't for RGB images.
So my question is....to get the RGB value of the nth pixel of a RGB Dicom image...which is the correct procedure ?
-
- DCMTK Developer
- Posts: 2506
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
I use the getOutputData to obtain the pixelData of the DICOM Image.
I use this pixel data to create my canvas image.
I make some operation to this canvas image ( for instance, I zoom the canvas and I apply some smoothing to it), so I lost the original pixel data.
The problem is that If I get the nth RGB pixel value to the smoothed canvas image, I don't obtain the same value to the original RGB Image.
So, If I want to know the original RGB pixel data, I've only the DicomImage reference and I don't want to use getOutputData() ( I want to avoid the memory allocation of another pixel data).
The DicomImage internally has a reference of its pixel data...so I want to obtain this...
I'm very sorry for my bad English...I hope you can understand my problem!
I use this pixel data to create my canvas image.
I make some operation to this canvas image ( for instance, I zoom the canvas and I apply some smoothing to it), so I lost the original pixel data.
The problem is that If I get the nth RGB pixel value to the smoothed canvas image, I don't obtain the same value to the original RGB Image.
So, If I want to know the original RGB pixel data, I've only the DicomImage reference and I don't want to use getOutputData() ( I want to avoid the memory allocation of another pixel data).
The DicomImage internally has a reference of its pixel data...so I want to obtain this...
I'm very sorry for my bad English...I hope you can understand my problem!
-
- DCMTK Developer
- Posts: 2506
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
-
- DCMTK Developer
- Posts: 2506
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Ok,
I'm using Qt, and to display an image to screen I use a Qt class, named QImage.
To create a QImage I used the pixel data ( void buffer * )get from a DicomImage:
but in this mode I've two pixel data ( one of the DicomImage and one of the QImage ) . I want to have only a pixel data, but maintain both DicomImage and QImage.
Do you think is it possible?
I'm using Qt, and to display an image to screen I use a Qt class, named QImage.
To create a QImage I used the pixel data ( void buffer * )get from a DicomImage:
Code: Select all
inline int getOutputData(void *buffer,
const unsigned long size,
const int bits = 0,
const unsigned long frame = 0,
const int planar = 0)
Do you think is it possible?
-
- DCMTK Developer
- Posts: 2506
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
I use this function ( as you can see from my previous post )....
but the buffer that I need to allocate must be valid for all the QImage life.
So, to display my QImage in this mode, I've two pixel data array, one of the DicomImage and one of the QImage ( the buffer that I allocate).
I want to have only one pixel data and maintain both DicomImage and QImage.
but the buffer that I need to allocate must be valid for all the QImage life.
So, to display my QImage in this mode, I've two pixel data array, one of the DicomImage and one of the QImage ( the buffer that I allocate).
I want to have only one pixel data and maintain both DicomImage and QImage.
-
- DCMTK Developer
- Posts: 2506
- Joined: Tue, 2011-05-03, 14:38
- Location: Oldenburg, Germany
- Contact:
Ok, but you do not need to re-allocate the memory buffer each time you call getOutputData(). This only has to be done once for each image (of a particular size).but the buffer that I need to allocate must be valid for all the QImage life.
I'm not sure about the Qt-related part of your question because I didn't use Qt in the last couple of years.
-
- Posts: 56
- Joined: Mon, 2010-06-14, 16:41
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 1 guest