- imwrite with special N-V pairs
- TIFF objects
Matrix to 12 bit image without pixel information loss
6 次查看(过去 30 天)
显示 更早的评论
I am running a pipeline which initially imports tif images (12-bit; 0 to 4095 pixel intensity value), converts values to doubles (it still stores original pixel values i.e. 0-4095) and finally do some processing. Afterwards I need to save them again as tif files for further processing on ImageJ, but it seems transferrring matrix data into image changes the original pixel values. I used imshow to generate an image and save it using Save As in the dropdown menu on matlab figure.
Is there a way to generate/store images from matrix without changing the original pixel values of a 12 bit image?
0 个评论
采纳的回答
Asvin Kumar
2021-3-17
imshow might internally be using imwrite and as mentioned in the description for imwrite, double values get scaled and written as 8-bit values.
Having said that, there are two ways to write TIFF files.
Part 1 - imwrite
imwrite can write 'uint16' values to TIFF files without any conversion.So, first trick that you could try is to cast your data from 'double' to 'uint16'. Once that's done, you can write the 'uint16' values to TIFF images following the syntax in this example. imwrite also provides some special N-V pairs for TIFF files such as 'ColorSpace', 'Compression', 'Resolution', etc.
Part 2 - TIFF objects
The options in imwrite are limited. MATLAB has something called TIFF objects which are basically a gateway to access functions of the LibTIFF Library. A list of all the functions available via TIFF objecs is provided on its doc page along with a couple of examples. Here's a link to a good article on exporting TIFF images.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Data 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!