DIDSR / eeDAP

Evaluation Environment for Digital and Analog Pathology
http://didsr.github.io/eeDAP/
Other
16 stars 20 forks source link

Apply WSI ICC #77

Open qigongFDA opened 6 years ago

qigongFDA commented 6 years ago

We need to apply WSI ICC on extract ROI and displayed in eeDAP GUI

qigongFDA commented 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.

qigongFDA commented 6 years ago

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.

brandon-gallas commented 6 years ago

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.

qigongFDA commented 6 years ago

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:

  1. 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

  2. iccwrite: save ICC file to disk

  3. 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

  4. applycform: apply color transformation structure on ROI image.

brandon-gallas commented 6 years ago

Exactly what was needed.