Skip to content

Commit

Permalink
Added second image difference function that subtracts the images with…
Browse files Browse the repository at this point in the history
…out the 32 bit option.
  • Loading branch information
Chris Lucani committed Dec 6, 2017
1 parent b6d73a2 commit c97025b
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
2 changes: 2 additions & 0 deletions OSOV Toolbox.ijm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ requires("1.50a");
var filemenu = newMenu("OSOV Menu Tool", newArray(
"Colour Slices",
"Image Difference",
"Image Difference v2",
// "Image Difference (batch)",
"Clear Slices",
"Save Slices",
Expand All @@ -42,6 +43,7 @@ requires("1.50a");
if (menuCmd!="-") {
if (menuCmd=="Colour Slices") { run("OSOV Colour Slices"); }
else if (menuCmd=="Image Difference") { run("OSOV Image Difference"); }
else if (menuCmd=="Image Difference v2") { run("OSOV Image Difference v2"); }
else if (menuCmd=="Image Difference (batch)") { run("OSOV Batch Image Difference");}
else if (menuCmd=="Clear Slices") { run("OSOV Clear Slices"); }
else if (menuCmd=="Save Slices") { run("OSOV Save Slices"); }
Expand Down
45 changes: 45 additions & 0 deletions OSOV/OSOV_Image_Difference_v2.ijm
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
var SAMPLE_TYPE_STEM = "Stem";
var SAMPLE_TYPE_LEAF = "Leaf";

var sampleType;

macro "OSOV Image Difference v2" {

getSettings();

setBatchMode(true);

originalImage = getImageID();

Stack.getDimensions(ww, hh, channels, slices, frames);

run("Make Substack..."," slices=1-"+ slices-1);
imgID1 = getImageID();

selectImage(originalImage);

run("Make Substack...", " slices=2-"+ slices);
imgID2 = getImageID();

if(sampleType == SAMPLE_TYPE_STEM) {
imageCalculator("Subtract create stack", imgID2, imgID1);
} else {
imageCalculator("Subtract create stack", imgID1, imgID2);
}
selectImage(imgID1);
close();

selectImage(imgID2);
close();

setBatchMode("exit and display");
}



function getSettings() {
Dialog.create("Difference Settings");
Dialog.addChoice("Sample:", newArray(SAMPLE_TYPE_STEM, SAMPLE_TYPE_LEAF));
Dialog.show();
sampleType = Dialog.getChoice();
}

0 comments on commit c97025b

Please sign in to comment.