StackProfileData

macro
Tags: #<Tag:0x00007fa30b511048>

#1

Hi there,

I’m using the StackProfileData (https://imagej.net/macros/StackProfileData.txt) to get results of profiles in entire stacks. A very powerful and nice macro!° It gives the profile results of a given line or rectangle selection for an entire stack.

 	x	1 (0,1s)	2 (1,6s)	…
1	0	63	62	…
2	1	63	62	…
3	2	63	63	…
4	3	64	65	…
…	…	…	…	…

My wish is to get the coordinates of the selection printed in an extra row if it’s easily done. I thought of using “getSelectionBounds(x, y, width, height)”? Any Ideas how?

Best wishes, jonas


#2

You are searching for something like this:

Roi.getBounds(x,y,w,h);
print("bounds: ",x,y,w,h);

But also have a look at the macro API:

https://imagej.nih.gov/ij/developer/macro/functions.html

Here an example:

https://imagej.nih.gov/ij/macros/examples/RoiFunctionsDemo.txt

So you can, e.g., add this at the end of the macro to get the selection coord. in the first row (all other columns are 0 - take care of the variable names!):

Roi.getBounds(xc, yc, xwidth, xheight);
//print("bounds: ", xc, yc, xwidth, xheight);
setResult("xc", 0, xc);
setResult("yc", 0, yc);
setResult("xwidth", 0, xc);
setResult("xheight", 0, xheight);
setBatchMode(false);
updateResults;

Of course you could also put the values at the end (last row).


#3

Thank you, Bio7!
Exactly what I searched for! Have a nice day wishes
Jonas