Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To obtain the "PixelData" from a DICOM file using dcm4che, you can use the following code:

File file = new File("path_of_dicom_file");
DicomObject dcmObj = DicomObject.readFile(file);
if (dcmObj.contains(Tag.PixelData)) {
    byte[] pixelData = dcmObj.getBytes(Tag.PixelData);
    // Process byte array
}

In the above code, the DicomObject class is used to read the DICOM file's metadata and pixel data. The contains method is used to check if the DICOM object contains the "PixelData" tag, and the getBytes method is used to obtain the byte array of pixel data.

Once you have obtained the byte array of pixel data, you can process it according to your needs. For example, you can convert it to an image using an image processing library.