Search in sources :

Example 1 with Obj

use of io.github.mianalysis.mia.object.Obj in project mia by mianalysis.

the class MIA_GetObjectIDs method action.

@Override
public String action(Object[] objects, Workspace workspace, Modules modules) {
    String inputObjectsName = (String) objects[0];
    // Getting the input objects
    Objs inputObjects = workspace.getObjectSet(inputObjectsName);
    if (inputObjects == null)
        return "";
    StringBuilder sb = new StringBuilder();
    for (Obj inputObject : inputObjects.values()) {
        if (sb.length() == 0) {
            sb.append(inputObject.getID());
        } else {
            sb.append(",").append(inputObject.getID());
        }
    }
    return sb.toString();
}
Also used : Obj(io.github.mianalysis.mia.object.Obj) Objs(io.github.mianalysis.mia.object.Objs)

Example 2 with Obj

use of io.github.mianalysis.mia.object.Obj in project mia by mianalysis.

the class MIA_GetObjectParentID method action.

@Override
public String action(Object[] objects, Workspace workspace, Modules modules) {
    String inputObjectsName = (String) objects[0];
    int objectID = (int) Math.round((Double) objects[1]);
    String parentObjectsName = (String) objects[2];
    // Getting the children of the input object
    Objs inputObjects = workspace.getObjectSet(inputObjectsName);
    if (inputObjects == null)
        return "";
    Obj inputObject = inputObjects.get(objectID);
    Obj parentObject = inputObject.getParent(parentObjectsName);
    return String.valueOf(parentObject.getID());
}
Also used : Obj(io.github.mianalysis.mia.object.Obj) Objs(io.github.mianalysis.mia.object.Objs)

Example 3 with Obj

use of io.github.mianalysis.mia.object.Obj in project mia by mianalysis.

the class MIA_GetSliceAsROI method action.

@Override
public String action(Object[] objects, Workspace workspace, Modules modules) {
    String inputObjectsName = (String) objects[0];
    int inputObjectsID = (int) Math.round((Double) objects[1]);
    int slice = (int) Math.round((Double) objects[2]);
    // Getting the input objects
    Objs inputObjects = workspace.getObjectSet(inputObjectsName);
    if (inputObjects == null)
        return "";
    Obj inputObject = inputObjects.get(inputObjectsID);
    Roi roi = inputObject.getRoi(slice);
    RoiManager roiManager = RoiManager.getInstance2();
    roiManager.addRoi(roi);
    return "";
}
Also used : Obj(io.github.mianalysis.mia.object.Obj) Objs(io.github.mianalysis.mia.object.Objs) Roi(ij.gui.Roi) RoiManager(ij.plugin.frame.RoiManager)

Example 4 with Obj

use of io.github.mianalysis.mia.object.Obj in project mia by mianalysis.

the class MIA_ListObjectsInWorkspace method action.

@Override
public String action(Object[] objects, Workspace workspace, Modules modules) {
    // Creating a new ResultsTable to hold the Image names
    ResultsTable rt = new ResultsTable();
    int row = 0;
    // Getting a list of Images in the Workspace
    HashMap<String, Objs> allObj = workspace.getObjects();
    for (String objName : allObj.keySet()) {
        if (row != 0)
            rt.incrementCounter();
        boolean measTest = false;
        Obj firstObj = allObj.get(objName).getFirst();
        if (firstObj != null)
            measTest = firstObj.size() == 0;
        String measurementsOnly = Boolean.toString(measTest);
        rt.setValue("Objects name", row, objName);
        rt.setValue("Number of objects", row, allObj.get(objName).size());
        rt.setValue("Measurements only", row, measurementsOnly);
        row++;
    }
    rt.show("Objects in workspace");
    return null;
}
Also used : Obj(io.github.mianalysis.mia.object.Obj) Objs(io.github.mianalysis.mia.object.Objs) ResultsTable(ij.measure.ResultsTable)

Example 5 with Obj

use of io.github.mianalysis.mia.object.Obj in project mia by mianalysis.

the class MIA_GetObjectMeasurement method action.

@Override
public String action(Object[] objects, Workspace workspace, Modules modules) {
    String objectName = (String) objects[0];
    int objectID = (int) Math.round((Double) objects[1]);
    String measurementName = (String) objects[2];
    // Getting the object set
    Objs objCollection = workspace.getObjectSet(objectName);
    if (objCollection == null)
        return "";
    // Getting the object
    if (!objCollection.keySet().contains(objectID))
        return "";
    Obj obj = objCollection.get(objectID);
    // Getting the measurement
    Measurement measurement = obj.getMeasurement(measurementName);
    if (measurement == null)
        return "";
    // Returning measurement value
    return String.valueOf(measurement.getValue());
}
Also used : Measurement(io.github.mianalysis.mia.object.Measurement) Obj(io.github.mianalysis.mia.object.Obj) Objs(io.github.mianalysis.mia.object.Objs)

Aggregations

Obj (io.github.mianalysis.mia.object.Obj)449 Objs (io.github.mianalysis.mia.object.Objs)343 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)232 EnumSource (org.junit.jupiter.params.provider.EnumSource)232 SpatCal (io.github.sjcross.common.object.volume.SpatCal)151 Point (io.github.sjcross.common.object.Point)140 ImagePlus (ij.ImagePlus)123 Image (io.github.mianalysis.mia.object.Image)119 Workspace (io.github.mianalysis.mia.object.Workspace)109 Workspaces (io.github.mianalysis.mia.object.Workspaces)108 Objects3D (io.github.mianalysis.mia.expectedobjects.Objects3D)77 Measurement (io.github.mianalysis.mia.object.Measurement)60 PointOutOfRangeException (io.github.sjcross.common.object.volume.PointOutOfRangeException)26 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)25 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)22 Color (java.awt.Color)21 Modules (io.github.mianalysis.mia.module.Modules)20 HashMap (java.util.HashMap)17 ArrayList (java.util.ArrayList)15 CalculateNearestNeighbour (io.github.mianalysis.mia.module.objects.measure.spatial.CalculateNearestNeighbour)14