Skip to content

Commit

Permalink
Merge branch 'extraspanel' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
sjcross committed Aug 13, 2024
2 parents 5599f55 + 20ced11 commit 7d89810
Show file tree
Hide file tree
Showing 82 changed files with 1,192 additions and 6,635 deletions.
28 changes: 28 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
{
"configurations": [
{
"type": "java",
"name": "MenDemo",
"request": "launch",
"mainClass": "io.github.mianalysis.mia.gui.regions.workflowmodules.MenDemo",
"projectName": "mia-plugin"
},
{
"type": "java",
"name": "Test",
"request": "launch",
"mainClass": "io.github.mianalysis.mia.gui.regions.editingpanel.Test",
"projectName": "mia-plugin"
},
{
"type": "java",
"name": "EditingPanel",
"request": "launch",
"mainClass": "io.github.mianalysis.mia.gui.regions.editingpanel.EditingPanel",
"projectName": "mia-plugin"
},
{
"type": "java",
"name": "ProjectImage",
"request": "launch",
"mainClass": "io.github.mianalysis.mia.module.images.transform.ProjectImage",
"projectName": "mia-modules"
},
{
"type": "java",
"name": "CommaSeparatedStringInterpreter",
Expand Down
15 changes: 3 additions & 12 deletions mia-core/src/main/java/io/github/mianalysis/mia/MIAHeadless.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import java.awt.GraphicsEnvironment;
import java.io.File;
import java.io.IOException;
import java.util.LinkedHashMap;

import org.scijava.ItemVisibility;
Expand Down Expand Up @@ -109,18 +108,10 @@ public void run() {
applyGlobalVariables(modules, variables);

// Running analysis
Thread t = new Thread(() -> {
try {
new AnalysisRunner().run(modules);
new AnalysisRunner().run(modules);

if (GraphicsEnvironment.isHeadless())
java.lang.System.exit(0);

} catch (InterruptedException | IOException e) {
MIA.log.writeError(e);
}
});
t.start();
if (GraphicsEnvironment.isHeadless())
java.lang.System.exit(0);

} catch (Exception e) {
e.printStackTrace();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import java.util.HashMap;
import java.util.List;

import org.scijava.InstantiableException;
import org.scijava.plugin.PluginInfo;

import io.github.mianalysis.mia.MIA;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,11 @@ public class Colours {
private static final Color RED = new Color(217, 66, 66); // #d94242
private static final Color RED_DM = new Color(225,106,106); // #e16a6a

private static final Color LIGHT_GREY = new Color(210, 210, 210); // #d2d2d2
private static final Color LIGHT_GREY_DM = new Color(66, 66, 66); // #424242

private static final Color DARK_GREY = new Color(66, 66, 66); // #424242
private static final Color DARK_GREY_DM = new Color(66, 66, 66); // #424242
private static final Color DARK_GREY_DM = new Color(190, 190, 190); // #bebebe

public static Color getLightBlue(boolean darkMode) {
if (darkMode)
Expand Down Expand Up @@ -69,6 +72,13 @@ public static Color getRed(boolean darkMode) {
return RED;
}

public static Color getLightGrey(boolean darkMode) {
if (darkMode)
return LIGHT_GREY_DM;
else
return LIGHT_GREY;
}

public static Color getDarkGrey(boolean darkMode) {
if (darkMode)
return DARK_GREY_DM;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void run(Modules modules, boolean clearMemoryAtEnd) throws InterruptedExc

}

for (Workspace workspace : workspaces)
for (Workspace workspace : workspaces)
pool.submit(createRunnable(modules, workspace, exporter, clearMemoryAtEnd));

// Telling the pool not to accept any more jobs and to wait until all queued
Expand Down Expand Up @@ -351,6 +351,15 @@ Runnable createRunnable(Modules modules, Workspace workspace, Exporter exporter,
workspace.clearAllObjects(true);

}

// Thread currThread = Thread.currentThread();
// System.out.println("Parent "+currThread.getName());
// Thread[] group = new Thread[currThread.activeCount()];
// currThread.enumerate(group);
// for (Thread item:group) {
// item.stop(null);
// System.out.println(" Child "+item.getName());
// }
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,8 @@ public Status process(Workspace workspace) {
RGBStackConverter.convertToRGB(inputImagePlus);
}

inputImagePlus.duplicate().show();

// Converting the bit depth to an integer
int bitDepth = Integer.parseInt(outputBitDepth);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import io.github.mianalysis.mia.object.Objs;
import io.github.mianalysis.mia.object.VolumeTypesInterface;
import io.github.mianalysis.mia.object.Workspace;
import io.github.mianalysis.mia.object.coordinates.Point;
import io.github.mianalysis.mia.object.coordinates.volume.SpatCal;
import io.github.mianalysis.mia.object.image.Image;
import io.github.mianalysis.mia.object.image.ImageFactory;
Expand Down Expand Up @@ -442,6 +443,7 @@ public static Objs process(Image inputImage, String outputObjectsName, boolean b
}
}


return outputObjects;

}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package io.github.mianalysis.mia.module.system;

import java.util.Random;

import org.scijava.Priority;
import org.scijava.plugin.Plugin;

Expand All @@ -24,6 +26,9 @@
import net.imagej.ImgPlus;
import net.imagej.axis.Axes;
import net.imagej.axis.DefaultLinearAxis;
import net.imglib2.Cursor;
import net.imglib2.RandomAccess;
import net.imglib2.cache.img.DiskCachedCellImg;
import net.imglib2.cache.img.DiskCachedCellImgFactory;
import net.imglib2.type.NativeType;
import net.imglib2.type.numeric.RealType;
Expand Down Expand Up @@ -61,10 +66,11 @@ public Status process(Workspace workspace) {

int w = 2000;
int h = 2000;
int d = 3000;
int d = 20;

ImgPlus<FloatType> img = new ImgPlus<>(
new DiskCachedCellImgFactory<>(new FloatType()).create(new int[] { 2000, 2000, 2, 20, 40 }));
DiskCachedCellImg dcImage = new DiskCachedCellImgFactory<>(new FloatType())
.create(new int[] { 2000, 2000, 1, 400, 30 });
ImgPlus<FloatType> img = new ImgPlus<>(dcImage);
// ImgPlus<FloatType> img = (ImgPlus<FloatType>)
// ImgPlusTools.createNewImgPlus(w, h, 0, d, 0, 0.2, 0.1, "um",
// new FloatType());
Expand All @@ -77,16 +83,32 @@ public Status process(Workspace workspace) {

// Creating a ramp intensity gradient along the x-axis, so operations can be
// tested
// RandomAccess ra = img.randomAccess();
RandomAccess ra = img.randomAccess();
// Random random = new Random();
// for (int i = 0; i < 1000000; i++) {
// for (int i = 0; i < 10000; i++) {
// int x = (int) Math.floor(random.nextDouble() * w);
// int y = (int) Math.floor(random.nextDouble() * h);
// int z = (int) Math.floor(random.nextDouble() * d);
// ra.setPosition(new int[] { x, y, z });
// ra.setPosition(new int[] { x, y, z, 0, 0 });
// ((FloatType) ra.get()).set(1000);
// }
// Cursor<T> c = img.cursor();
for (int x = 0; x < 10; x++) {
for (int y = 0; y < 20; y++) {
ra.setPosition(new int[] { x, y, 0, 0, 0 });
((FloatType) ra.get()).set(1000);
}
}

dcImage.shutdown();

for (int x = 100; x < 120; x++) {
for (int y = 100; y < 110; y++) {
ra.setPosition(new int[] { x, y, 0, 0, 0 });
((FloatType) ra.get()).set(1000);
}
}

// Cursor<FloatType> c = img.cursor();
// while (c.hasNext()) {
// c.fwd();
// ((FloatType) c.get()).set(c.getFloatPosition(0));
Expand Down Expand Up @@ -129,8 +151,8 @@ public ObjMeasurementRefs updateAndGetObjectMeasurementRefs() {
}

@Override
public ObjMetadataRefs updateAndGetObjectMetadataRefs() {
return null;
public ObjMetadataRefs updateAndGetObjectMetadataRefs() {
return null;
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion mia-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
<dependency>
<groupId>com.formdev</groupId>
<artifactId>flatlaf</artifactId>
<version>3.4</version>
<version>3.5</version>
<scope>${scp}</scope>
</dependency>

Expand Down
Loading

0 comments on commit 7d89810

Please sign in to comment.