Skip to content

Commit

Permalink
Updated for compatibility with MIA 0.12.0
Browse files Browse the repository at this point in the history
Former-commit-id: b4379e9
  • Loading branch information
sjcross committed Mar 9, 2020
1 parent 4d2c29c commit a668fc7
Show file tree
Hide file tree
Showing 62 changed files with 2,691 additions and 58 deletions.
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>VideoHandler</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions .settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding/<project>=UTF-8
4 changes: 4 additions & 0 deletions .settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"java.configuration.updateBuildConfiguration": "automatic"
}
49 changes: 49 additions & 0 deletions core/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
348 changes: 348 additions & 0 deletions core/.factorypath

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions core/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>core</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
4 changes: 4 additions & 0 deletions core/.settings/org.eclipse.core.resources.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding/<project>=UTF-8
4 changes: 4 additions & 0 deletions core/.settings/org.eclipse.jdt.apt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
eclipse.preferences.version=1
org.eclipse.jdt.apt.aptEnabled=true
org.eclipse.jdt.apt.genSrcDir=target\\generated-sources\\annotations
org.eclipse.jdt.apt.genTestSrcDir=target\\generated-test-sources\\test-annotations
9 changes: 9 additions & 0 deletions core/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.processAnnotations=enabled
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8
4 changes: 4 additions & 0 deletions core/.settings/org.eclipse.m2e.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1
12 changes: 4 additions & 8 deletions core/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<parent>
<artifactId>VideoHandler</artifactId>
<groupId>wbif.sjx</groupId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>core</artifactId>
Expand All @@ -25,7 +25,7 @@
<dependency>
<groupId>com.github.SJCross</groupId>
<artifactId>ModularImageAnalysis</artifactId>
<version>0.11.15</version>
<version>0.12.0</version>
<scope>provided</scope>
<exclusions>
<exclusion>
Expand Down Expand Up @@ -109,12 +109,8 @@
<groupId>de.biomedical-imaging.imagej</groupId>
</exclusion>
<exclusion>
<artifactId>javacv-platform</artifactId>
<groupId>org.bytedeco</groupId>
</exclusion>
<exclusion>
<artifactId>reflections</artifactId>
<groupId>org.reflections</groupId>
<artifactId>classgraph</artifactId>
<groupId>io.github.classgraph</groupId>
</exclusion>
<exclusion>
<artifactId>commonmark</artifactId>
Expand Down
4 changes: 2 additions & 2 deletions core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>VideoHandler</artifactId>
<groupId>wbif.sjx</groupId>
<version>1.0.0</version>
<version>1.0.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down Expand Up @@ -49,7 +49,7 @@
<dependency>
<groupId>com.github.SJCross</groupId>
<artifactId>ModularImageAnalysis</artifactId>
<version>0.11.15</version>
<version>0.12.0</version>
<scope>${myscope}</scope>
</dependency>
</dependencies>
Expand Down
54 changes: 21 additions & 33 deletions core/src/main/java/wbif/sjx/VideoHandler/VideoLoader.java
Original file line number Diff line number Diff line change
@@ -1,37 +1,34 @@
package wbif.sjx.VideoHandler;

import ij.IJ;
import org.apache.commons.io.FilenameUtils;

import ij.ImagePlus;
import ij.ImageStack;
import ij.measure.Calibration;
import ij.plugin.ChannelSplitter;
import ij.process.ImageProcessor;
import org.apache.commons.io.FilenameUtils;
import wbif.sjx.MIA.MIA;
import wbif.sjx.MIA.Module.ImageProcessing.Stack.ConvertStackToTimeseries;
import wbif.sjx.MIA.Module.InputOutput.ImageLoader;
import wbif.sjx.MIA.Module.Module;
import wbif.sjx.MIA.Module.ModuleCollection;
import wbif.sjx.MIA.Module.PackageNames;
import wbif.sjx.MIA.Module.InputOutput.ImageLoader;
import wbif.sjx.MIA.Object.Image;
import wbif.sjx.MIA.Object.Parameters.*;
import wbif.sjx.MIA.Object.Units;
import wbif.sjx.MIA.Object.Workspace;
import wbif.sjx.MIA.Object.Parameters.BooleanP;
import wbif.sjx.MIA.Object.Parameters.ChoiceP;
import wbif.sjx.MIA.Object.Parameters.DoubleP;
import wbif.sjx.MIA.Object.Parameters.FilePathP;
import wbif.sjx.MIA.Object.Parameters.InputImageP;
import wbif.sjx.MIA.Object.Parameters.IntegerP;
import wbif.sjx.MIA.Object.Parameters.OutputImageP;
import wbif.sjx.MIA.Object.Parameters.ParamSeparatorP;
import wbif.sjx.MIA.Object.Parameters.ParameterCollection;
import wbif.sjx.MIA.Object.Parameters.StringP;
import wbif.sjx.MIA.Object.Parameters.TextAreaP;
import wbif.sjx.MIA.Object.References.ImageMeasurementRefCollection;
import wbif.sjx.MIA.Object.References.MetadataRefCollection;
import wbif.sjx.MIA.Object.References.ObjMeasurementRefCollection;
import wbif.sjx.MIA.Object.References.RelationshipRefCollection;
import wbif.sjx.MIA.Object.Units;
import wbif.sjx.MIA.Object.Workspace;
import wbif.sjx.MIA.Process.CommaSeparatedStringInterpreter;
import wbif.sjx.common.Object.Metadata;

import javax.annotation.Nullable;
import java.io.FileNotFoundException;
import java.util.Arrays;
import java.util.TreeSet;
import java.util.stream.Collectors;

import static wbif.sjx.MIA.Module.ImageProcessing.Stack.ExtractSubstack.extendRangeToEnd;

public class VideoLoader extends Module {
public static final String LOADER_SEPARATOR = "Core video loading controls";
public static final String OUTPUT_IMAGE = "Output image";
Expand Down Expand Up @@ -103,14 +100,12 @@ public interface Measurements {
public String getGenericName(Metadata metadata, String genericFormat) {
String absolutePath = metadata.getFile().getAbsolutePath();
String path = FilenameUtils.getFullPath(absolutePath);
String name = FilenameUtils.removeExtension(FilenameUtils.getName(absolutePath));
String comment = metadata.getComment();
String filename = ImageLoader.compileGenericFilename(genericFormat, metadata);
return path + filename;

}

public String getPrefixName(Metadata metadata, int seriesNumber, boolean includeSeries, String ext) {
public String getPrefixName(Metadata metadata, boolean includeSeries, String ext) {
String absolutePath = metadata.getFile().getAbsolutePath();
String path = FilenameUtils.getFullPath(absolutePath);
String name = FilenameUtils.removeExtension(FilenameUtils.getName(absolutePath));
Expand All @@ -121,7 +116,7 @@ public String getPrefixName(Metadata metadata, int seriesNumber, boolean include

}

public String getSuffixName(Metadata metadata, int seriesNumber, boolean includeSeries, String ext ) {
public String getSuffixName(Metadata metadata, boolean includeSeries, String ext ) {
String absolutePath = metadata.getFile().getAbsolutePath();
String path = FilenameUtils.getFullPath(absolutePath);
String name = FilenameUtils.removeExtension(FilenameUtils.getName(absolutePath));
Expand Down Expand Up @@ -168,9 +163,6 @@ public boolean process(Workspace workspace) {
double xyCal = parameters.getValue(XY_CAL);
double zCal = parameters.getValue(Z_CAL);

// Series number comes from the Workspace
int seriesNumber = workspace.getMetadata().getSeriesNumber();

int[] crop = null;
switch (cropMode) {
case CropModes.FIXED:
Expand Down Expand Up @@ -199,13 +191,13 @@ public boolean process(Workspace workspace) {
case NameFormats.INPUT_FILE_PREFIX:
metadata = (Metadata) workspace.getMetadata().clone();
metadata.setComment(prefix);
pathName = getPrefixName(metadata, seriesNumber, includeSeriesNumber,ext);
pathName = getPrefixName(metadata, includeSeriesNumber,ext);
break;

case NameFormats.INPUT_FILE_SUFFIX:
metadata = (Metadata) workspace.getMetadata().clone();
metadata.setComment(suffix);
pathName = getSuffixName(metadata, seriesNumber, includeSeriesNumber,ext);
pathName = getSuffixName(metadata, includeSeriesNumber,ext);
break;
}
break;
Expand All @@ -217,7 +209,6 @@ public boolean process(Workspace workspace) {

if (pathName == null) return false;

String extension = FilenameUtils.getExtension(pathName);
Image outputImage = null;
try {
// First first, testing new loader
Expand Down Expand Up @@ -245,9 +236,6 @@ public boolean process(Workspace workspace) {

}

// Converting RGB to 3-channel
ImagePlus outputImagePlus = outputImage.getImagePlus();

// Adding image to workspace
writeMessage("Adding image (" + outputImageName + ") to workspace");
workspace.addImage(outputImage);
Expand Down Expand Up @@ -352,7 +340,7 @@ public ParameterCollection updateAndGetParameters() {

returnedParameters.add(parameters.getParameter(CALIBRATION_SEPARATOR));
returnedParameters.add(parameters.getParameter(SET_CAL));
if (parameters.getValue(SET_CAL)) {
if ((boolean) parameters.getValue(SET_CAL)) {
returnedParameters.add(parameters.getParameter(XY_CAL));
returnedParameters.add(parameters.getParameter(Z_CAL));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ public static ImagePlus getVideo(String path, String frameRange, String channelR
ipl.getCalibration().pixelDepth = 1;
}

// Closing the loader
loader.close();

return ipl;

}
Expand All @@ -104,7 +107,7 @@ public static void convertToTimeseries(ImagePlus inputImagePlus) {
}

public static int[] extendRangeToEnd(int[] inputRange, int end) {
TreeSet<Integer> values = new TreeSet();
TreeSet<Integer> values = new TreeSet<>();

int start;
for(start = 0; start < inputRange.length - 3; ++start) {
Expand Down
5 changes: 2 additions & 3 deletions core/src/main/java/wbif/sjx/VideoHandler/Video_Loader.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package wbif.sjx.VideoHandler;

import ij.ImagePlus;
import java.io.File;

import ij.gui.GenericDialog;
import ij.io.OpenDialog;
import ij.plugin.PlugIn;

import java.io.File;

public class Video_Loader implements PlugIn {
@Override
public void run(String path) {
Expand Down
44 changes: 44 additions & 0 deletions linux32/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="target/generated-sources/annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
<attribute name="ignore_optional_problems" value="true"/>
<attribute name="m2e-apt" value="true"/>
<attribute name="test" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Loading

0 comments on commit a668fc7

Please sign in to comment.