Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Sbalzarini Lab
S
Software
Bio-Imaging
MosaicSuite
Commits
6efbfb6c
Commit
6efbfb6c
authored
Sep 06, 2018
by
Krzysztof Gonciarz
Browse files
Fix for RC
parent
f779d72f
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/main/java/mosaic/plugins/RegionCompetition.java
View file @
6efbfb6c
...
...
@@ -5,6 +5,7 @@ import java.awt.GraphicsEnvironment;
import
org.apache.log4j.Logger
;
import
ij.IJ
;
import
ij.ImageJ
;
import
ij.ImagePlus
;
import
ij.Macro
;
import
ij.macro.Interpreter
;
...
...
@@ -244,4 +245,20 @@ public class RegionCompetition implements PlugInFilter {
MosaicUtils
.
reorganize
(
iOutputFileNamesSuffixes
,
fileNameNoExt
,
directory
,
1
);
}
}
public
static
void
main
(
String
[]
args
)
{
// set the plugins.dir property to make the plugin appear in the Plugins menu
Class
<?>
clazz
=
RegionCompetition
.
class
;
String
url
=
clazz
.
getResource
(
"/"
+
clazz
.
getName
().
replace
(
'.'
,
'/'
)
+
".class"
).
toString
();
String
pluginsDir
=
url
.
substring
(
"file:"
.
length
(),
url
.
length
()
-
clazz
.
getName
().
length
()
-
".class"
.
length
());
System
.
setProperty
(
"plugins.dir"
,
pluginsDir
);
new
ImageJ
();
// ImagePlus image = IJ.openImage("https://upload.wikimedia.org/wikipedia/commons/3/3f/Bikesgray.jpg");
// image.show();
// run the plugin
IJ
.
runPlugIn
(
clazz
.
getName
(),
""
);
}
}
src/main/java/mosaic/regions/GUI/GuiRC.java
View file @
6efbfb6c
...
...
@@ -172,7 +172,7 @@ public class GuiRC {
for
(
int
i
=
0
;
i
<
energyValues
.
length
;
++
i
)
{
energyItems
[
i
]
=
energyValues
[
i
].
toString
();
}
gd
.
addChoice
(
"E_data"
,
energyItems
,
iSettings
.
energyFunctional
.
name
());
gd
.
addChoice
(
"E_data"
,
energyItems
,
iSettings
.
energyFunctional
.
toString
());
Choice
choiceEnergy
=
(
Choice
)
gd
.
getChoices
().
lastElement
();
{
Button
optionButton
=
new
Button
(
"Options"
);
...
...
@@ -200,7 +200,7 @@ public class GuiRC {
for
(
int
i
=
0
;
i
<
regularizationValues
.
length
;
++
i
)
{
regularizationItems
[
i
]
=
regularizationValues
[
i
].
toString
();
}
gd
.
addChoice
(
"E_length"
,
regularizationItems
,
iSettings
.
regularizationType
.
name
());
gd
.
addChoice
(
"E_length"
,
regularizationItems
,
iSettings
.
regularizationType
.
toString
());
Choice
choiceRegularization
=
(
Choice
)
gd
.
getChoices
().
lastElement
();
{
...
...
@@ -227,9 +227,9 @@ public class GuiRC {
final
InitializationType
[]
initTypes
=
InitializationType
.
values
();
final
String
[]
initializationItems
=
new
String
[
initTypes
.
length
];
for
(
int
i
=
0
;
i
<
initTypes
.
length
;
++
i
)
{
initializationItems
[
i
]
=
initTypes
[
i
].
name
();
initializationItems
[
i
]
=
initTypes
[
i
].
toString
();
}
gd
.
addChoice
(
"Initialization"
,
initializationItems
,
iSettings
.
initType
.
name
());
gd
.
addChoice
(
"Initialization"
,
initializationItems
,
iSettings
.
initType
.
toString
());
// save reference to this choice, so we can handle it
Choice
initializationChoice
=
(
Choice
)
gd
.
getChoices
().
lastElement
();
...
...
src/test/java/mosaic/bregman/segmentation/SquasshSegmentationTest.java
View file @
6efbfb6c
...
...
@@ -9,23 +9,40 @@ public class SquasshSegmentationTest extends CommonBase {
@Test
public
void
testGenerateSeriesOfSquassh
()
{
// String path = "/Users/gonciarz/
Documents/MOSAIC/work/testInputs/Crop_12-12
.tif";
// String path = "/Users/gonciarz/
small
.tif";
// ImagePlus ip = loadImagePlus(path);
//
// double[][][] img = ImgUtils.ImgToZXYarray(ip);
// short[][] blank = new short[img[0].length][img[0][0].length];
//
// int numOfSteps = 256;
// short[][][] out = new short[numOfSteps][][];
// int numOfSteps = 20;
// float fromVal = 0;
// float toVal = 0.2f;
// float fromValInt = 0.2f;
// float toValInt = 0.8f;
// short[][][] out = new short[numOfSteps *numOfSteps][][];
// for (int j = 0; j < numOfSteps; j++) {
// for (int i = 0; i < numOfSteps; i++) {
// System.out.println(i * (1.0/(numOfSteps)));
// SegmentationParameters sp = new SegmentationParameters(4, 1, 0.1, i * (1.0/(numOfSteps-1)), true, SegmentationParameters.IntensityMode.AUTOMATIC, SegmentationParameters.NoiseModel.GAUSS, 1, 1, 0);
// SegmentationParameters sp = new SegmentationParameters(
// 4, // num threads
// 1, // interpolation (multiplication factor)
// i * (toVal - fromVal) / numOfSteps, // regularization
// j * (toValInt - fromValInt) / numOfSteps, // min obj intensity
// true, // exclude z edges
// SegmentationParameters.IntensityMode.AUTOMATIC, // intensity mode
// SegmentationParameters.NoiseModel.GAUSS, // noise model
// 1, // sigma xy
// 1, // sigma z
// 0, // min regions intensity
// 2); // min region size
// SquasshSegmentation ss = new SquasshSegmentation(img, sp, 0, 255);
// ss.run();
// out[i] = (ss.iRegionsList.size() > 0) ? ss.iLabeledRegions[0] : blank;
// }
// out[i
+j * numOfSteps
] = (ss.iRegionsList.size() > 0) ? ss.iLabeledRegions[0] : blank;
// }
}
// ImagePlus outImg = ImgUtils.ZXYarrayToImg(ConvertArray.toDouble(out), "Output");
// IJ.saveAsTiff(outImg, "/tmp/out.tif");
// System.out.println("Range: " +fromVal +"-"+toVal + " step: " + (toVal - fromVal) / numOfSteps);
}
@Test
...
...
src/test/java/mosaic/plugins/BackgroundSubtractor2_Test.java
View file @
6efbfb6c
package
mosaic.plugins
;
import
static
org
.
junit
.
Assert
.*;
import
org.junit.Test
;
import
mosaic.test.framework.CommonBase
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment