Skip to content

Commit

Permalink
add maxima sphere label splitting
Browse files Browse the repository at this point in the history
  • Loading branch information
biovoxxel committed May 1, 2022
1 parent 84a50e2 commit 8d4aa44
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import ij.WindowManager;
import net.haesleinhuepf.clij.clearcl.ClearCLBuffer;
import net.haesleinhuepf.clij2.CLIJ2;
import net.imagej.updater.UpdateService;

/*
* BSD 3-Clause License
Expand Down Expand Up @@ -88,8 +89,8 @@ public void run() {

private void setupImage() {

//BV3DBoxUtilities.displayMissingDependencyWarning(getContext().service(UpdateService.class), "clij,clij2");

BV3DBoxUtilities.displayMissingDependencyWarning(getContext().service(UpdateService.class), "clij,clij2,clijx-assistant,clijx-assistant-extensions,3D ImageJ Suite");
bvpp = new BV_PostProcessor(inputImagePlus);

outputImageName = "BVPP_" + inputImagePlus.getTitle();
Expand Down Expand Up @@ -123,6 +124,8 @@ public void processImage() {
outputImagePlus.setTitle("BVPP_" + inputImagePlus.getTitle());
outputImagePlus.getProcessor().resetMinAndMax();
outputImagePlus.show();

BV3DBoxUtilities.adaptImageDisplay(inputImagePlus, outputImagePlus);
}

@SuppressWarnings("unused")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public class BV_VoronoiThresholdLabelingGUI extends DynamicCommand {
@Parameter(label = "Threshold method", initializer = "thresholdMethodList", callback = "processImage")
private String thresholdMethod = "Default";

@Parameter(label = "Separation method", choices = {"None", "Maxima", "Eroded Maxima", "EDM Maxima", "DoG Seeds", "Eroded box", "Eroded sphere"}, callback = "processImage")
@Parameter(label = "Separation method", choices = {"None", "Maxima", "Eroded Maxima", "EDM Maxima", "Maxima Spheres", "DoG Seeds", "Eroded box", "Eroded sphere"}, callback = "processImage")
private String separationMethod = "Maxima";

@Parameter(label = "Spot sigma / Erosion", min = "0f", callback = "processImage")
Expand Down Expand Up @@ -137,7 +137,7 @@ public void run() {

private void setupImage() {

BV3DBoxUtilities.displayMissingDependencyWarning(getContext().service(UpdateService.class), "clij,clij2");
BV3DBoxUtilities.displayMissingDependencyWarning(getContext().service(UpdateService.class), "clij,clij2,clijx-assistant,clijx-assistant-extensions,3D ImageJ Suite");

bvvtl.setupInputImage(inputImagePlus);
input_image = bvvtl.getInputImageAsClearClBuffer();
Expand Down Expand Up @@ -280,6 +280,9 @@ private void processImage() {
case "EDM Maxima":
seed_image = labelSplitter.detectDistanceMapMaxima(thresholded_image, maximaRadius);
break;
case "Maxima Spheres":
seed_image = labelSplitter.createMaximaSpheres(thresholded_image, spotSigma, maximaRadius);
break;
case "DoG Seeds":
CLIJ2 clij2 = bvvtl.getCurrentCLIJ2Instance();
ClearCLBuffer binary_8_bit_image = clij2.create(thresholded_image);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public class BV_PostProcessor extends DynamicCommand {
private final PrefService prefs = new DefaultPrefService();
private static CLIJ2 clij2;
private ClearCLBuffer input_image;
private BV_LabelSeparator bvls = new BV_LabelSeparator();

/**
*
Expand Down Expand Up @@ -136,7 +137,24 @@ public ClearCLBuffer postProcessor(String method, int iteration) {
clij2.dilateLabels(temp_eroded, output_image, iteration);
temp_eroded.close();
break;


// case "Close Label":
// ClearCLBuffer temp_dilated = clij2.create(input_image);
//
// clij2.dilateLabels(input_image, temp_dilated, iteration);
//
// ClearCLBuffer temp_splitted_labels = clij2.create(input_image);
// bvls.splitLabels(clij2, temp_dilated, temp_splitted_labels);
// temp_dilated.close();
//
// if (is3D) {
// clij2.minimum3DSphere(temp_splitted_labels, output_image, iteration, iteration, iteration);
// } else {
// clij2.minimum2DSphere(temp_splitted_labels, output_image, iteration, iteration);
// }
// temp_splitted_labels.close();
// break;

case "Minimum (sphere)":
if (is3D) {
clij2.minimum3DSphere(input_image, output_image, iteration, iteration, iteration);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,6 @@ public ClearCLBuffer thresholdImage(ClearCLBuffer background_subtracted_image, S



//TODO: Outlines does not work as intended, since the gray LUT is not applied to the output image
public void createOutputImage(ClearCLBuffer output_image, String outputType) {
ImagePlus tempOutputImagePlus = null;

Expand All @@ -403,7 +402,7 @@ public void createOutputImage(ClearCLBuffer output_image, String outputType) {

ClearCLBuffer temp_output_image = clij2.create(input_image);
clij2.visualizeOutlinesOnOriginal(input_image, output_image, temp_output_image);
tempOutputImagePlus = BV3DBoxUtilities.pullImageFromGPU(clij2, temp_output_image, true, LutNames.GRAY);
tempOutputImagePlus = BV3DBoxUtilities.pullImageFromGPU(clij2, temp_output_image, true, LutNames.OUTLINE);
temp_output_image.close();
}

Expand All @@ -415,13 +414,6 @@ public void createOutputImage(ClearCLBuffer output_image, String outputType) {

outputImagePlus.setImage(tempOutputImagePlus);
outputImagePlus.setTitle(outputImageName);

if (outputType.equals("Binary") || outputType.equals("Outlines")) {
outputImagePlus.setLut(grays);
} else {
outputImagePlus.setLut(glasbey);
}

outputImagePlus.show();

BV3DBoxUtilities.adaptImageDisplay(inputImagePlus, outputImagePlus);
Expand Down

0 comments on commit 8d4aa44

Please # to comment.