I have a J2k Lossless dicom image and upon reading it with pydicom I see that it's in the YBR_RCT Color Space.
I want to convert the Color Space to RGB. I tried using the convert_color_space method from pydicom however, apparently this conversion is not implemented.
In their documentation they mention this link as reference for their implementation of other conversions. That link also mentions some equations for converting from YBR_RCT to RGB.
I implemented the equations like so:
rgb_arr = np.zeros(orig_arr.shape).astype(np.float)
g = orig_arr[:,:,0] - np.floor((orig_arr[:,:,1]+orig_arr[:,:,2])/4)
r = g + orig_arr[:,:,2]
b = g + orig_arr[:,:,1]
rgb_arr[:,:,0] = r
rgb_arr[:,:,1] = g
rgb_arr[:,:,2] = b
rgb_arr = np.clip(rgb_arr,0,255).astype(orig_arr.dtype)
However, after this when I visualize the image through plt.imshow(), I see that it's very purplish. I doubt what I have done is right and I haven't really found another package that does this conversion.
I have tried using SimpleITK, however its not clear to me if it does the color space conversion or not.
Please let me know if you know how to do this conversion.