16bit TIFF images generated by ImageJ appear black in MATLAB

34 ビュー (過去 30 日間)
Omer Yuval
Omer Yuval 2017 年 6 月 17 日
編集済み: Omer Yuval 2017 年 6 月 24 日
Hi,
I have a database of 16bit TIFF images generated in ImageJ that I need to process in MATLAB. Apparently ImageJ is doing something to the image which makes it look almost completely black outside the framework of ImageJ (including MATLAB or any conventional viewer).
Moreover, if I open these TIFF images in ImageJ and then save them as JPEG, it suddenly opens normally outside the framework of ImageJ. But this doesn't solve the problem since JPEG loses information and since it is not practical to implement for a large amount of images.
Here you can find a sample TIFF & JPEG pair: TIFF: http://imgur.com/Arj5mzY JPEG: http://imgur.com/cpuXTni
EDIT: please use these links. they do not change the format of the image: TIFF: http://www.filedropper.com/tiff_1 JPEG: http://www.filedropper.com/jpeg
You can see that the TIFF image looks almost completely black, but if you open both the TIFF and the JPEG in ImageJ, they look the same.
What I need is the MATLAB code that converts the TIFF image generated by ImageJ, to a "real" TIFF that can be processed by MATLAB without changing\losing any information.
  7 件のコメント
Walter Roberson
Walter Roberson 2017 年 6 月 20 日
Note: files types that are not directly supported can be uploaded here by zip'ing them to create a .zip as .zip is supported.
Walter Roberson
Walter Roberson 2017 年 6 月 20 日
If you use
info = imfinfo('TIFF.tif');
and examine info.ImageDescription then that contains
'ImageJ=1.49e
min=0.0
max=1636.0
'
this hints that 1636 is perhaps the expected maximum.

サインインしてコメントする。

採用された回答

Omer Yuval
Omer Yuval 2017 年 6 月 22 日
編集済み: Omer Yuval 2017 年 6 月 24 日
It worked!
Thanks a lot Walter Roberson.
The full general solution:
% use imfinfo('filename.tif') and strfind to find the minimum (m) and maximum (M) pixel values defined by ImageJ.
Im(find(Im < m)) = m;
Im(find(Im > M)) = M;
Im = (double(Im)-m) / M;
Or, if you just want to display the image:
imshow(Im,[m,M]);
  2 件のコメント
Image Analyst
Image Analyst 2017 年 6 月 22 日
What if you simply use mat2gray():
lm = mat2gray(lm);
Omer Yuval
Omer Yuval 2017 年 6 月 24 日
Nope...

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by