Skip to content

read dicom with jpeg compress data #145

@chenkaiC4

Description

@chenkaiC4

hi, i want to read a dicom with data compressed as jpeg. i find the daikon.js, and use it to get uncompress dicom image, but then, how to use itk-js to read the image, because i use vtk.js too, i know vtk.js depend on itk.js to read such as image, dicom etc.

main code logic is below:

import itkreadImageDICOMFileSeries from 'itk/readImageDICOMFileSeries';
import vtkHttpDataAccessHelper from 'vtk.js/Sources/IO/Core/DataAccessHelper/HttpDataAccessHelper';

vtkHttpDataAccessHelper.fetchBinary(url).then((arrayBuffer) => {
    const image = daikon.Series.parseImage(new DataView(arrayBuffer));
    if (image === null) {
        console.error(daikon.Series.parserError);
    }

    const rawData = image.getRawData(); // ArrayBuffer

    const filename = `test.dcm`;

    const file = new File([rawData], filename);

    itkreadImageDICOMFileSeries(null, [file])
        .then(({ image: itkImage, webWorker }) => {
            // code not exec here
            // get a Error: Could not read file: /work/test.dcm
        })
})

update:

because the raw image data have got, i think i have to create a Image instance, but need a correct ImageType.

https://github.com/InsightSoftwareConsortium/itk-js/blob/f2b16ac4b9097367969dc1ff961037bc43441753/src/Image.js#L4-L23

https://github.com/InsightSoftwareConsortium/itk-js/blob/f2b16ac4b9097367969dc1ff961037bc43441753/src/ImageType.js#L4-L12

but i don't know how to determine the componentType componets and other input args of constructor ImageType.

thanks for your suggestions!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions