Skip to content

Commit b7aa65c

Browse files
authored
Merge pull request #243 from mianalysis/develop
Develop
2 parents 5b499f9 + 574e22c commit b7aa65c

29 files changed

Lines changed: 2986 additions & 1087 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Acknowledgements
7474
------------
7575
The plugin makes use of a combination of plugins packaged with Fiji as well as others that can be installed via the updater.
7676

77-
Required plugins pre-packaged with Fiji: [AnalyzeSkeleton](https://github.com/fiji/AnalyzeSkeleton), [Auto Threshold](https://github.com/fiji/Auto_Threshold), [bUnwarpJ](https://github.com/fiji/bUnwarpJ), [Bio-Formats](https://github.com/openmicroscopy/bioformats), [Colour Deconvolution](https://github.com/fiji/Colour_Deconvolution), [Correct Bleach](https://github.com/fiji/CorrectBleach), [MPICBG](https://github.com/axtimwalde/mpicbg), [TrackMate](https://github.com/fiji/TrackMate), [Weka Trainable Segmentation](https://github.com/fiji/Trainable_Segmentation). Required plugins that need installing via the ImageJ updater: [MorphoLibJ](https://github.com/ijpb/MorphoLibJ). Plugins bundled with MIA: [Stack Focuser](https://imagej.nih.gov/ij/plugins/stack-focuser.html).
77+
Required plugins pre-packaged with Fiji: [AnalyzeSkeleton](https://github.com/fiji/AnalyzeSkeleton), [Auto Threshold](https://github.com/fiji/Auto_Threshold), [bUnwarpJ](https://github.com/fiji/bUnwarpJ), [Bio-Formats](https://github.com/openmicroscopy/bioformats), [Colour Deconvolution](https://github.com/fiji/Colour_Deconvolution), [Correct Bleach](https://github.com/fiji/CorrectBleach), [MPICBG](https://github.com/axtimwalde/mpicbg), [TrackMate](https://github.com/fiji/TrackMate), [Weka Trainable Segmentation](https://github.com/fiji/Trainable_Segmentation). Required plugins that need installing via the ImageJ updater: [MorphoLibJ](https://github.com/ijpb/MorphoLibJ). Plugins bundled with MIA: [Colour Deconvolution 2](https://blog.bham.ac.uk/intellimic/g-landini-software/colour-deconvolution-2/), [Stack Focuser](https://imagej.nih.gov/ij/plugins/stack-focuser.html).
7878

7979
A list of bundled dependencies along with their respective licenses can be found [here](https://htmlpreview.github.io/?https://github.com/mianalysis/mia/blob/master/target/site/dependencies.html).
8080

mia-algorithms/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
<parent>
77
<groupId>io.github.mianalysis</groupId>
88
<artifactId>pom-mia</artifactId>
9-
<version>1.7.22</version>
9+
<version>1.7.23</version>
1010
</parent>
1111

1212
<groupId>io.github.mianalysis</groupId>
1313
<artifactId>mia-algorithms</artifactId>
14-
<version>1.7.22</version>
14+
<version>1.7.23</version>
1515
<packaging>jar</packaging>
1616
<name>mia-algorithms</name>
1717
<url>https://github.com/mianalysis/mia</url>

mia-algorithms/src/main/java/io/github/mianalysis/mia/object/imagej/LUTs.java

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package io.github.mianalysis.mia.object.imagej;
22

33
import java.awt.Color;
4+
import java.awt.image.IndexColorModel;
5+
6+
import ij.LookUpTable;
47
import ij.process.LUT;
58

69
import java.util.Random;
@@ -440,22 +443,7 @@ public static LUT HiLo() {
440443
}
441444

442445
public static LUT Grey() {
443-
byte[] reds = new byte[] { -128, -127, -126, -125, -124, -123, -122, -121, -120, -119, -118, -117, -116,
444-
-115, -114, -113, -112, -111, -110, -109, -108, -107, -106, -105, -104, -103, -102,
445-
-101, -100, -99, -98, -97, -96, -95, -94, -93, -92, -91, -90, -89, -88, -87, -86, -85,
446-
-84, -83, -82, -81, -80, -79, -78, -77, -76, -75, -74, -73, -72, -71, -70, -69, -68,
447-
-67, -66, -65, -64, -63, -62, -61, -60, -59, -58, -57, -56, -55, -54, -53, -52, -51,
448-
-50, -49, -48, -47, -46, -45, -44, -43, -42, -41, -40, -39, -38, -37, -36, -35, -34,
449-
-33, -32, -31, -30, -29, -28, -27, -26, -25, -24, -23, -22, -21, -20, -19, -18, -17,
450-
-16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5,
451-
6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
452-
29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
453-
51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72,
454-
73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
455-
95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112,
456-
113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127 };
457-
458-
return new LUT(reds, reds, reds);
446+
return new LUT((IndexColorModel) LookUpTable.createGrayscaleColorModel(false),0,255);
459447

460448
}
461449

mia-algorithms/src/main/java/io/github/mianalysis/mia/process/imagej/ImageTiler.java

Lines changed: 33 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static void copyImageCalibration(ImagePlus inputIpl, ImagePlus outputIpl)
2222
// Applying new calibration
2323
Calibration inputCal = inputIpl.getCalibration();
2424
Calibration outputCal = outputIpl.getCalibration();
25-
25+
2626
outputCal.pixelWidth = inputCal.pixelWidth;
2727
outputCal.pixelHeight = inputCal.pixelHeight;
2828
outputCal.pixelDepth = inputCal.pixelDepth;
@@ -32,18 +32,23 @@ public static void copyImageCalibration(ImagePlus inputIpl, ImagePlus outputIpl)
3232

3333
}
3434

35-
public static ImagePlus tile(ImagePlus inputIpl, int xNumTiles, int yNumTiles, int xOverlapPx, int yOverlapPx,
36-
String tileAxis) {
35+
public static int getNumberOfTiles() {
36+
return -1;
37+
}
38+
39+
public static int getTileSize(int imageSize, int overlap, int nTiles) {
40+
return (int) Math.ceil(Math.ceil((double) (imageSize - overlap) / (double) nTiles)) + overlap;
41+
}
42+
43+
public static int getTileCount(int imageSize, int overlap, int tileSize) {
44+
return (int) Math.ceil(Math.ceil((double) (imageSize - overlap) / (double) tileSize));
45+
}
46+
47+
public static ImagePlus tile(ImagePlus inputIpl, int xNumTiles, int yNumTiles, int xTileSize, int yTileSize,
48+
int xOverlapPx, int yOverlapPx, String tileAxis) {
3749
inputIpl = inputIpl.duplicate();
3850
String title = "Tiled_" + inputIpl.getTitle();
3951

40-
int coreTileWidth = (int) Math
41-
.round(Math.round((double) (inputIpl.getWidth() - xOverlapPx) / (double) xNumTiles));
42-
int tileWidth = coreTileWidth + xOverlapPx;
43-
int coreTileHeight = (int) Math
44-
.round(Math.round((double) (inputIpl.getHeight() - yOverlapPx) / (double) yNumTiles));
45-
int tileHeight = coreTileHeight + yOverlapPx;
46-
4752
int nChannels = inputIpl.getNChannels();
4853
int nSlices = inputIpl.getNSlices();
4954
int nFrames = inputIpl.getNFrames();
@@ -67,19 +72,21 @@ public static ImagePlus tile(ImagePlus inputIpl, int xNumTiles, int yNumTiles, i
6772
break;
6873
}
6974

70-
ImagePlus outputIpl = IJ.createHyperStack(title, tileWidth, tileHeight, nChannels, nSlices, nFrames, bitDepth);
75+
ImagePlus outputIpl = IJ.createHyperStack(title, xTileSize, yTileSize, nChannels, nSlices, nFrames,
76+
bitDepth);
7177

7278
ImageStack outputIst = outputIpl.getStack();
7379
int count = 0;
7480
for (int y = 0; y < yNumTiles; y++) {
7581
for (int x = 0; x < xNumTiles; x++) {
76-
int x0 = x * coreTileWidth;
77-
int y0 = y * coreTileHeight;
78-
inputIpl.setRoi(new Roi(x0, y0, tileWidth, tileHeight));
82+
int x0 = x * (xTileSize - xOverlapPx);
83+
int y0 = y * (yTileSize - yOverlapPx);
84+
inputIpl.setRoi(new Roi(x0, y0, xTileSize, yTileSize));
7985

8086
ImagePlus tileIpl = inputIpl.crop("stack");
81-
if (tileIpl.getWidth() < tileWidth || tileIpl.getHeight() < tileHeight)
82-
tileIpl.setStack(new CanvasResizer().expandStack(tileIpl.getStack(), tileWidth, tileHeight, 0, 0));
87+
if (tileIpl.getWidth() < xTileSize || tileIpl.getHeight() < yTileSize)
88+
tileIpl.setStack(
89+
new CanvasResizer().expandStack(tileIpl.getStack(), xTileSize, yTileSize, 0, 0));
8390

8491
ImageStack tileIst = tileIpl.getStack();
8592
for (int c = 0; c < inputIpl.getNChannels(); c++) {
@@ -107,17 +114,11 @@ public static ImagePlus tile(ImagePlus inputIpl, int xNumTiles, int yNumTiles, i
107114

108115
}
109116

110-
public static ImagePlus stitch(ImagePlus inputIpl, int xNumTiles, int yNumTiles, int xOverlapPx, int yOverlapPx,
111-
int outputWidth, int outputHeight,
112-
String tileAxis) {
117+
public static ImagePlus stitch(ImagePlus inputIpl, int xNumTiles, int yNumTiles, int xTileSize, int yTileSize,
118+
int xOverlapPx, int yOverlapPx, int outputWidth, int outputHeight, String tileAxis) {
113119
inputIpl = inputIpl.duplicate();
114120
String title = "Stitched_" + inputIpl.getTitle();
115121

116-
int tileWidth = inputIpl.getWidth();
117-
int coreTileWidth = tileWidth - xOverlapPx;
118-
int tileHeight = inputIpl.getHeight();
119-
int coreTileHeight = tileHeight - yOverlapPx;
120-
121122
int nChannels = inputIpl.getNChannels();
122123
int nSlices = inputIpl.getNSlices();
123124
int nFrames = inputIpl.getNFrames();
@@ -153,8 +154,8 @@ public static ImagePlus stitch(ImagePlus inputIpl, int xNumTiles, int yNumTiles,
153154
int count = 0;
154155
for (int y = 0; y < yNumTiles; y++) {
155156
for (int x = 0; x < xNumTiles; x++) {
156-
int x0 = x * coreTileWidth;
157-
int y0 = y * coreTileHeight;
157+
int x0 = x * (xTileSize-xOverlapPx);
158+
int y0 = y * (yTileSize-yOverlapPx);
158159

159160
for (int c = 0; c < nChannels; c++) {
160161
for (int z = 0; z < nSlices; z++) {
@@ -167,11 +168,11 @@ public static ImagePlus stitch(ImagePlus inputIpl, int xNumTiles, int yNumTiles,
167168
ImageProcessor inputIpr = inputIst.getProcessor(inputIdx);
168169
ImageProcessor outputIpr = outputIst.getProcessor(outputIdx);
169170

170-
for (int xx = 0; xx < tileWidth; xx++) {
171+
for (int xx = 0; xx < xTileSize; xx++) {
171172
if (xx + x0 >= outputWidth)
172173
break;
173174

174-
for (int yy = 0; yy < tileHeight; yy++) {
175+
for (int yy = 0; yy < yTileSize; yy++) {
175176
if (yy + y0 >= outputHeight)
176177
break;
177178

@@ -180,14 +181,14 @@ public static ImagePlus stitch(ImagePlus inputIpl, int xNumTiles, int yNumTiles,
180181
if (xx < xOverlapPx && x != 0)
181182
multiplier *= (1 - (xOverlapPx - xx) / (float) xOverlapPx);
182183

183-
if (xx >= coreTileWidth && x != xNumTiles - 1)
184-
multiplier *= (tileWidth - xx) / (float) xOverlapPx;
184+
if (xx >= (xTileSize-xOverlapPx) && x != xNumTiles - 1)
185+
multiplier *= (xTileSize - xx) / (float) xOverlapPx;
185186

186187
if (yy < yOverlapPx && y != 0)
187188
multiplier *= (1 - (yOverlapPx - yy) / (float) yOverlapPx);
188189

189-
if (yy >= coreTileHeight && y != yNumTiles - 1)
190-
multiplier *= (tileHeight - yy) / (float) yOverlapPx;
190+
if (yy >= (yTileSize-yOverlapPx) && y != yNumTiles - 1)
191+
multiplier *= (yTileSize - yy) / (float) yOverlapPx;
191192

192193
outputIpr.setf(xx + x0, yy + y0,
193194
outputIpr.getf(xx + x0, yy + y0) + inputIpr.getf(xx, yy) * multiplier);

mia-bonej/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
<parent>
77
<groupId>io.github.mianalysis</groupId>
88
<artifactId>pom-mia</artifactId>
9-
<version>1.7.22</version>
9+
<version>1.7.23</version>
1010
</parent>
1111

1212
<groupId>io.github.mianalysis</groupId>
1313
<artifactId>mia-bonej</artifactId>
14-
<version>1.7.22</version>
14+
<version>1.7.23</version>
1515
<packaging>jar</packaging>
1616
<name>mia-bonej</name>
1717
<url>https://github.com/mianalysis/mia</url>

mia-coordinates/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
<parent>
77
<groupId>io.github.mianalysis</groupId>
88
<artifactId>pom-mia</artifactId>
9-
<version>1.7.22</version>
9+
<version>1.7.23</version>
1010
</parent>
1111

1212
<groupId>io.github.mianalysis</groupId>
1313
<artifactId>mia-coordinates</artifactId>
14-
<version>1.7.22</version>
14+
<version>1.7.23</version>
1515
<packaging>jar</packaging>
1616
<name>mia-coordinates</name>
1717
<url>https://github.com/mianalysis/mia</url>

mia-core/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
<parent>
77
<groupId>io.github.mianalysis</groupId>
88
<artifactId>pom-mia</artifactId>
9-
<version>1.7.22</version>
9+
<version>1.7.23</version>
1010
</parent>
1111

1212
<groupId>io.github.mianalysis</groupId>
1313
<artifactId>mia-core</artifactId>
14-
<version>1.7.22</version>
14+
<version>1.7.23</version>
1515
<packaging>jar</packaging>
1616
<name>mia-core</name>
1717
<url>https://github.com/mianalysis/mia</url>

mia-core/src/main/java/io/github/mianalysis/mia/process/ColourFactory.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,8 +582,6 @@ public static TreeMap<String,String> getColourMaps() {
582582
allLUTs.putAll(imageJLUTs);
583583
Arrays.stream(ColourMaps.ALL).forEach(v -> allLUTs.put(v,v));
584584

585-
MIA.log.writeDebug(allLUTs);
586-
587585
return allLUTs;
588586

589587
}

mia-deepimagej/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
<parent>
77
<groupId>io.github.mianalysis</groupId>
88
<artifactId>pom-mia</artifactId>
9-
<version>1.7.22</version>
9+
<version>1.7.23</version>
1010
</parent>
1111

1212
<groupId>io.github.mianalysis</groupId>
1313
<artifactId>mia-deepimagej</artifactId>
14-
<version>1.7.22</version>
14+
<version>1.7.23</version>
1515
<packaging>jar</packaging>
1616
<name>mia-deepimagej</name>
1717
<url>https://github.com/mianalysis/mia</url>

mia-deepimagej/src/main/java/io/github/mianalysis/mia/module/images/process/ApplyDeepImageJModel.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import org.scijava.plugin.Plugin;
55

66
import deepimagej.DeepImageJ;
7-
import ij.CompositeImage;
87
import ij.IJ;
98
import ij.ImagePlus;
109
import ij.ImageStack;
@@ -17,7 +16,6 @@
1716
import io.github.mianalysis.mia.object.Workspace;
1817
import io.github.mianalysis.mia.object.image.Image;
1918
import io.github.mianalysis.mia.object.image.ImageFactory;
20-
import io.github.mianalysis.mia.object.imagej.LUTs;
2119
import io.github.mianalysis.mia.object.measurements.Measurement;
2220
import io.github.mianalysis.mia.object.parameters.BooleanP;
2321
import io.github.mianalysis.mia.object.parameters.ChoiceP;
@@ -37,7 +35,6 @@
3735
import io.github.mianalysis.mia.object.refs.collections.PartnerRefs;
3836
import io.github.mianalysis.mia.object.system.Status;
3937
import io.github.mianalysis.mia.process.deepimagej.PrepareDeepImageJ;
40-
import net.imagej.lut.ApplyLookupTable;
4138

4239
/**
4340
* Uses <a href="https://deepimagej.github.io/deepimagej/">DeepImageJ</a> to run

0 commit comments

Comments
 (0)