JuliaHealth / DICOM.jl

Julia package for reading and writing DICOM (Digital Imaging and Communications in Medicine) files
MIT License
56 stars 21 forks source link

Is there a documentation for this package somewhere? #46

Closed sama2689 closed 4 years ago

sama2689 commented 4 years ago

I have just gotten started with this package and was able to load a dicom image into a workspace, but I am not sure which functions are available to deal with it. e.g. which methods are available, how do I access the header information, how do I decipher the image info from the image?

I am used to matlab, in which conveniently provides the function dicomread and dicominfo that allow access to the image and the metadata separately. Is it possible to do something similar with this package?

Thanks

notZaki commented 4 years ago

The readme provides some basic information, but proper documentation is currently lacking. Anyways, I'll mention a few steps (from memory, so they might not be exactly correct).

dcm_parse() returns the header information in a dictionary where the keys are the hex codes. For example, to get the series description, the steps would be:

dcm_data = dcm_parse(input_file)
series_description = dcm_data[(0x0008, 0x103E)]

Since hex codes are not always memorable, an alternative is dcm_data[tag"Series Description"].

For the pixels/image data, the steps would be:

pixel_data = dcm_data[(0x7FE0, 0x0010)] # or: dcm_data[tag"Pixel Data"]

The above is equivalent to pixel_data = dicomread(...) in matlab.

The image can be viewed using other packages such as ImageView.jl or Plots.jl. An example using the latter would be:

using Plots
heatmap(pixel_data; color = :grays, yflip = true, aspect_ratio = :equal)
sama2689 commented 4 years ago

The readme provides some basic information, but proper documentation is currently lacking. Anyways, I'll mention a few steps (from memory, so they might not be exactly correct).

dcm_parse() returns the header information in a dictionary where the keys are the hex codes. For example, to get the series description, the steps would be:

dcm_data = dcm_parse(input_file)
series_description = dcm_data[(0x0008, 0x103E)]

Since hex codes are not always memorable, an alternative is dcm_data[tag"Series Description"].

For the pixels/image data, the steps would be:

pixel_data = dcm_data[(0x7FE0, 0x0010)] # or: dcm_data[tag"Pixel Data"]

The above is equivalent to pixel_data = dicomread(...) in matlab.

The image can be viewed using other packages such as ImageView.jl or Plots.jl. An example using the latter would be:

using Plots
heatmap(pixel_data; color = :grays, yflip = true, aspect_ratio = :equal)

Thank you! That is indeed quite helpful. If not any documentation, is there a legend of all the hex codes and what they correspond to anywhere? That's really all I'd need to figure the rest of it out myself I think.

notZaki commented 4 years ago

Some of the hex codes are in src/dcm_dict.jl.

A more complete list is available at dicom.nema.

sama2689 commented 4 years ago

Some of the hex codes are in src/dcm_dict.jl.

A more complete list is available at dicom.nema.

Thank you so much!