Open qigongFDA opened 6 years ago
In matlab We can use readicc function to extract ICC file from WSI file. (.svs) e.g. iccFile = iccread('C:\000_whole_slides\mcsMSKCC\xxxxxHE.svs');
We can use following commands to apply the ICC file to an extracted ROI tif = Tiff('C:\eeDAP\master\src\inputfilesDevelopment\Temporary_Task_Images\5th0005c.tif', 'r+'); raw_profile_bytes = fread(iccFile , Inf, 'uint8=>uint8'); tif.setTag('ICCProfile', raw_profile_bytes); tif.rewriteDirectory(); tif.close();
We can see the difference between on ICC ROI and embed ICC ROI by windows photo viewer. But when we use imread function to read in the two ROIs into matlab, they are identical.
We can use makecform and applycform functions to apply ICC file on extracted ROI
For example,
load('iccFile.mat'); outprof = iccread('sRGB.icm'); C = makecform('icc',iccFile, outprof); originalImage= imread('original.tif'); applyICCimage= applycform(original, C);
However, for now, we don't know whether sRGB.icm is correct outprof.
The code is important. However, I don't know what the objects/variables are or represent and I don't know what the functions are doing. Please add more info ... document this code.
I am communicating with Mathwork to get more information and better understanding for ICC functions, and will keep updating this issue.
There are some functions description:
iccread: Extract ICC file from original WSI image. Input can be WSI image full name, or a icc (.icm) file. 1.1 If the WSI image has ICC file, output is ICC file 1.2 If the WSI image does't contain ICC file, system return an error. We can use 'try' 'catch' functions to skip error
iccwrite: save ICC file to disk
makecform: Create color transformation structure. C = makecform('icc', src_profile, dest_profile). input: src_profile is WSI ICC, dest_profile is the display ICC (now we use sRGB). output: C is color transformation structure
applycform: apply color transformation structure on ROI image.
Exactly what was needed.
We need to apply WSI ICC on extract ROI and displayed in eeDAP GUI