diff --git a/src/main/java/gred/nucleus/core/ComputeNucleiParameters.java b/src/main/java/gred/nucleus/core/ComputeNucleiParameters.java index a40a323a..06c43cc5 100644 --- a/src/main/java/gred/nucleus/core/ComputeNucleiParameters.java +++ b/src/main/java/gred/nucleus/core/ComputeNucleiParameters.java @@ -117,6 +117,9 @@ public void addConfigParameters(String pathToConfig) { private String getColNameResult() { return "NucleusFileName\t" + "Volume\t" + + "Moment 1\t" + + "Moment 2\t" + + "Moment 3 \t" + "Flatness\t" + "Elongation\t" + "Esr\t" + diff --git a/src/main/java/gred/nucleus/core/Measure3D.java b/src/main/java/gred/nucleus/core/Measure3D.java index 2747e494..c90a67ac 100644 --- a/src/main/java/gred/nucleus/core/Measure3D.java +++ b/src/main/java/gred/nucleus/core/Measure3D.java @@ -826,6 +826,9 @@ public String nucleusParameter3D() { results = this.rawImage.getTitle() + "\t" // + computeVolumeObject2(255) + "\t" + computeVolumeObjectML() + "\t" + + computeEigenValue3D(255)[0] + "\t" + + computeEigenValue3D(255)[1] + "\t" + + computeEigenValue3D(255)[2] + "\t" + computeFlatnessAndElongation(255)[0] + "\t" + computeFlatnessAndElongation(255)[1] + "\t" + equivalentSphericalRadius(volume) + "\t" diff --git a/src/main/java/gred/nucleus/core/NucleusChromocentersAnalysis.java b/src/main/java/gred/nucleus/core/NucleusChromocentersAnalysis.java index ccd165b1..1c1f5260 100644 --- a/src/main/java/gred/nucleus/core/NucleusChromocentersAnalysis.java +++ b/src/main/java/gred/nucleus/core/NucleusChromocentersAnalysis.java @@ -56,21 +56,24 @@ public static void computeParameters(String rhfChoice, String text = imagePlusSegmented.getTitle() + " " + volume + " " + measure3D.equivalentSphericalRadius(volume) + " " + surfaceArea + " " + + measure3D.computeEigenValue3D(255)[0] + "\t" + + measure3D.computeEigenValue3D(255)[1] + "\t" + + measure3D.computeEigenValue3D(255)[2] + "\t" + measure3D.computeFlatnessAndElongation(255)[0] + " " + measure3D.computeFlatnessAndElongation(255)[1] + " " + measure3D.computeSphericity(volume, surfaceArea); if (rhfChoice.equals("Volume and intensity")) { LOGGER.info( - "ImageTitle Volume ESR SurfaceArea Flatness Elongation Sphericity IntensityRHF VolumeRHF NbCc VCcMean VCcTotal DistanceBorderToBorderMean DistanceBarycenterToBorderMean VoxelVolume"); + "ImageTitle Volume ESR SurfaceArea Moment 1 Moment 2 Moment 3 Flatness Elongation Sphericity IntensityRHF VolumeRHF NbCc VCcMean VCcTotal DistanceBorderToBorderMean DistanceBarycenterToBorderMean VoxelVolume"); text += " " + measure3D.computeIntensityRHF(imagePlusInput, imagePlusSegmented, imagePlusChromocenter) + " " + measure3D.computeVolumeRHF(imagePlusSegmented, imagePlusChromocenter) + " "; } else if (rhfChoice.equals("Volume")) { LOGGER.info( - "ImageTitle Volume ESR SurfaceArea Flatness Elongation Sphericity VolumeRHF NbCc VCcMean VCcTotal DistanceBorderToBorderMean DistanceBarycenterToBorderMean VoxelVolume"); + "ImageTitle Volume ESR SurfaceArea Moment 1 Moment 2 Moment 3 Flatness Elongation Sphericity VolumeRHF NbCc VCcMean VCcTotal DistanceBorderToBorderMean DistanceBarycenterToBorderMean VoxelVolume"); text += " " + measure3D.computeVolumeRHF(imagePlusSegmented, imagePlusChromocenter) + " "; } else { LOGGER.info( - "ImageTitle Volume ESR SurfaceArea Flatness Elongation Sphericity IntensityRHF NbCc VCcMean VCcTotal DistanceBorderToBorderMean DistanceBarycenterToBorderMean VoxelVolume"); + "ImageTitle Volume ESR SurfaceArea Moment 1 Moment 2 Moment 3 Flatness Elongation Sphericity IntensityRHF NbCc VCcMean VCcTotal DistanceBorderToBorderMean DistanceBarycenterToBorderMean VoxelVolume"); text += " " + measure3D.computeIntensityRHF(imagePlusInput, imagePlusSegmented, imagePlusChromocenter) + " "; @@ -132,19 +135,22 @@ public static void computeParameters(String pathResultsFile, if (!exist) { if (rhfChoice.equals("Volume and intensity")) { text = - "ImageTitle\tVolume\tESR\tSurfaceArea\tFlatness\tElongation\tSphericity\tIntensityRHF\tVolumeRHF\tNbCc\tVCcMean\tVCcTotal\tDistanceBorderToBorderMean\tDistanceBarycenterToBorderMean\tVoxelVolume\n"; + "ImageTitle\tVolume\tESR\tSurfaceArea\tMoment 1\tMoment 2 \tMoment 3 \tFlatness\tElongation\tSphericity\tIntensityRHF\tVolumeRHF\tNbCc\tVCcMean\tVCcTotal\tDistanceBorderToBorderMean\tDistanceBarycenterToBorderMean\tVoxelVolume\n"; } else if (rhfChoice.equals("Volume")) { text = - "ImageTitle\tVolume\tESR\tSurfaceArea\tFlatness\tElongation\tSphericity\tVolumeRHF\tNbCc\tVCcMean\tVCcTotal\tDistanceBorderToBorderMean\tDistanceBarycenterToBorderMean\tVoxelVolume\n"; + "ImageTitle\tVolume\tESR\tSurfaceArea\tMoment 1\tMoment 2 \tMoment 3 \tFlatness\tElongation\tSphericity\tVolumeRHF\tNbCc\tVCcMean\tVCcTotal\tDistanceBorderToBorderMean\tDistanceBarycenterToBorderMean\tVoxelVolume\n"; } else { text = - "ImageTitle\tVolume\tESR\tSurfaceArea\tFlatness\tElongation\tSphericity\tIntensityRHF\tNbCc\tVCcMean\tVCcTotal\tDistanceBorderToBorderMean\tDistanceBarycenterToBorderMean\tVoxelVolume\n"; + "ImageTitle\tVolume\tESR\tSurfaceArea\tMoment 1 \tMoment 2 \tMoment 3 \tFlatness\tElongation\tSphericity\tIntensityRHF\tNbCc\tVCcMean\tVCcTotal\tDistanceBorderToBorderMean\tDistanceBarycenterToBorderMean\tVoxelVolume\n"; } } text += imagePlusSegmented.getTitle() + "\t" + volume + "\t" + measure3D.equivalentSphericalRadius(volume) + "\t" + surfaceArea + "\t" + + measure3D.computeEigenValue3D(255)[0] + "\t" + + measure3D.computeEigenValue3D(255)[1] + "\t" + + measure3D.computeEigenValue3D(255)[2] + "\t" + measure3D.computeFlatnessAndElongation(255)[0] + "\t" + measure3D.computeFlatnessAndElongation(255)[1] + "\t" + measure3D.computeSphericity(volume, surfaceArea) + "\t"; diff --git a/src/main/java/gred/nucleus/machinelearning/ComputeNucleiParametersML.java b/src/main/java/gred/nucleus/machinelearning/ComputeNucleiParametersML.java index 0a935720..589bc1d9 100644 --- a/src/main/java/gred/nucleus/machinelearning/ComputeNucleiParametersML.java +++ b/src/main/java/gred/nucleus/machinelearning/ComputeNucleiParametersML.java @@ -124,6 +124,9 @@ public void run() throws IOException, FormatException { public String getResultsColumnNames() { return "NucleusFileName\t" + "Volume\t" + + "Moment 1\t" + + "Moment 2\t" + + "Moment 3 \t" + "Flatness\t" + "Elongation\t" + "Sphericity\t" + diff --git a/src/main/java/gred/nucleus/mains/ComputeSegmentationParameters.java b/src/main/java/gred/nucleus/mains/ComputeSegmentationParameters.java index 8219ce44..92aa6272 100644 --- a/src/main/java/gred/nucleus/mains/ComputeSegmentationParameters.java +++ b/src/main/java/gred/nucleus/mains/ComputeSegmentationParameters.java @@ -96,6 +96,9 @@ public static void main(String[] args) throws Exception { public static String getResultsColumnNames() { return "NucleusFileName\t" + "Volume\t" + + "Moment 1\t" + + "Moment 2\t" + + "Moment 3 \t" + "Flatness\t" + "Elongation\t" + "Esr\t" + diff --git a/src/main/java/gred/nucleus/mains/ComputeSegmentationParametersDL.java b/src/main/java/gred/nucleus/mains/ComputeSegmentationParametersDL.java index d268b939..72787d5e 100644 --- a/src/main/java/gred/nucleus/mains/ComputeSegmentationParametersDL.java +++ b/src/main/java/gred/nucleus/mains/ComputeSegmentationParametersDL.java @@ -140,6 +140,9 @@ public static ImagePlus generateSegmentedImage(ImagePlus imagePlusInput, public static String getResultsColumnNames() { return "NucleusFileName\t" + "Volume\t" + + "Moment 1\t" + + "Moment 2\t" + + "Moment 3 \t" + "Flatness\t" + "Elongation\t" + "Esr\t" + diff --git a/src/main/java/gred/nucleus/segmentation/SegmentationCalling.java b/src/main/java/gred/nucleus/segmentation/SegmentationCalling.java index 19444b7e..e50504e3 100644 --- a/src/main/java/gred/nucleus/segmentation/SegmentationCalling.java +++ b/src/main/java/gred/nucleus/segmentation/SegmentationCalling.java @@ -3,14 +3,14 @@ import fr.igred.omero.Client; import fr.igred.omero.exception.AccessException; import fr.igred.omero.exception.ServiceException; +import fr.igred.omero.repository.DatasetWrapper; import fr.igred.omero.repository.ImageWrapper; import fr.igred.omero.roi.ROIWrapper; -import fr.igred.omero.repository.DatasetWrapper; +import gred.nucleus.core.ConvexHullSegmentation; +import gred.nucleus.core.NucleusSegmentation; import gred.nucleus.files.Directory; import gred.nucleus.files.FilesNames; import gred.nucleus.files.OutputTextFile; -import gred.nucleus.core.ConvexHullSegmentation; -import gred.nucleus.core.NucleusSegmentation; import gred.nucleus.nucleuscaracterisations.NucleusAnalysis; import ij.ImagePlus; import ij.io.FileSaver; @@ -29,6 +29,7 @@ import java.nio.file.Files; import java.text.SimpleDateFormat; import java.util.Calendar; +import java.util.Date; import java.util.List; import java.util.concurrent.ExecutionException; @@ -280,20 +281,24 @@ public String runOneImage(String filePath) throws IOException, FormatException { LOGGER.info("End: {}", timeStampStart); return log; } - - + + public void saveCropGeneralInfo() { + Date date = new Date() ; + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH.mm.ss") ; LOGGER.info("Saving crop general info."); OutputTextFile resultFileOutputOTSU = new OutputTextFile(this.segmentationParameters.getOutputFolder() + "OTSU" + File.separator - + "result_Segmentation_Analyse_OTSU.csv"); + + dateFormat.format(date) + + "-result_Segmentation_Analyse_OTSU.csv"); resultFileOutputOTSU.saveTextFile(this.outputCropGeneralInfoOTSU, true); if (this.segmentationParameters.getConvexHullDetection()) { OutputTextFile resultFileOutputConvexHull = new OutputTextFile(this.segmentationParameters.getOutputFolder() + NucleusSegmentation.CONVEX_HULL_ALGORITHM + File.separator - + "result_Segmentation_Analyse_" + + + dateFormat.format(date) + + "-result_Segmentation_Analyse_" + NucleusSegmentation.CONVEX_HULL_ALGORITHM + ".csv"); resultFileOutputConvexHull.saveTextFile(this.outputCropGeneralInfoConvexHull, true); @@ -342,10 +347,12 @@ public String runSeveralImagesOMERO(List images, Long output, Clie public void saveCropGeneralInfoOmero(Client client, Long output) throws ServiceException, AccessException, ExecutionException, InterruptedException { + Date date = new Date() ; + SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH.mm.ss") ; LOGGER.info("Saving OTSU results."); DatasetWrapper dataset = client.getProject(output).getDatasets("OTSU").get(0); - String path = "." + File.separator + "result_Segmentation_Analyse.csv"; + String path = "." + File.separator + dateFormat.format(date) + "-result_Segmentation_Analyse.csv"; try { path = new File(path).getCanonicalPath(); } catch (IOException e) { @@ -504,6 +511,9 @@ private void preProcessImage(ImagePlus img) { public String getResultsColumnNames() { return "NucleusFileName\t" + "Volume\t" + + "Moment 1 \t" + + "Moment 2 \t" + + "Moment 3 \t" + "Flatness\t" + "Elongation\t" + "Esr\t" +