0

I'd like to do some image processing in FIJI / ImageJ but not sure how to go about it. I have a first image, call it "imageA" and would like to perform several operations on it. I know you can go to Process->Math and have some options for operations (add subtract multlipy etc) and there is a tool for writing a macro so that you can combine a few operations into one step, but I'm not sure how to approach it for adding in a second image which I'd like to include in the operation.

I'd like to take imageA and multiply it by a second image of the same size, imageB, together with a few other steps which are outlined in the function below:

output image = sqrt((constant*constant) + (constant2*constant2) + (imageB*imageB))

Image A * Output Image.

The constants are pretty straightforward inputs that I can simply add, but I'm not sure how to make it so imageB is also included in the function to produce the final output that I will then apply to imageA.

Harry B
  • 351
  • 1
  • 5
  • 17
  • provide more code. this is a single line that does not even tell us where you get those values from. – Piglet Dec 07 '17 at 20:56
  • my apologies- there's not much more to provide but I edited to add some more. The constants will be integers that I will put in manually. I'm processing a handful of images and each constant will be different based on the image acquisition metadata. The only thing I'm not sure how to include is the file for imageB in the function. – Harry B Dec 07 '17 at 21:01

1 Answers1

1

The approach is to first open "imageB", perform the operations (using Process > Math) to create the "Output image", open "imageA" and then use the Process > Image Calculator, selecting imageA and Output image with the multiply operation.

In the ImageJ macro language, it will look something like this:

//open imageB
open("LOCATIONOFIMAGEB");
//square ImageB
run("Square");
//add your constants to image
run("Add...", "value=CONSTANT1"); //Constant1 should be an integer
run("Add...", "value=CONSTANT2"); //Constant2 should be an integer
//squareroot to make your outputImage
run("Square Root");
//open ImageA
open("LOCATIONOFIMAGEA");
//multiple images
imageCalculator("Multiply create", "WINDOWTITLEOFIMAGEA","WINDOWTITLEOFIMAGEB");

Insert the relevant constants, location of images and windowTitles and it should work...

Louis Leung
  • 508
  • 4
  • 11