Posted by
Romain Guiet on
Apr 09, 2015; 7:15am
URL: http://imagej.273.s1.nabble.com/Fiji-color-deconvolution-macro-tp5012404p5012415.html
Hi Rodrigo,
I just tried your code on a random H&E image and it works on my computer, ie. the three color deconvolved images appear.
Using the Process>Batch> Macro , if you want to save the "Colour 1" image, you need to select it (see code below).
You should also consider to save images in a new folder (otherwise you could end up with overwriting on your original images)
Do not forget ";" at the end of each line (were missing for your color vectors). If they are missing, the code works on the current opened image but doesn't work in batch mode...
I hope it will help you,
Cheers,
Romain
//---------- start of code
title = getTitle(); // get the title of the current image
imageOfInterest = title+"-(Colour_1)"; // the deconvolved imageName model
//Colour[1]:
Red1=13.951654;
Green1=23.660986;
Blue1=19.173325;
//Colour[2]:
Red2=7.737847;
Green2=7.301559;
Blue2=9.771005;
//Colour[3]:
Red3=144.38943;
Green3=112.913376;
Blue3=85.59621;
run("Colour Deconvolution", "vectors=[User values] show [r1]=Red1 [g1]=Green1 [b1]=Blue1 [r2]=Red2 [g2]=Green2 [b2]=Blue2 [r3]=Red3 [g3]=Green3 [b3]=Blue3");
selectImage(imageOfInterest); // select the imageOf Interest
//---------- end of code
---------------------------------------------------------------
Dr. Romain Guiet
Bioimaging and Optics Platform (PT-BIOP)
Ecole Polytechnique Fédérale de Lausanne (EPFL)
Faculty of Life Sciences
Station 19, AI 0140
CH-1015 Lausanne
Phone: [+4121 69] 39629
http://biop.epfl.ch/---------------------------------------------------------------
________________________________________
De : ImageJ Interest Group [
[hidden email]] de la part de Rodrigo Gonçalves [
[hidden email]]
Envoyé : mercredi 8 avril 2015 16:54
À :
[hidden email]
Objet : Fiji: color deconvolution macro
Dear all,
I'm preparing a macro in Fiji to run color deconvolution in all images inside a given folder (using Process-Batch-Macro).
What I intend is, for each image:- Run color deconvolution with my user-defined colour vectors
- Save the first resulting image (colour 1) as a TIFF file in the same folder
I recorded the macro while doing color deconvolution and I can assign my user-defined values to the vectors. However the macro runs without showing the results.
The log file seems ok and there are no error messages or anything, but doesn't show anything else than the log.
I copy here the macro (and the log further down).
What am I missing?Thanks!Rodrigo
---- start of macro code ---// Colour vectors to use:
//Colour[1]:
Red1=13.951654
Green1=23.660986
Blue1=19.173325
//Colour[2]:
Red2=7.737847
Green2=7.301559
Blue2=9.771005
//Colour[3]:
Red3=144.38943
Green3=112.913376
Blue3=85.59621
run("Colour Deconvolution", "vectors=[User values] show [r1]=Red1 [g1]=Green1 [b1]=Blue1 [r2]=Red2 [g2]=Green2 [b2]=Blue2 [r3]=Red3 [g3]=Green3 [b3]=Blue3");
---- end of macro code ---
---- start of log text ---User values Vector Matrix ---
Colour[1]:
R1: 13.951654
G1: 23.660986
B1: 19.173325
Colour[2]:
R2: 7.737847
G2: 7.301559
B2: 9.771005
Colour[3]:
R3: 144.38943
G3: 112.913376
B3: 85.59621
User values Java code ---
if (myStain.equals("New_Stain")){
// This is the New_Stain
MODx[0]=0.41649377;
MODy[0]=0.706343;
MODz[0]=0.57237446;
MODx[1]=0.5356745;
MODy[1]=0.5054712;
MODz[1]=0.67642564;
MODx[2]=0.7137465;
MODy[2]=0.5581539;
MODz[2]=0.42311957;
}
---- end of log text ---
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html