use of mcib3d.geom.Object3D in project mcib3d-core by mcib3d.
the class Association method drawAssociation.
@Deprecated
public void drawAssociation(ImageHandler draw) {
if (CostsAll == null)
computeAssociation();
int max = 0;
for (String a : CostsOK.keySet()) {
int[] vals = Association.getValues(a);
int val1 = vals[0];
int val2 = vals[1];
Object3D object3D2 = population2.getObjectByValue(val2);
// object3D2.setValue(val1);
object3D2.draw(draw, val1);
if (val1 > max)
max = val1;
}
// orphan2
for (String orphan : Orphan2) {
int val = Integer.parseInt(orphan);
max++;
Object3D object3D2 = population2.getObjectByValue(val);
// object3D2.setValue(max);
object3D2.draw(draw, max);
}
}
use of mcib3d.geom.Object3D in project mcib3d-core by mcib3d.
the class InteractionsComputeContours method compute.
@Override
public InteractionsList compute(ImageHandler image) {
// get population from image
Objects3DPopulation population = new Objects3DPopulation(image);
InteractionsList interactions = new InteractionsList();
for (Object3D object3D : population.getObjectsList()) {
LinkedList<Voxel3D> list = object3D.getContours();
for (Voxel3D voxel3D : list) {
ArrayUtil util = image.getNeighborhood3x3x3(voxel3D.getRoundX(), voxel3D.getRoundY(), voxel3D.getRoundZ());
util = util.distinctValues();
for (int i = 0; i < util.size(); i++) {
for (int j = i + 1; j < util.size(); j++) {
int vali = util.getValueInt(i);
int valj = util.getValueInt(j);
if ((vali > 0) && (valj > 0)) {
if ((vali == object3D.getValue()) || (valj == object3D.getValue())) {
if (!interactions.contains(vali, valj)) {
interactions.addInteraction(population.getObjectByValue(vali), population.getObjectByValue(valj));
}
interactions.incrementPairVolume(vali, valj);
}
}
}
}
}
}
return interactions;
}
use of mcib3d.geom.Object3D in project mcib3d-core by mcib3d.
the class Segment3DSpots method segmentAll.
/**
*/
public void segmentAll() {
segmentedObjects = new ArrayList<Object3D>();
LinkedList<Voxel3D> obj;
int o = 1;
int localThreshold = localValue;
if (labelImage == null) {
this.createLabelImage();
}
// locate seeds
for (int z = 0; z < seedsImage.sizeZ; z++) {
IJ.showStatus("Segmenting slice " + (z + 1));
// IJ.log("Segmenting slice " + (z + 1));
for (int y = 0; y < seedsImage.sizeY; y++) {
for (int x = 0; x < seedsImage.sizeX; x++) {
if (seedsImage.getPixel(x, y, z) > seedsThreshold) {
// LOCAL THRESHOLD
if (localMethod == LOCAL_MEAN) {
localThreshold = (int) localMean(x, y, z);
} else if (localMethod == LOCAL_GAUSS) {
double[] gauss;
gauss = this.gaussianFit(x, y, z, false);
if (gauss != null) {
double thresh = CurveFitter.f(CurveFitter.GAUSSIAN, gauss, GAUSS_PC * gauss[3]);
// IJ.log("gauss sigma : " + gauss[3] + " thresh=" + thresh);
localThreshold = (int) thresh;
}
} else if (localMethod == LOCAL_DIFF) {
localThreshold = (int) Math.max(1, seedsImage.getPixel(x, y, z) - diff);
}
if (localThreshold > 0) {
if (show) {
IJ.log("segmenting spot at : " + x + " " + y + " " + " " + z + " lc=" + localThreshold);
}
}
switch(methodSeg) {
case SEG_CLASSICAL:
obj = this.segmentSpotClassical(x, y, z, localThreshold, o);
break;
case SEG_MAX:
obj = this.segmentSpotMax(x, y, z, localThreshold, o);
break;
case SEG_BLOCK:
obj = this.segmentSpotBlock(x, y, z, localThreshold, o);
break;
default:
obj = this.segmentSpotClassical(x, y, z, localThreshold, o);
break;
}
if ((obj != null) && (obj.size() >= volMin) && (obj.size() <= volMax)) {
segmentedObjects.add(new Object3DVoxels(obj));
// IJ.log("obj size: "+obj.size());
o++;
} else if (obj != null) {
// erase from label image
for (Voxel3D vo : obj) {
labelImage.setPixel(vo.getRoundX(), vo.getRoundY(), vo.getRoundZ(), 0);
}
if (show) {
IJ.log("object volume outside range : " + obj.size());
}
}
}
}
}
}
}
use of mcib3d.geom.Object3D in project mcib3d-core by mcib3d.
the class Mitosis method checkValidMitosis.
public static boolean checkValidMitosis(Object3D daughter1, Object3D daughter2, ImageHandler image) {
Object3D convex = createConvexDaughters(daughter1, daughter2);
ArrayUtil values = convex.listValues(image).distinctValues();
IJ.log("Checking mitosis " + daughter1.getValue() + "-" + daughter2.getValue() + " " + values);
int val1 = daughter1.getValue();
int val2 = daughter2.getValue();
for (int i = 0; i < values.size(); i++) {
int val = values.getValueInt(i);
if (val != val1 && val != val2 && val > 0)
return false;
}
return true;
}
use of mcib3d.geom.Object3D in project mcib3d-core by mcib3d.
the class TrackingAssociation method drawAssociation.
private void drawAssociation() {
if (finalAssociations == null)
computeTracking();
// create results
this.tracked = this.img1.createSameDimensions();
if (this.path != null)
this.pathed = this.img1.createSameDimensions();
// draw results
int max = 0;
for (AssociationPair pair : finalAssociations) {
int val1 = pair.getObject3D1().getValue();
// object3D2.setValue(val1);
pair.getObject3D2().draw(this.tracked, val1);
if (val1 > max)
max = val1;
}
// orphan2
for (Object3D object3D : finalOrphan2) {
max++;
object3D.draw(this.tracked, max);
}
// mitosis
if ((mitosis) && (this.path != null)) {
for (Mitosis mitosis : finalMitosis) {
Object3D d1 = mitosis.getDaughter1();
Object3D d2 = mitosis.getDaughter2();
Object3D mo = mitosis.getMother();
int valPath = (int) mo.getPixMeanValue(this.path);
d1.draw(this.pathed, valPath);
d2.draw(this.pathed, valPath);
}
}
}
Aggregations