I’m trying out the stain normalization toolbox provided by the Department of Computer Science over at Warwick . Be fair warned, it’s a windows only, matlab, toolbox.
All in all, things seem to be going well after a bit of tweaking. The demos that they provide have a few caveats though which took a while to figure out:
- Since I assume the underlying executable relies on the bundled opencv dlls (which do not support multi-threaded access), parallelizing multiple image normalizations is a no go. I attempted to do this in matlab using a simple parfor loop and needless to say, things did not end well
- The output from the executable is literally the same name as provided in the filename.txt except in the “normalized” sub-directory (need to pre-create if it doesn’t exist). This is a bit of a bummer because one would expect to be able to use absolute filenames and use “c:\dir1\dir2\filename1.tif” in the filename.txt. But after running the program attempts to save output into “.\noramalised\c:\dir1\dir2\filename1.tif”, which obviously isn’t going to fly.
- Since the executable requires all of the bundled libraries to be in the same path, as well as local filenames (see #2 above), it just seemed easier to copy the files I wanted to normalize to that directory, perform the normalization and then delete them afterwords.
So taking those 3 things into account, I have this basic matlab script (below) which acts at the workhorse, wrapping around the .zip file provided at the url above.
It works quite well but is limited to usage on H&E images as their bundled H&E color model file seems to be in a proprietary binary format. I’ll be publishing our results soon which show how our approach is comparable in most cases, but seems to better in more extreme cases. Stay tuned!
- fid = fopen( 'filename.txt', 'w+' );
- for fi=1:length(files)
- fprintf(fid, '%s\n', fname);
- to_run=sprintf('ColourNormalisation.exe BimodalDeconvRVM filename.txt %s HE.colourmodel',templateImage_fname);
- cd (ppwd)