I was willing to build a Dicom image viewer using vtk (more specifically Activiz) and could build it successfully. vtkDicomImageReader can read standard Dicom format but cannot read other formats. This means that I have to change the other formats to the standard format and then use as the input files to the code. This is Ok. However, I wonder if there is a way to read the changed data directly from RAM? I mean if there is a way to bypass writing the changed data as new files on the hard that is probably a time-consuming work for the realtime show of multi-frame images?
Look at vtkImageData: example in c++:
vtkNew<vtkDICOMImageReader> dcmReader; dcmReader->SetDirectoryName(path); dcmReader->Update(); auto imageData = dcmReader->GetOutput();
Now I’m guessing you could build what is missing from custom dicom files and populate this vtkImageData object?
Thanks for the reply. This is nice but might not be exactly what I am looking for. I can change the dicom non-original formats (for example jpeg lossless) to the standard original format myself. But to input the data to the vtk dicom reader, I have to save the data as files on the hard and then read them through the vtk dicom reader (exactly the code that you mentioned). This is a bit time-consuming and may not be good for real-time viewing of dicom large series. What I wish to do is to read the original data obtained from the non-original formats directly from RAM (commands like memory stream or something similar). Any advice from the community is appreciated.
I wrote a new DICOM reader for VTK (it’s called vtkDICOMReader, instead of vtkDICOMImageReader) that is able to read compressed DICOM files and decompress them in memory with GDCM. So if you are able to rebuild Activiz from source, then you can enable the new DICOM reader as part of your build:
After configuring, it is also necessary to turn on GDCM, otherwise image decompression will not work: