Reputation: 845
I am trying to write a sequence of color images to a dicom file in Matlab. Each image is of type uint16
. The sequence is stored in a 4D matrix named output
of size 200x360x3x360 (num of rows x num of cols x num of channels x num of images). When I execute dicomwrite(output,'outputfile.dcm')
, it gives the following error:
It says data bit depth is 8 but I've ensured that each image is 16-bit. Not sure what's going wrong.
The documentation for dicomwrite
says it can write color images as well. In fact dicomread
can read color dicom images such that the size of the matrix which stores the read data is 200x360x3x360. So I guess it should be possible to write color images as well using dicomwrite
. Any help in this regard is appreciated. There is a related post but it doesn't talk about color image sequence.
Upvotes: 4
Views: 1353
Reputation: 1791
The comment by JohnnyQ is correct. From this page down in section A.8.5.4, they list the Multi-frame True Color SC Image IOD Content Constraints (partial list quote):
In the Image Pixel Module, the following constraints apply:
- Samples per Pixel (0028,0002) shall be 3
- Bits Allocated (0028,0100) shall be 8
- Bits Stored (0028,0101) shall be 8
- High Bit (0028,0102) shall be 7
- Pixel Representation (0028,0103) shall be 0
It seems matlab will not do the conversion for you, so you should down convert each 16-bit color channel to 8-bit for DICOM
Upvotes: 4