Skip to content

Commit

Permalink
Merge pull request #194 from mianalysis/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
sjcross committed Jun 17, 2024
2 parents 30e238f + 636bffd commit c3b527c
Show file tree
Hide file tree
Showing 40 changed files with 2,533 additions and 229 deletions.
4 changes: 2 additions & 2 deletions mia-algorithms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<parent>
<groupId>io.github.mianalysis</groupId>
<artifactId>pom-mia</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
</parent>

<groupId>io.github.mianalysis</groupId>
<artifactId>mia-algorithms</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<packaging>jar</packaging>
<name>mia-algorithms</name>
<url>https://github.com/mianalysis/mia</url>
Expand Down
4 changes: 2 additions & 2 deletions mia-bonej/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<parent>
<groupId>io.github.mianalysis</groupId>
<artifactId>pom-mia</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
</parent>

<groupId>io.github.mianalysis</groupId>
<artifactId>mia-bonej</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<packaging>jar</packaging>
<name>mia-bonej</name>
<url>https://github.com/mianalysis/mia</url>
Expand Down
4 changes: 2 additions & 2 deletions mia-coordinates/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<parent>
<groupId>io.github.mianalysis</groupId>
<artifactId>pom-mia</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
</parent>

<groupId>io.github.mianalysis</groupId>
<artifactId>mia-coordinates</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<packaging>jar</packaging>
<name>mia-coordinates</name>
<url>https://github.com/mianalysis/mia</url>
Expand Down
4 changes: 2 additions & 2 deletions mia-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<parent>
<groupId>io.github.mianalysis</groupId>
<artifactId>pom-mia</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
</parent>

<groupId>io.github.mianalysis</groupId>
<artifactId>mia-core</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<packaging>jar</packaging>
<name>mia-core</name>
<url>https://github.com/mianalysis/mia</url>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ public class Categories {
public final static Category OBJECTS_RELATE_MERGE = new Category("Merge",
"Modules used for combining either different objects into one or combining objects from different collections into a single collection.",
OBJECTS_RELATE);
public final static Category OBJECTS_TRACK = new Category("Track",
"Modules tracking objects between frames. Establishes parent-child relationships, with parent track objects acting as links for all instances of that track.",
OBJECTS);
public final static Category OBJECTS_TRANSFORM = new Category("Transform",
"Modules capable of updating coordinates of existing objects. These operations can include hole filling and masking.",
OBJECTS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ public void writeProgressStatus(int count, int total, String featureBeingProcess

public static void writeProgressStatus(int count, int total, String featureBeingProcessed, String moduleName) {
if (verbose)
writeStatus("Processed " + count + " of " + total + " " + featureBeingProcessed + " ("
writeStatus(count + "/" + total + " " + featureBeingProcessed + " ("
+ Math.floorDiv(100 * count, total) + "%)", moduleName);
}

Expand Down
73 changes: 62 additions & 11 deletions mia-core/src/main/java/io/github/mianalysis/mia/object/Obj.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import ij.IJ;
import ij.ImagePlus;
import ij.gui.Roi;
import io.github.mianalysis.mia.MIA;
import io.github.mianalysis.mia.object.coordinates.Point;
import io.github.mianalysis.mia.object.coordinates.volume.PointOutOfRangeException;
import io.github.mianalysis.mia.object.coordinates.volume.Volume;
Expand Down Expand Up @@ -208,7 +207,7 @@ public Obj getParent(String name) {
// If the first parent was the only one listed, returning this
if (elements.length == 1)
return parent;

// If there are additional parents listed, re-constructing the string and
// running this method on the parent
StringBuilder stringBuilder = new StringBuilder();
Expand All @@ -235,7 +234,10 @@ public void addParent(String name, Obj parent) {

public void removeParent(String name) {
parents.remove(name);
}

public void removeParent(Obj parent) {
parents.remove(parent.getName());
}

public LinkedHashMap<String, Objs> getChildren() {
Expand All @@ -249,8 +251,7 @@ public Objs getChildren(String name) {
// Getting the first set of children
Objs allChildren = children.get(elements[0]);
if (allChildren == null)
return new Objs(elements[0], spatCal, objCollection.getNFrames(), objCollection.getFrameInterval(),
objCollection.getTemporalUnit());
return new Objs(elements[0], objCollection);

// If the first set of children was the only one listed, returning this
if (elements.length == 1)
Expand All @@ -267,8 +268,7 @@ public Objs getChildren(String name) {

// Going through each child in the current set, then adding all their children
// to the output set
Objs outputChildren = new Objs(name, allChildren.getSpatialCalibration(),
objCollection.getNFrames(), objCollection.getFrameInterval(), objCollection.getTemporalUnit());
Objs outputChildren = new Objs(name, allChildren);
for (Obj child : allChildren.values()) {
Objs currentChildren = child.getChildren(stringBuilder.toString());
for (Obj currentChild : currentChildren.values())
Expand All @@ -294,8 +294,7 @@ public void removeChildren(String name) {
public void addChild(Obj child) {
String childName = child.getName();

children.computeIfAbsent(childName, k -> new Objs(childName, child.getSpatialCalibration(),
objCollection.getNFrames(), objCollection.getFrameInterval(), objCollection.getTemporalUnit()));
children.computeIfAbsent(childName, k -> new Objs(childName, child.getObjectCollection()));
children.get(childName).add(child);

}
Expand Down Expand Up @@ -329,8 +328,7 @@ public void removePartners(String name) {
public void addPartner(Obj partner) {
String partnerName = partner.getName();

partners.computeIfAbsent(partnerName, k -> new Objs(partnerName, partner.getSpatialCalibration(),
objCollection.getNFrames(), objCollection.getFrameInterval(), objCollection.getTemporalUnit()));
partners.computeIfAbsent(partnerName, k -> new Objs(partnerName, partner.getObjectCollection()));
partners.get(partnerName).add(partner);
}

Expand All @@ -344,6 +342,60 @@ public void removePartner(String name) {
partners.remove(name);
}

/**
* Returns any partners that happened in previous frames
*/
public Objs getPreviousPartners(String name) {
Objs allPartners = getPartners(name);

if (allPartners == null)
return new Objs(name, objCollection);

Objs previousPartners = new Objs(name, allPartners);
for (Obj partner : allPartners.values())
if (partner.getT() < T)
previousPartners.add(partner);

return previousPartners;

}

/**
* Returns any partners that happen in following frames
*/
public Objs getSimultaneousPartners(String name) {
Objs allPartners = getPartners(name);

if (allPartners == null)
return new Objs(name, objCollection);

Objs simultaneousPartners = new Objs(name, allPartners);
for (Obj partner : allPartners.values())
if (partner.getT() == T)
simultaneousPartners.add(partner);

return simultaneousPartners;

}

/**
* Returns any partners that happen in following frames
*/
public Objs getNextPartners(String name) {
Objs allPartners = getPartners(name);

if (allPartners == null)
return new Objs(name, objCollection);

Objs nextPartners = new Objs(name, allPartners);
for (Obj partner : allPartners.values())
if (partner.getT() > T)
nextPartners.add(partner);

return nextPartners;

}

/**
* Removes itself from any other objects as a parent or child.
*/
Expand Down Expand Up @@ -406,7 +458,6 @@ public Roi getRoi(int slice) {
if (rois.containsKey(slice))
return (Roi) rois.get(slice).clone();

MIA.log.writeDebug("ID "+ID);
Roi roi = super.getRoi(slice);

if (roi == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -737,8 +737,6 @@ public Roi getRoi(int slice) {

Roi roi = new ThresholdToSelection().convert(ipr);
double[][] extents = sliceVol.getExtents(true, false);
MIA.log.writeDebug("ROI "+roi);
MIA.log.writeDebug("Ex "+extents);
roi.translate(extents[0][0], extents[1][0]);

return roi;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,6 @@ public static HashMap<Integer, Float> getObjectMetadataHues(Objs objects, String
H = metadataHues.get(metadataItem.getValue());
hues.put(ID, H);

// MIA.log.writeDebug(metadataItem.getName());

}

return hues;
Expand Down
4 changes: 2 additions & 2 deletions mia-deepimagej/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<parent>
<groupId>io.github.mianalysis</groupId>
<artifactId>pom-mia</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
</parent>

<groupId>io.github.mianalysis</groupId>
<artifactId>mia-deepimagej</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<packaging>jar</packaging>
<name>mia-deepimagej</name>
<url>https://github.com/mianalysis/mia</url>
Expand Down
8 changes: 4 additions & 4 deletions mia-macros/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<parent>
<groupId>io.github.mianalysis</groupId>
<artifactId>pom-mia</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
</parent>

<groupId>io.github.mianalysis</groupId>
<artifactId>mia-macros</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<packaging>jar</packaging>
<name>mia-macros</name>
<url>https://github.com/mianalysis/mia</url>
Expand Down Expand Up @@ -127,13 +127,13 @@
<dependency>
<groupId>io.github.mianalysis</groupId>
<artifactId>mia-core</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
</dependency>

<dependency>
<groupId>io.github.mianalysis</groupId>
<artifactId>mia-modules</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
</dependency>
</dependencies>

Expand Down
8 changes: 4 additions & 4 deletions mia-modules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<parent>
<groupId>io.github.mianalysis</groupId>
<artifactId>pom-mia</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
</parent>

<groupId>io.github.mianalysis</groupId>
<artifactId>mia-modules</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
<packaging>jar</packaging>
<name>mia-modules</name>
<url>https://github.com/mianalysis/mia</url>
Expand Down Expand Up @@ -127,7 +127,7 @@
<dependency>
<groupId>io.github.mianalysis</groupId>
<artifactId>mia-core</artifactId>
<version>1.6.0</version>
<version>1.6.1</version>
</dependency>

<dependency>
Expand Down Expand Up @@ -188,7 +188,7 @@
<dependency>
<groupId>sc.fiji</groupId>
<artifactId>TrackMate</artifactId>
<version>7.10.0</version>
<version>7.12.2</version>
<scope>${scp}</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import org.scijava.plugin.Plugin;

import io.github.mianalysis.mia.module.lostandfound.LostAndFoundItem;
import io.github.mianalysis.mia.module.objects.relate.TrackObjects;
import io.github.mianalysis.mia.module.objects.track.TrackObjects;

@Plugin(type = LostAndFoundItem.class, priority = Priority.LOW, visible = true)
public class TrackObjectsLostFound extends LostAndFoundItem {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import io.github.mianalysis.mia.module.Category;
import io.github.mianalysis.mia.module.Module;
import io.github.mianalysis.mia.module.Modules;
import io.github.mianalysis.mia.module.objects.relate.TrackObjects;
import io.github.mianalysis.mia.module.objects.track.TrackObjects;
import io.github.mianalysis.mia.object.Obj;
import io.github.mianalysis.mia.object.Objs;
import io.github.mianalysis.mia.object.Workspace;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import io.github.mianalysis.mia.module.Modules;
import io.github.mianalysis.mia.module.objects.detect.IdentifyObjects;
import io.github.mianalysis.mia.module.objects.measure.intensity.MeasureObjectIntensity;
import io.github.mianalysis.mia.module.objects.relate.TrackObjects;
import io.github.mianalysis.mia.module.objects.track.TrackObjects;
import io.github.mianalysis.mia.object.Obj;
import io.github.mianalysis.mia.object.Objs;
import io.github.mianalysis.mia.object.VolumeTypesInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
import io.github.mianalysis.mia.module.Module;
import io.github.mianalysis.mia.module.Modules;
import io.github.mianalysis.mia.module.images.transform.ExtractSubstack;
import io.github.mianalysis.mia.module.objects.relate.TrackObjects;
import io.github.mianalysis.mia.module.objects.track.TrackObjects;
import io.github.mianalysis.mia.object.Obj;
import io.github.mianalysis.mia.object.Objs;
import io.github.mianalysis.mia.object.VolumeTypesInterface;
Expand Down Expand Up @@ -548,7 +548,6 @@ static void applyTemporalInterpolation(Image binaryImage) {
ImagePlus sliceIpl = ExtractSubstack.extractSubstack(binaryIpl,"Substack","1-1", z + "-" + z, "1-" + nFrames);
// ImagePlus sliceIpl = SubHyperstackMaker.makeSubhyperstack(binaryIpl, "1-1", z + "-" + z, "1-" + nFrames);
ImageStack sliceIst = sliceIpl.getStack();
MIA.log.writeDebug(sliceIst.size());

if (!checkStackForInterpolation(sliceIst))
continue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,20 @@ protected Status process(Workspace workspace) {
while (iterator.hasNext()) {
Obj inputObject = iterator.next();

LinkedHashMap<String, Obj> parents = inputObject.getParents(true);
Obj parentObject = inputObject.getParent(parentObjectName);
// LinkedHashMap<String, Obj> parents = inputObject.getParents(true);
switch (filterMethod) {
case FilterMethods.WITH_PARENT:
if (parents.get(parentObjectName) != null) {
if (parentObject != null) {
// if (parents.get(parentObjectName) != null) {
count++;
if (remove)
processRemoval(inputObject, outputObjects, iterator);
}
break;
case FilterMethods.WITHOUT_PARENT:
if (parents.get(parentObjectName) == null) {
if (parentObject == null) {
// if (parents.get(parentObjectName) == null) {
count++;
if (remove)
processRemoval(inputObject, outputObjects, iterator);
Expand Down
Loading

0 comments on commit c3b527c

Please sign in to comment.