rii-mango/Daikon

More specific documentation for .getInterpretedData()

Nathan-Franck opened this issue · 1 comments

I'm not sure what encoding format the array is that .getInterpretedData() returns. I'm trying to read a DICOM file and save out a single slice of the 3D volume as a new jpeg, but I'm fairly certain I need some intermediate processing but without a format to start on it's impossible to know what to do! This is my current code:

let daikonImageData = daikonImage.getInterpretedData(false, true);
let rawSlice = daikonImageData.data.slice(0, daikonImageData.numCols * daikonImageData.numRows);
fs.writeFileSync("TestImage.jpeg", jpeg.encode({
    data: rawSlice,
    width: daikonImageData.numCols,
    height: daikonImageData.numRows }));

Thanks for any hints you can give!

@Nathan-Franck DICOM images often have a high dynamic range (e.g. 16-bit grayscale), while 32-bit RGBA data only has 8-bit gray. To save to a conventional bitmap, you need to select an appropriate contrast and brightness (window width and center in DICOM-speak). This is beyond the scope of this library. You can see how NiiVue and Papaya use Diakon to load images, but they are not minimal examples.