Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply WSI ICC #77

Open
qigongFDA opened this issue May 11, 2018 · 5 comments
Open

Apply WSI ICC #77

qigongFDA opened this issue May 11, 2018 · 5 comments
Assignees

Comments

@qigongFDA
Copy link
Contributor

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

@qigongFDA qigongFDA self-assigned this May 11, 2018
@qigongFDA
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Member

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
Copy link
Contributor Author

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
Copy link
Member

Exactly what was needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants