Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions src/main/java/gred/nucleus/autocrop/AnnotateAutoCrop.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import gred.nucleus.files.Directory;
import ij.ImagePlus;
import ij.gui.TextRoi;
import ij.io.FileSaver;
import ij.plugin.ContrastEnhancer;
import ij.plugin.ZProjector;
import ij.process.ImageConverter;
Expand All @@ -29,6 +28,7 @@
import java.util.concurrent.ExecutionException;
import java.util.regex.Pattern;

import static gred.nucleus.utils.ImageSaver.saveFile;
import static loci.plugins.BF.openImagePlus;


Expand Down Expand Up @@ -176,18 +176,6 @@ public void run() {
}


/**
* Save the ImagePlus Z-projection image
*
* @param imagePlusInput image to save
* @param pathFile path to save the image
*/
public void saveFile(ImagePlus imagePlusInput, String pathFile) {
FileSaver fileSaver = new FileSaver(imagePlusInput);
fileSaver.saveAsTiff(pathFile);
}


public void saveProjectionOMERO(Client client, Long output)
throws AccessException, ServiceException, ExecutionException, OMEROServerError, IOException {
long datasetID;
Expand Down Expand Up @@ -218,7 +206,7 @@ public void saveProjectionOMERO(Client client, Long output)
*
* @return Z projection
*/
private ImagePlus projectionMax(ZProjector project) {
private static ImagePlus projectionMax(ZProjector project) {
project.setMethod(ZProjector.MAX_METHOD);
project.doProjection();
return project.getProjection();
Expand Down
33 changes: 2 additions & 31 deletions src/main/java/gred/nucleus/autocrop/AutoCrop.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public ImagePlus getImageChannel(int channelNumber) throws IOException, FormatEx
}


public ImagePlus getImageChannelOMERO(int channelNumber, ImageWrapper image, Client client)
public static ImagePlus getImageChannelOMERO(int channelNumber, ImageWrapper image, Client client)
throws ServiceException, AccessException, ExecutionException {
int[] cBound = {channelNumber, channelNumber};
return image.toImagePlus(client, null, null, cBound, null, null);
Expand Down Expand Up @@ -603,16 +603,6 @@ public void cropKernels3() {
}


/**
* Getter for the outputFile ArrayList
*
* @return outputFile: ArrayList of String for the path of the output files created.
*/
public List<String> getOutputFileList() {
return new ArrayList<>(outputFile);
}


/**
* Getter for the boxCoordinates
*
Expand All @@ -631,7 +621,7 @@ public List<String> getFileCoordinates() {
*
* @return The segmented binary image.
*/
private ImagePlus generateSegmentedImage(ImagePlus imagePlusInput, int threshold) {
private static ImagePlus generateSegmentedImage(ImagePlus imagePlusInput, int threshold) {
ImageStack imageStackInput = imagePlusInput.getStack();
ImagePlus imagePlusSegmented = imagePlusInput.duplicate();
ImageStack imageStackSegmented = imagePlusSegmented.getStack();
Expand Down Expand Up @@ -718,16 +708,6 @@ public String getSpecificImageInfo() {
}


/**
* Getter column name for the tab delimited file
*
* @return columns name for output text file
*/
public String getColumnNames() {
return HEADERS;
}


/**
* Write analysis info in output text file
*/
Expand Down Expand Up @@ -815,13 +795,4 @@ public void boxIntersection() {
}


/**
* Set a list of boxes
*
* @param boxes list of boxes
*/
public void setBoxes(Map<Double, ? extends Box> boxes) {
this.boxes = new HashMap<>(boxes);
}

}
5 changes: 0 additions & 5 deletions src/main/java/gred/nucleus/autocrop/AutoCropCalling.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ public class AutoCropCalling {
private String typeThresholding = "Otsu";


/** Constructor Create the output directory if it doesn't exist. */
public AutoCropCalling() {
}


public AutoCropCalling(AutocropParameters autocropParameters) {
this.autocropParameters = autocropParameters;
this.outputCropGeneralInfo = autocropParameters.getAnalysisParameters() + HEADERS;
Expand Down
110 changes: 0 additions & 110 deletions src/main/java/gred/nucleus/autocrop/AutocropParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ public class AutocropParameters extends PluginParameters {
private boolean boxesRegrouping = true;


public AutocropParameters() {
}


/**
* Constructor with default parameter
*
Expand All @@ -58,70 +54,6 @@ public AutocropParameters(String inputFolder, String outputFolder) {
}


/**
* Constructor with box size modifications
*
* @param inputFolder Path folder containing Images
* @param outputFolder Path folder output analyse
* @param xCropBoxSize Number of voxels add in x axis around object
* @param yCropBoxSize Number of voxels add in z axis around object
* @param zCropBoxSize Number of stack add in z axis around object
*/
public AutocropParameters(String inputFolder, String outputFolder,
int xCropBoxSize,
int yCropBoxSize,
int zCropBoxSize,
int numberFontSize,
int thresholdOTSUComputing,
int channelToComputeThreshold) {
super(inputFolder, outputFolder);
this.xCropBoxSize = xCropBoxSize;
this.yCropBoxSize = yCropBoxSize;
this.zCropBoxSize = zCropBoxSize;
this.numberFontSize = numberFontSize;
this.thresholdOTSUComputing = thresholdOTSUComputing;
this.channelToComputeThreshold = channelToComputeThreshold;
}


/**
* Constructor with all manual parameters
*
* @param inputFolder Path folder containing Images
* @param outputFolder Path folder output analyse
* @param xCropBoxSize Number of voxels add in x axis around object
* @param yCropBoxSize Number of voxels add in z axis around object
* @param zCropBoxSize Number of stack add in z axis around object
* @param channelToComputeThreshold Channel number to compute OTSU
* @param slicesOTSUComputing Slice start to compute OTSU
* @param thresholdOTSUComputing Minimum OTSU threshold used
* @param maxVolumeNucleus Volume maximum of objects detected
* @param minVolumeNucleus Volume minimum of objects detected
*/
public AutocropParameters(String inputFolder, String outputFolder,
int xCropBoxSize,
int yCropBoxSize,
int zCropBoxSize,
int numberFontSize,
int slicesOTSUComputing,
int thresholdOTSUComputing,
int channelToComputeThreshold,
int minVolumeNucleus,
int maxVolumeNucleus) {

super(inputFolder, outputFolder);
this.xCropBoxSize = xCropBoxSize;
this.yCropBoxSize = yCropBoxSize;
this.zCropBoxSize = zCropBoxSize;
this.numberFontSize = numberFontSize;
this.thresholdOTSUComputing = thresholdOTSUComputing;
this.slicesOTSUComputing = slicesOTSUComputing;
this.channelToComputeThreshold = channelToComputeThreshold;
this.maxVolumeNucleus = maxVolumeNucleus;
this.minVolumeNucleus = minVolumeNucleus;
}


/**
* Constructor with all manual parameters 2
*
Expand Down Expand Up @@ -166,48 +98,6 @@ public AutocropParameters(String inputFolder, String outputFolder,
}


/**
* Constructor with box size modification and slice number used to start OTSU threshold calculation to last slice
*
* @param inputFolder Path folder containing Images
* @param outputFolder Path folder output analyse
* @param xCropBoxSize Number of voxels add in x axis around object
* @param yCropBoxSize Number of voxels add in z axis around object
* @param zCropBoxSize Number of stack add in z axis around object
* @param channelToComputeThreshold Channel number to compute OTSU
* @param slicesOTSUComputing Slice start to compute OTSU
* @param thresholdOTSUComputing Minimum OTSU threshold used
* @param maxVolumeNucleus Volume maximum of objects detected
* @param minVolumeNucleus Volume minimum of objects detected
*/
public AutocropParameters(String inputFolder, String outputFolder,
double xCal,
double yCal,
double zCal,
int xCropBoxSize,
int yCropBoxSize,
int zCropBoxSize,
int numberFontSize,
int slicesOTSUComputing,
int thresholdOTSUComputing,
int channelToComputeThreshold,
int minVolumeNucleus,
int maxVolumeNucleus) {

super(inputFolder, outputFolder, xCal, yCal, zCal);
this.xCropBoxSize = xCropBoxSize;
this.yCropBoxSize = yCropBoxSize;
this.zCropBoxSize = zCropBoxSize;
this.numberFontSize = numberFontSize;
this.thresholdOTSUComputing = thresholdOTSUComputing;
this.slicesOTSUComputing = slicesOTSUComputing;
this.channelToComputeThreshold = channelToComputeThreshold;
this.maxVolumeNucleus = maxVolumeNucleus;
this.minVolumeNucleus = minVolumeNucleus;

}


/**
* Constructor with box size modification and slice number used to start OTSU threshold calculation to last slice
*
Expand Down
12 changes: 3 additions & 9 deletions src/main/java/gred/nucleus/autocrop/CropFromCoordinates.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
import fr.igred.omero.repository.ProjectWrapper;
import gred.nucleus.files.Directory;
import gred.nucleus.files.FilesNames;
import ij.ImagePlus;
import ij.io.FileSaver;
import loci.formats.FormatException;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.FilenameUtils;
Expand All @@ -28,6 +26,8 @@
import java.util.concurrent.ExecutionException;
import java.util.regex.Pattern;

import static gred.nucleus.utils.ImageSaver.saveFile;


public class CropFromCoordinates {
/** Logger */
Expand Down Expand Up @@ -70,12 +70,6 @@ public CropFromCoordinates(String pathToCoordinates) {
}


public static void saveFile(ImagePlus imagePlusInput, String pathFile) {
FileSaver fileSaver = new FileSaver(imagePlusInput);
fileSaver.saveAsTiff(pathFile);
}


private Map<File, File> gatherFilePairs() {
File coordinateDir = new File(pathToCoordinates);
File rawDir = new File(pathToRaw);
Expand Down Expand Up @@ -153,7 +147,7 @@ public void runFromOMERO(String rawDatasetIDAndChannel, String outputProjectID,
}


public Map<Double, Box> readCoordinatesTXT(File boxesFile) {
public static Map<Double, Box> readCoordinatesTXT(File boxesFile) {
Map<Double, Box> boxLists = new HashMap<>();

try (Scanner scanner = new Scanner(boxesFile)) {
Expand Down
15 changes: 2 additions & 13 deletions src/main/java/gred/nucleus/autocrop/GenerateOverlay.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import gred.nucleus.files.Directory;
import ij.ImagePlus;
import ij.gui.ImageRoi;
import ij.io.FileSaver;
import ij.plugin.Duplicator;
import ij.plugin.LutLoader;
import ij.process.ImageConverter;
Expand All @@ -36,6 +35,8 @@
import java.util.Map;
import java.util.concurrent.ExecutionException;

import static gred.nucleus.utils.ImageSaver.saveFile;


public class GenerateOverlay {
/** Logger */
Expand Down Expand Up @@ -64,18 +65,6 @@ public GenerateOverlay(String pathToProjection, String pathToDic) {
}


/**
* Save output file in tiff format for OMERO
*
* @param imagePlusInput image to save
* @param pathFile path to save image
*/
public static void saveFile(ImagePlus imagePlusInput, String pathFile) {
FileSaver fileSaver = new FileSaver(imagePlusInput);
fileSaver.saveAsTiff(pathFile);
}


private Map<File, File> gatherFilePairs() {
File projectionDir = new File(pathToProjection);
File dicDir = new File(pathToDic);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/gred/nucleus/cli/CLIActionOptionCmdLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ public CLIActionOptionCmdLine(String[] args) {
isTrue(availableActionCMD(cmd.getOptionValue("action")));
} catch (ParseException exp) {
System.console().writer().println(exp.getMessage() + "\n");
System.console().writer().println(super.getHelperInfo());
System.console().writer().println(getHelperInfo());
System.exit(1);
} catch (Exception exp) {
System.console().writer().println("Action option \"" +
cmd.getOptionValue("action") +
"\" not available" + "\n");
System.console().writer().println(super.getHelperInfo());
System.console().writer().println(getHelperInfo());
System.exit(1);
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/gred/nucleus/cli/CLIActionOptionOMERO.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,13 @@ public CLIActionOptionOMERO(String[] argument) {
isTrue(availableActionOMERO(cmd.getOptionValue("action")));
} catch (ParseException exp) {
System.console().writer().println(exp.getMessage() + "\n");
System.console().writer().println(super.getHelperInfo());
System.console().writer().println(getHelperInfo());
System.exit(1);
} catch (Exception exp) {
System.console().writer().println("Action option \"" +
cmd.getOptionValue("action") +
"\" not available" + "\n");
System.console().writer().println(super.getHelperInfo());
System.console().writer().println(getHelperInfo());
System.exit(1);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/gred/nucleus/cli/CLIActionOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public CLIActionOptions(String[] argument) {


/** @return : helper info */
public String getHelperInfo() {
public static String getHelperInfo() {
return "More details for available actions:\n" +
"java -jar nucleusj-" + NJ_VERSION + ".jar -h \n" +
"java -jar nucleusj-" + NJ_VERSION + ".jar -help \n\n" +
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/gred/nucleus/cli/CLIHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


/** Class to generate helper */
public class CLIHelper {
public final class CLIHelper {

private CLIHelper() {
// DO NOTHING
Expand Down Expand Up @@ -249,7 +249,7 @@ private static void specificAction(String action) {
exampleCMD = exampleArgument.split(" ");
CLIActionOptions wrongAction = new CLIActionOptions(exampleCMD);
System.console().writer().println("Invalid action \"" + action + "\" :\n");
System.console().writer().println(wrongAction.getHelperInfo());
System.console().writer().println(CLIActionOptions.getHelperInfo());
break;
}
}
Expand Down
Loading