mcib3d / mcib3d-plugins

ImageJ plugins for 3D processing and analysis
https://imagej.net/3D_ImageJ_Suite
8 stars 9 forks source link

3D ROI Manager renaming ROIs quickly #17

Closed pr4deepr closed 3 years ago

pr4deepr commented 3 years ago

HI @mcib3d Hope you are well. I have a question about renaming ROIs within 3D ROI Manager. Currently, as part of a workflow I have to rename the ROIs to help with identification later on as I have multiple celltypes. This is an example function I use:

//rename 3D ROI; pass the name of the cell
function rename_3DROI(name)
{
    Ext.Manager3D_DeselectAll();
    Ext.Manager3D_Count(roi_no);
    Ext.Manager3D_MonoSelect();
    for(roi=0;roi<roi_no;roi++)
    {
        roi_name=name+"_"+(roi+1);
        Ext.Manager3D_Select(roi);
        Ext.Manager3D_Rename(roi_name);
    }
}

The time taken for this scales up proportionally to the number of ROIs. Sometimes I may have 1000s. This takes a very long time!

Currently, the image updates with the ROI as Ext.Manager3D_Select(roi) is executed. Is there a quicker way to rename the ROIs? A batchmode of sorts?

Thanks

Pradeep

mcib3d commented 3 years ago

Hi Pradeep,

I am well, thank you, a bit busy with teaching and learning how to teach remotely.

About your question, actually there is a map linking the names of the objects with their index in the list, and each time you rename an object you need to update the list.

Actually you can rename many objects at once, their name will be incremented, in the same way you are doing.

Actually this macro is working quite well and is quite fast :

Ext.Manager3D_SelectAll(); Ext.Manager3D_Rename("Nuclei");

Best

Thomas

pr4deepr commented 3 years ago

Hi Thomas Glad you are well. Yes, I think we all are adjusting in one way or another.

Perfect! This is really fast and exactly what I was after.

Another question, in the same way you did this, is it possible to filter or delete objects based on certain parameters from the Measure 3D, for example, i.e., ; say if I need objects only above volume 500 and sphericity or ratiovol ellipsoid above 0.8? Currently, I use a for loop for this, but perhaps there is a more efficient way?

Thanks again.

Cheers Pradeep

mcib3d commented 3 years ago

Hi Pradeep,

For filtering objects, yes you need a loop; you can either use the "delete" command or erase the object from the labels image by drawing them in black. Tell me if there is any pb.

Best,

Thomas

pr4deepr commented 3 years ago

Thanks Thomas. It works pretty well, I just wanted to make sure this was the right way to do this! Good idea about erasing it. Forget to do that. Will help with updating objects

Thanks again. Stay safe and I'll definitely get in touch if I have any issues.

Cheers Pradeep