Customizing measurements for ROI manager

I want to know if it’s possible to write custom measurements to run on ROIs within the ROI manager. For the desired adaptation I’m thinking of, I would have objects in the ROI manager, which belong to one of 3 classes. After adding or subtracting ROIs from the manager based on what segmented well, I’d would press ‘Measure’ in the ROI Manager and the results page would contain the output for functions I write which specifically discribe the 3 classes of ROI objects in the manager.

Example functions: Return the distance between Class III objects that are within the same Class II object.
For each Class I object that overlaps with a Class II object, return the length of Class II object.

I have a macro that generates most of the measurements I want (described in these previous posts). However the macro is not perfect in segmenting all the objects I need. Adding and subtracting human approved ROI in the manager is much easier but I don’t know how to integrate the updated objects back into the code of the macro.
How pie-in-the-sky is this idea? Does this type of capability already exist
How feasible would this be for someone who only has experience writing in macro?
Is there an existing plugin that draws on the ROI manager that I could adapt?

Thanks

1 Like

example of the concept

1 Like

Without to mimic the described functionality I think you can also write a macro similar to the ROI Manager tools from @tferr:

http://imagej.net/plugins/roi-manager-tools/index.html

Then you can combine the ‘Set Measurements’ results with your “Super Awesome Custom Function” very easily without to dig into the Java sources to deep.

Of course you can also write a custom ROI Manager GUI if you like.

3 Likes

Thanks! This is helpful in pointing me in the right direction.
Do you know of any examples for this macro being customized? That would be extremely helpful to see what can and can’t be changed.

Not that I know.

However, here are some useful resources:

http://imagej.net/developer/macro/functions.html (search for ROI Manager Functions and ROI Functions).

http://imagej.net/macros/ (search for ROI macros, etc.)

E.g.:

http://imagej.net/macros/ROI_Color_Coder.ijm

http://imagej.net/macros/ROI_Manager_Stack_Demo.txt

http://imagej.net/macros/ROI_Manager_Filter_Creator.txt

http://imagej.net/macros/ToolMenusDemo.txt

http://imagej.net/macros/ToolSwitcher.txt

1 Like

Just wanted to briefly comment that the ability to customize the available measurements, customize the features of TWS, customize the options of Image Calculator, etc., is very much a goal of ImageJ2, via its flexible plugin framework.

For today, the way to do it is using a macro or script as @Bio7 points out. But some day, there will probably be a “measurement” plugin type for customizing the available measurement metrics, as you suggest.

4 Likes

Thanks for the suggestions @Bio7. I’ll check them out and try to update my progress.
It’s good to know that ImageJ2 has those goals in the pipeline. Excited to see a great tool get better.

Update: The RoiManager and roi functions were a great suggestion. I had not realized Roi’s can have assigned properties. This is very close to creating ‘classes’ for the rois from separate channels of my images.

1 Like