diff --git a/src/main/java/fr/pasteur/ida/zellige/element/Projection.java b/src/main/java/fr/pasteur/ida/zellige/element/Projection.java index 968f8090d6ea5f4995d3304511e90bb07478fcc9..107f3ce28e1b4686b4edd729a7d8812aecc272d0 100644 --- a/src/main/java/fr/pasteur/ida/zellige/element/Projection.java +++ b/src/main/java/fr/pasteur/ida/zellige/element/Projection.java @@ -30,14 +30,12 @@ package fr.pasteur.ida.zellige.element; import net.imglib2.img.Img; import net.imglib2.type.NativeType; -import net.imglib2.type.logic.BitType; import net.imglib2.type.numeric.RealType; -import net.imglib2.type.numeric.integer.UnsignedShortType; public class Projection< T extends RealType< T > & NativeType< T > > { - private int offset; - private int deltaZ; + private final int offset; + private final int deltaZ; private String method; private final ReferenceSurface<T> referenceSurface; private Img< T > projection; @@ -52,13 +50,6 @@ public class Projection< T extends RealType< T > & NativeType< T > > this.referenceSurface = referenceSurface; } - public Projection( ReferenceSurface< T > referenceSurface ) - { - this.referenceSurface = referenceSurface; - } - - - public Img< T > get() { return projection; @@ -94,18 +85,9 @@ public class Projection< T extends RealType< T > & NativeType< T > > this.subVolume = subVolume; } - public void setOffset( int offset ) - { - this.offset = offset; - } - public void setMethod( String method ) { this.method = method; } - public void setDeltaZ( int deltaZ ) - { - this.deltaZ = deltaZ; - } } diff --git a/src/main/java/fr/pasteur/ida/zellige/element/ReferenceSurface.java b/src/main/java/fr/pasteur/ida/zellige/element/ReferenceSurface.java index 0e586a606254f3be5dc6af5cec3493ab7a592c55..b29416987d2645dcaecb31fc23d0b065403d8d08 100644 --- a/src/main/java/fr/pasteur/ida/zellige/element/ReferenceSurface.java +++ b/src/main/java/fr/pasteur/ida/zellige/element/ReferenceSurface.java @@ -86,13 +86,6 @@ public class ReferenceSurface< T extends RealType< T > & NativeType< T > > } } - - public Img< T > getRawProjection() - { - return rawProjection; - } - - public RandomAccessibleInterval< T > getInput() { return input; diff --git a/src/main/java/fr/pasteur/ida/zellige/element/Surface.java b/src/main/java/fr/pasteur/ida/zellige/element/Surface.java index de4c54ac2605f082b7b42e549653a9ebfe125771..4269afa8e7c7ea172e4b1737f07bf370dfb8b5b8 100644 --- a/src/main/java/fr/pasteur/ida/zellige/element/Surface.java +++ b/src/main/java/fr/pasteur/ida/zellige/element/Surface.java @@ -149,43 +149,6 @@ public class Surface return inCommon / ( double ) count; } - public boolean isTheSameSurfaceAs( Surface other ) - { - for ( int i = 0; i <= this.getHeight() - 1; i++ ) - { - SurfaceLine refLine = this.get( i ); - if ( refLine != null ) - { - SurfaceLine toTest = other.get( i ); - if ( toTest != null ) - { - - for ( int j = 0; j < refLine.getLength(); j++ ) - { - Pixels refPixels = refLine.get( j ); - if ( refPixels != null ) - { - Pixels pixelsToTest = toTest.get( j ); - if ( pixelsToTest != null ) - { -// return false; -// } - if ( ! refPixels.equals( pixelsToTest ) ) - { - return false; - } - } - } - } - } - - } - - } - return true; - } - - /** * Checks if this object shares a majority of {@link Pixels} with another {@link Surface} object. * diff --git a/src/main/java/fr/pasteur/ida/zellige/element/ose/AbstractOSE.java b/src/main/java/fr/pasteur/ida/zellige/element/ose/AbstractOSE.java index baa8e420e493266c585cce5d57d239f6b231ea1f..a3f584f0089eca36cfd3bf248c7ce4a6b40dc1b6 100644 --- a/src/main/java/fr/pasteur/ida/zellige/element/ose/AbstractOSE.java +++ b/src/main/java/fr/pasteur/ida/zellige/element/ose/AbstractOSE.java @@ -36,9 +36,7 @@ import java.util.ArrayList; public abstract class AbstractOSE extends ArrayList< Coordinate > { - /* Not necessary for the program.*/ private final OSEStartingStatus startingStatus; - /*-------------*/ /** * The visited status for the 1D and 2D reconstructions. @@ -62,10 +60,8 @@ public abstract class AbstractOSE extends ArrayList< Coordinate > */ public void set() { - Integer j = startingStatus.get( this.size() ); - startingStatus.put( this.size(), ( j == null ) ? 1 : j + 1 ); + startingStatus.compute( this.size(), ( k, j ) -> ( j == null ) ? 1 : j + 1 ); startingStatus.setOSCount(); - } /** diff --git a/src/main/java/fr/pasteur/ida/zellige/element/ose/OSEList.java b/src/main/java/fr/pasteur/ida/zellige/element/ose/OSEList.java index 60b1548db026367b9722a11791263159b411f8cf..cc212f242c39c712081fe500acbe2cea8fcabf8a 100644 --- a/src/main/java/fr/pasteur/ida/zellige/element/ose/OSEList.java +++ b/src/main/java/fr/pasteur/ida/zellige/element/ose/OSEList.java @@ -37,7 +37,6 @@ import java.util.Collection; public class OSEList extends ArrayList< AbstractOSE > { - public OSEList() { } @@ -66,6 +65,10 @@ public class OSEList extends ArrayList< AbstractOSE > return add; } + /** + * + * @return the size of the OSE list + */ public int getSize() { int size = 0; @@ -76,6 +79,9 @@ public class OSEList extends ArrayList< AbstractOSE > return size; } + /** + * Resets to false the visited status + */ public void reset() { for ( AbstractOSE os : this ) @@ -84,6 +90,10 @@ public class OSEList extends ArrayList< AbstractOSE > } } + /** + * + * @return true if the OSE list contains a starting OSE + */ public boolean containsAStart() { for ( AbstractOSE os : this ) diff --git a/src/main/java/fr/pasteur/ida/zellige/element/surfaceLine/SurfaceLine.java b/src/main/java/fr/pasteur/ida/zellige/element/surfaceLine/SurfaceLine.java index 305afcd8239c04fd44d86a56e72abe65dc5e565b..1d9ddb0ebbab904cff07aec4af8fcd25160a3f25 100644 --- a/src/main/java/fr/pasteur/ida/zellige/element/surfaceLine/SurfaceLine.java +++ b/src/main/java/fr/pasteur/ida/zellige/element/surfaceLine/SurfaceLine.java @@ -74,14 +74,15 @@ public abstract class SurfaceLine this.dimension = new Pixels[ length ] ; set( os ); } - - - public SurfaceLine( AbstractOSE os, int size ) - { - this.dimension = new Pixels[ size] ; - set( os ); - } + /** + * + * @param os + * @param overlap + * @param connexity + * @param surfaceLine + * @return + */ public SurfaceLine match2( AbstractOSE os, int overlap, double connexity, SurfaceLine surfaceLine ) { int match = 0; diff --git a/src/main/java/fr/pasteur/ida/zellige/element/surfaceLine/SurfaceLineX.java b/src/main/java/fr/pasteur/ida/zellige/element/surfaceLine/SurfaceLineX.java index fded62fbcd9f919409b8273c4ec296255b947ecf..6ba74799be3780c2657779e97d109ce49da002fa 100644 --- a/src/main/java/fr/pasteur/ida/zellige/element/surfaceLine/SurfaceLineX.java +++ b/src/main/java/fr/pasteur/ida/zellige/element/surfaceLine/SurfaceLineX.java @@ -44,6 +44,15 @@ public class SurfaceLineX extends SurfaceLine this.setLine( os.get( 0 ).getY() ); } + /** + * Tests if the OS matches the SurfaceLine instance and creates a new SurfaceLine object if so. + * + * @param os - the OS to test against the SurfaceLine instance. + * @param direction - an integer witch indicates the line of the resulting SurfaceLine. + * @param overlap - the minimum number of matching coordinates. + * @param connexity - the minimum percentage of match between the OS and the current instance. + * @return - a new SurfaceLine if there is a match, null otherwise. + */ public SurfaceLine match( AbstractOSE os, int direction, int overlap, double connexity ) { SurfaceLineX surfaceLineX = new SurfaceLineX( this.getLength(), this.getLine() + direction ); @@ -61,12 +70,4 @@ public class SurfaceLineX extends SurfaceLine super(length, line ); } - public SurfaceLineX( AbstractOSE os, int size ) - { - super( os , size); - this.setLine( os.get( 0 ).getY() ); - } - - - } diff --git a/src/main/java/fr/pasteur/ida/zellige/element/surfaceLine/SurfaceLineY.java b/src/main/java/fr/pasteur/ida/zellige/element/surfaceLine/SurfaceLineY.java index 9b30ebd4d0c74d8624f79905b6992e7b12414b70..5b064f600933b58747425505e253a7925c982f76 100644 --- a/src/main/java/fr/pasteur/ida/zellige/element/surfaceLine/SurfaceLineY.java +++ b/src/main/java/fr/pasteur/ida/zellige/element/surfaceLine/SurfaceLineY.java @@ -66,8 +66,6 @@ public class SurfaceLineY extends SurfaceLine * @param connexity - the minimum percentage of match between the OS and the current instance. * @return - a new SurfaceLine if there is a match, null otherwise. */ - - public SurfaceLine match( AbstractOSE os, int direction, int overlap, double connexity ) { SurfaceLineY surfaceLineY = new SurfaceLineY( this.getLength(), this.getLine() + direction ); diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/LogAppender.java b/src/main/java/fr/pasteur/ida/zellige/gui/LogAppender.java index b5f865ad3367bcbfeff652a2d122812a20e19a90..f378ff45d49ade40e6d37aa75a407673d19cc42b 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/LogAppender.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/LogAppender.java @@ -51,7 +51,7 @@ public class LogAppender extends AppenderBase< ILoggingEvent > protected void append( ILoggingEvent iLoggingEvent ) { String level = iLoggingEvent.getLevel().toString(); - if ( level.equals( Level.INFO.toString() ) ) + if ( level.equals( Level.INFO.toString()) && iLoggingEvent.getMarker().contains( "GUI" )) { logMessage.setValue( iLoggingEvent.getFormattedMessage() ); } diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/MainAppFrame.java b/src/main/java/fr/pasteur/ida/zellige/gui/MainAppFrame.java index 9c77c3f061e2b5ceed5e71cbc6f711abf2f006bc..295953057c0597e90606e654acb7f591b61612dc 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/MainAppFrame.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/MainAppFrame.java @@ -45,6 +45,8 @@ import org.scijava.log.LogService; import org.scijava.plugin.Parameter; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.slf4j.Marker; +import org.slf4j.MarkerFactory; import javax.swing.*; import java.awt.*; @@ -57,7 +59,7 @@ import java.util.ResourceBundle; public class MainAppFrame extends JFrame { - private final static Logger LOGGER = LoggerFactory.getLogger( MainAppFrame.class ); + public static final Marker GUI_MARKER = MarkerFactory.getMarker("GUI"); private ImageJ ij; private final ImageDisplayService image; @Parameter @@ -86,15 +88,21 @@ public class MainAppFrame extends JFrame */ public void setLogStatus() { - LoggerContext lc = ( LoggerContext ) LoggerFactory.getILoggerFactory(); - PatternLayoutEncoder ple = new PatternLayoutEncoder(); - ple.setPattern( "%msg%n" ); - ple.setContext( lc ); - ple.start(); - LogAppender appender = new LogAppender(); + // Get the logger context + LoggerContext context = ( LoggerContext ) LoggerFactory.getILoggerFactory(); + + // Configure the log pattern + PatternLayoutEncoder layout = new PatternLayoutEncoder(); + layout.setPattern( "%msg%n" ); + layout.setContext( context ); + layout.start(); - appender.setContext( lc ); + // Create and start the custom LogAppender + LogAppender appender = new LogAppender(); + appender.setContext( context ); appender.start(); + + // Get the root logger and add the appender ch.qos.logback.classic.Logger logbackLogger = ( ch.qos.logback.classic.Logger ) LoggerFactory.getLogger( Logger.ROOT_LOGGER_NAME ); logbackLogger.addAppender( appender ); @@ -102,7 +110,6 @@ public class MainAppFrame extends JFrame public MainAppFrame( Context context ) { -// this.ij = context.; this.image = context.getService( ImageDisplayService.class ); this.logService = context.getService( LogService.class ); this.setIconImages( ICONS ); @@ -160,14 +167,12 @@ public class MainAppFrame extends JFrame { ResourceBundle bundle = ResourceBundle.getBundle( "gui" );// access to properties f FXMLLoader loader = new FXMLLoader( MainAppFrame.class.getClassLoader().getResource( "fr.pasteur.ida.zellige.gui.view/Main.fxml" ), bundle ); - VBox rootLayout = loader.load(); // Get the controller and add an ImageJ context to it. MainController< T > controller = loader.getController(); controller.setMainApp( this ); - // Show the scene containing the root layout. scene = new Scene( rootLayout ); this.fxPanel.setScene( scene ); @@ -183,4 +188,6 @@ public class MainAppFrame extends JFrame } + + } diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/controller/ConstructionController.java b/src/main/java/fr/pasteur/ida/zellige/gui/controller/ConstructionController.java index 8a4ec1725a8ea95c649eefbbbaaf5557005cb432..1ce2e79724400c01ae0fcc749468f2299805266f 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/controller/ConstructionController.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/controller/ConstructionController.java @@ -51,6 +51,7 @@ import org.slf4j.LoggerFactory; import java.net.URL; import java.util.ResourceBundle; +import static fr.pasteur.ida.zellige.gui.MainAppFrame.GUI_MARKER; import static fr.pasteur.ida.zellige.gui.controller.MainController.showError; import static fr.pasteur.ida.zellige.gui.controller.MainController.showInfo; import static fr.pasteur.ida.zellige.gui.controller.SelectionController.setNextOutputToNull; @@ -199,7 +200,7 @@ public class ConstructionController< T extends RealType< T > & NativeType< T > > { disableGUI( true ); - LOGGER.info( "Running construction" ); + LOGGER.info(GUI_MARKER, "Running construction" ); if ( getModel().maximumsProperty().getValue() != null ) { if ( getModel().firstRoundSurfacesProperty().getValue() == null ) @@ -220,7 +221,7 @@ public class ConstructionController< T extends RealType< T > & NativeType< T > > ConstructionDisplayTask< T > task = new ConstructionDisplayTask<>( getModel().referenceSurfacesProperty().getValue() ); task.setOnSucceeded( workerStateEvent -> { - LOGGER.info( "Construction display completed." ); + LOGGER.info(GUI_MARKER, "Construction display completed." ); getModel().getImageViews().setValue( task.getValue() ); parentController.getProjectionController().getModel().getImageViews().set( task.getValue() ); // parentController.getProjectionController().getModel().getReferenceSurfaces(). diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/controller/SelectionController.java b/src/main/java/fr/pasteur/ida/zellige/gui/controller/SelectionController.java index 034c83b6793bfd0964f00ee14bf93801f2a99451..66059bcc6662cfcb1a23eab72301388db7f28896 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/controller/SelectionController.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/controller/SelectionController.java @@ -53,6 +53,7 @@ import org.slf4j.LoggerFactory; import java.net.URL; import java.util.ResourceBundle; +import static fr.pasteur.ida.zellige.gui.MainAppFrame.GUI_MARKER; import static fr.pasteur.ida.zellige.gui.controller.MainController.showInfo; @@ -283,7 +284,7 @@ public class SelectionController< T extends RealType< T > & NativeType< T > > im SelectionDisplayTask selectionDisplayTask = new SelectionDisplayTask( getModel().selectedPixelsProperty().getValue() ); selectionDisplayTask.setOnSucceeded( workerStateEvent -> { - LOGGER.info( "Double classification done." ); + LOGGER.info( GUI_MARKER,"Double classification done!!!!!." ); getModel().imageViewsProperty().setValue( selectionDisplayTask.getValue() ); setDisplay(); } ); diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/interactor/ConstructionInteractor.java b/src/main/java/fr/pasteur/ida/zellige/gui/interactor/ConstructionInteractor.java index d6482cee12fcb0935f6115219f62bff932526e98..d6aa533cc4719769c6aa01880f475641e4821ed8 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/interactor/ConstructionInteractor.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/interactor/ConstructionInteractor.java @@ -16,6 +16,7 @@ import org.slf4j.LoggerFactory; import java.util.ArrayList; +import static fr.pasteur.ida.zellige.gui.MainAppFrame.GUI_MARKER; import static fr.pasteur.ida.zellige.gui.controller.MainController.showError; public class ConstructionInteractor< T extends RealType< T > & NativeType< T > > @@ -54,7 +55,7 @@ public class ConstructionInteractor< T extends RealType< T > & NativeType< T > > public void secondRound() { - LOGGER.info( "Computing second round construction..." ); + LOGGER.info( GUI_MARKER,"Computing second round construction..." ); if ( model.firstRoundSurfacesProperty().getValue() != null ) { AbstractTask< ArrayList< Surface > > secondRoundTask = new RunSecondConstructionTask( @@ -73,7 +74,7 @@ public class ConstructionInteractor< T extends RealType< T > & NativeType< T > > } else { - LOGGER.info( "Second round construction done." ); + LOGGER.info(GUI_MARKER, "Second round construction done." ); } } ); diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/model/ConstructionModel.java b/src/main/java/fr/pasteur/ida/zellige/gui/model/ConstructionModel.java index efa62a28d81ea32dd46852fce81c67d5b3da6169..0a2c2b14910033859b3eef8e51873f848fe7563a 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/model/ConstructionModel.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/model/ConstructionModel.java @@ -53,6 +53,8 @@ import org.slf4j.LoggerFactory; import java.util.ArrayList; +import static fr.pasteur.ida.zellige.gui.MainAppFrame.GUI_MARKER; + public class ConstructionModel< T extends RealType< T > & NativeType< T > > { @@ -91,7 +93,7 @@ public class ConstructionModel< T extends RealType< T > & NativeType< T > > public void firstRound() { - LOGGER.info( "Computing first round construction..." ); + LOGGER.info(GUI_MARKER, "Computing first round construction..." ); AbstractTask< ArrayList< Surface > > firstRoundTask = new RunFirstConstructionTask( maximums.getValue(), st1.doubleValue(), r1.intValue(), c1.doubleValue(), surfaceSize.doubleValue() / 100.0 ); firstRoundTask.setOnSucceeded( workerStateEvent -> { @@ -102,14 +104,14 @@ public class ConstructionModel< T extends RealType< T > & NativeType< T > > MainController.showError( new FirstRoundConstructionException() ); } } ); - LOGGER.info( "First round construction done." ); + LOGGER.info( GUI_MARKER,"First round construction done." ); firstRoundTask.start(); } public void secondRound() { - LOGGER.info( "Computing second round construction..." ); + LOGGER.info( GUI_MARKER,"Computing second round construction..." ); AbstractTask< ArrayList< Surface > > secondRoundTask = new RunSecondConstructionTask( firstRoundSurfacesProperty().getValue(), st2.getValue(), r2.intValue(), c2.doubleValue(), surfaceSize.doubleValue() / 100.0 ); secondRoundTask.setOnSucceeded( workerStateEvent -> { @@ -120,7 +122,7 @@ public class ConstructionModel< T extends RealType< T > & NativeType< T > > MainController.showError( new SecondRoundConstructionException() ); } } ); - LOGGER.info( "Second round construction done." ); + LOGGER.info( GUI_MARKER,"Second round construction done." ); secondRoundTask.start(); } diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/task/AmplitudeThresholdingTask.java b/src/main/java/fr/pasteur/ida/zellige/gui/task/AmplitudeThresholdingTask.java index 3077ef1a745392068aee21911bcaf58473fbff9a..52601f937f1ce815d2ba88531dc5a232ec62a0c7 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/task/AmplitudeThresholdingTask.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/task/AmplitudeThresholdingTask.java @@ -35,6 +35,8 @@ import net.imglib2.type.numeric.real.FloatType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static fr.pasteur.ida.zellige.gui.MainAppFrame.GUI_MARKER; + public class AmplitudeThresholdingTask extends AbstractTask< Img< BitType > > { @@ -52,9 +54,9 @@ public class AmplitudeThresholdingTask extends AbstractTask< Img< BitType > > @Override protected Img< BitType > call() { - LOGGER.info( "Computing amplitude thresholding..." ); + LOGGER.info(GUI_MARKER, "Computing amplitude thresholding..." ); Img< BitType > output = AmplitudeClassification.applyThreshold( input, amplitudeThreshold ); - LOGGER.info( "Amplitude thresholds computed..." ); + LOGGER.info( GUI_MARKER,"Amplitude thresholds computed..." ); return output; } } diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/task/BinningTask.java b/src/main/java/fr/pasteur/ida/zellige/gui/task/BinningTask.java index df3517509a9abd19f2d7ba3e1db277c51be8c502..f017dec08a6dbf488aed47a67e8613d9cc5c82a3 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/task/BinningTask.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/task/BinningTask.java @@ -8,6 +8,8 @@ import net.imglib2.type.numeric.RealType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static fr.pasteur.ida.zellige.gui.MainAppFrame.GUI_MARKER; + public class BinningTask < T extends RealType< T > & NativeType< T > > extends AbstractTask<Img<T>> { private final static Logger LOGGER = LoggerFactory.getLogger( BinningTask.class ); @@ -22,9 +24,9 @@ public class BinningTask < T extends RealType< T > & NativeType< T > > extends A @Override protected Img<T> call() { - LOGGER.info( "Binning" ); + LOGGER.info( GUI_MARKER,"Binning" ); Img<T> binnedImage = Binning.run( input, bin ); - LOGGER.info( "Image binned !" ); + LOGGER.info( GUI_MARKER,"Image binned !" ); return binnedImage; } } diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/task/ComputeClassificationImagesTask.java b/src/main/java/fr/pasteur/ida/zellige/gui/task/ComputeClassificationImagesTask.java index e5e69db8cb8c27db046c2559d55930c1f8e1c79e..e6abffa4b472fb77a12d8a8492ad4015bc12c11b 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/task/ComputeClassificationImagesTask.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/task/ComputeClassificationImagesTask.java @@ -38,6 +38,8 @@ import net.imglib2.type.numeric.real.FloatType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static fr.pasteur.ida.zellige.gui.MainAppFrame.GUI_MARKER; + public class ComputeClassificationImagesTask extends AbstractTask< ClassifiedImages< FloatType > > { @@ -53,12 +55,12 @@ public class ComputeClassificationImagesTask extends AbstractTask< ClassifiedIma @Override protected ClassifiedImages< FloatType > call() throws Exception { - LOGGER.info( "Computing classified images..." ); + LOGGER.info( GUI_MARKER,"Computing classified images..." ); ImgFactory< FloatType > factory = new ArrayImgFactory<>( new FloatType() ); ClassifiedImages< FloatType > images = new ClassifiedImages<>(); images.setAmplitudeImg( AmplitudeClassification.computeAmplitudeImage( pretreatedImg, factory ) ); images.setOtsuImg( OtsuClassification.computeOtsuImage( pretreatedImg, factory ) ); - LOGGER.debug( "Classification images computed" ); + LOGGER.debug( GUI_MARKER,"Classification images computed" ); return images; } } diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/task/ConstructionCompletionTask.java b/src/main/java/fr/pasteur/ida/zellige/gui/task/ConstructionCompletionTask.java index 2e11661d0fb18020b5b607419cb348acfa088216..6a3400b9dbf45b7481570042b1a9badca71a02cf 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/task/ConstructionCompletionTask.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/task/ConstructionCompletionTask.java @@ -40,6 +40,8 @@ import org.slf4j.LoggerFactory; import java.util.ArrayList; +import static fr.pasteur.ida.zellige.gui.MainAppFrame.GUI_MARKER; + public class ConstructionCompletionTask< T extends RealType< T > & NativeType< T > > extends AbstractTask< ArrayList< ReferenceSurface< T > > > { private final static Logger LOGGER = LoggerFactory.getLogger( ConstructionCompletionTask.class ); @@ -60,12 +62,12 @@ public class ConstructionCompletionTask< T extends RealType< T > & NativeType< T @Override protected ArrayList< ReferenceSurface< T > > call() { - LOGGER.info( "Processing construction completion..." ); + LOGGER.info( GUI_MARKER,"Processing construction completion..." ); ArrayList< ReferenceSurface< T > > list = ConstructionCompletion.run( input, factory, finalSurfaces , bin); - LOGGER.info( "construction completed..." ); + LOGGER.info(GUI_MARKER, "construction completed..." ); if ( list.isEmpty() ) { - LOGGER.info( "no surfaces..." ); + LOGGER.info( GUI_MARKER,"no surfaces..." ); } return list; diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/task/InterClassificationTask.java b/src/main/java/fr/pasteur/ida/zellige/gui/task/InterClassificationTask.java index 129f208bee20cd72383ec65d34001d8a93de342b..20b064b3f633f25c8294c3ae63e886ba8fab99dc 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/task/InterClassificationTask.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/task/InterClassificationTask.java @@ -35,6 +35,8 @@ import net.imglib2.type.logic.BitType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static fr.pasteur.ida.zellige.gui.MainAppFrame.GUI_MARKER; + public class InterClassificationTask extends AbstractTask< Img< BitType > > { @@ -53,7 +55,7 @@ public class InterClassificationTask extends AbstractTask< Img< BitType > > protected Img< BitType > call() { - LOGGER.info( "Computing inter-classification..." ); + LOGGER.info(GUI_MARKER, "Computing inter-classification..." ); return Classification.interClassification( selectedAmplitude.getValue(), selectedAmplitude.getValue().factory(), selectedOtsu.getValue() ); } diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/task/IslandSearchTask.java b/src/main/java/fr/pasteur/ida/zellige/gui/task/IslandSearchTask.java index def2e087ff95cc9f16a820120073974fd3e76c9e..66a8a4c2bccd99c1764ef795e32d107f0764a3cb 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/task/IslandSearchTask.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/task/IslandSearchTask.java @@ -36,6 +36,8 @@ import net.imglib2.type.logic.BitType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static fr.pasteur.ida.zellige.gui.MainAppFrame.GUI_MARKER; + public class IslandSearchTask extends AbstractTask< Img< BitType > > { @@ -52,9 +54,9 @@ public class IslandSearchTask extends AbstractTask< Img< BitType > > @Override protected Img< BitType > call() { - LOGGER.info( "Computing Island Search..." ); + LOGGER.info( GUI_MARKER,"Computing Island Search..." ); Img< BitType > img = PostTreatment.runIslandSearch( image.getValue(), islandSize.intValue() ); - LOGGER.debug( "Task's end." ); + LOGGER.info( GUI_MARKER,"Task's end." ); return img; // return iSImage; } diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/task/OtsuThresholdingTask.java b/src/main/java/fr/pasteur/ida/zellige/gui/task/OtsuThresholdingTask.java index 982b55216e4ffd06211191c26ff462b66d88f358..0c47372cea3055a2692b6e2eabccbf34d768a962 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/task/OtsuThresholdingTask.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/task/OtsuThresholdingTask.java @@ -36,6 +36,8 @@ import net.imglib2.type.numeric.real.FloatType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static fr.pasteur.ida.zellige.gui.MainAppFrame.GUI_MARKER; + public class OtsuThresholdingTask extends AbstractTask< Img< BitType > > { @@ -55,9 +57,9 @@ public class OtsuThresholdingTask extends AbstractTask< Img< BitType > > @Override protected Img< BitType > call() { - LOGGER.info( "Computing otsu thresholding..." ); + LOGGER.info( GUI_MARKER,"Computing otsu thresholding..." ); Img< BitType > output = OtsuClassification.applyLocalThreshold( pretreatedImage.getValue(), input, otsuThreshold ); - LOGGER.info( "Amplitude thresholds computed..." ); + LOGGER.info( GUI_MARKER,"Amplitude thresholds computed..." ); return output; } } diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/task/PreprocessingTask.java b/src/main/java/fr/pasteur/ida/zellige/gui/task/PreprocessingTask.java index 895228160ee910a9b6b5bf769d809a075f3376dd..a88b965aa01fbcd109cadabf99510d8de6b1dd66 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/task/PreprocessingTask.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/task/PreprocessingTask.java @@ -37,6 +37,8 @@ import net.imglib2.type.numeric.real.FloatType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static fr.pasteur.ida.zellige.gui.MainAppFrame.GUI_MARKER; + public class PreprocessingTask< T extends RealType< T > & NativeType< T > > extends AbstractTask< Img< FloatType > > { @@ -55,10 +57,10 @@ public class PreprocessingTask< T extends RealType< T > & NativeType< T > > exte @Override protected Img< FloatType > call() { - LOGGER.info( "Computing pretreatment..." ); + LOGGER.info(GUI_MARKER, "Computing pretreatment..." ); Img< FloatType > pretreatedImg = Pretreatment.run( input, radius, bin ); - LOGGER.debug( "Done." ); + LOGGER.info( GUI_MARKER,"Done." ); return pretreatedImg; } } diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/task/RunFirstConstructionTask.java b/src/main/java/fr/pasteur/ida/zellige/gui/task/RunFirstConstructionTask.java index 6b08062b98772d0bbf1c78b89724b1f3a62808e0..967f50e88c092719effa5b536f5a669ca1b2bea7 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/task/RunFirstConstructionTask.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/task/RunFirstConstructionTask.java @@ -38,6 +38,8 @@ import org.slf4j.LoggerFactory; import java.util.ArrayList; +import static fr.pasteur.ida.zellige.gui.MainAppFrame.GUI_MARKER; + public class RunFirstConstructionTask extends AbstractTask< ArrayList< Surface > > { private final static Logger LOGGER = LoggerFactory.getLogger( RunFirstConstructionTask.class ); @@ -59,7 +61,7 @@ public class RunFirstConstructionTask extends AbstractTask< ArrayList< Surface > @Override protected ArrayList< Surface > call() { - LOGGER.info( "Computing first round construction..." ); + LOGGER.info( GUI_MARKER,"Computing first round construction..." ); FirstRoundConstruction step1 = new FirstRoundConstruction( maximums, startingOsSize1, overlap1, connexityRate1, surfaceMinSizeFactor ); try { @@ -67,7 +69,7 @@ public class RunFirstConstructionTask extends AbstractTask< ArrayList< Surface > } catch ( NoSurfaceFoundException e ) { - LOGGER.info( "First round : No surfaces found..." ); + LOGGER.info( GUI_MARKER,"First round : No surfaces found..." ); return null; } return step1.getSurfaces(); diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/task/RunSecondConstructionTask.java b/src/main/java/fr/pasteur/ida/zellige/gui/task/RunSecondConstructionTask.java index eb4f67261f00112a6a6091f314d9d8a1721a9e8d..c9dcd4e7de2e6b7374ef8977f37f9e4aaf3de614 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/task/RunSecondConstructionTask.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/task/RunSecondConstructionTask.java @@ -36,6 +36,8 @@ import org.slf4j.LoggerFactory; import java.util.ArrayList; +import static fr.pasteur.ida.zellige.gui.MainAppFrame.GUI_MARKER; + public class RunSecondConstructionTask extends AbstractTask< ArrayList< Surface > > { private final static Logger LOGGER = LoggerFactory.getLogger( RunSecondConstructionTask.class ); @@ -58,16 +60,16 @@ public class RunSecondConstructionTask extends AbstractTask< ArrayList< Surface @Override protected ArrayList< Surface > call() { - LOGGER.info( "Computing second round construction..." ); + LOGGER.info( GUI_MARKER,"Computing second round construction..." ); SecondRoundConstruction step2 = new SecondRoundConstruction( surfaces, startingOsSize2, overlap2, connexityRate2, surfaceMinSizeFactor ); try { step2.process(); - LOGGER.info( "Second round : {} surface(s) found", step2.getSurfaces().size() ); + LOGGER.info(GUI_MARKER, "Second round : {} surface(s) found", step2.getSurfaces().size() ); } catch ( NoSurfaceFoundException e ) { - LOGGER.info( "No surface found" ); + LOGGER.info( GUI_MARKER,"No surface found" ); return null; } return step2.getSurfaces(); diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/task/SmoothingTask.java b/src/main/java/fr/pasteur/ida/zellige/gui/task/SmoothingTask.java index 51535b5e735c34bc835db177a17e75842d3593ce..6466287da58049bd0007238c044ad5c200c35db9 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/task/SmoothingTask.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/task/SmoothingTask.java @@ -38,6 +38,8 @@ import net.imglib2.type.numeric.real.FloatType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import static fr.pasteur.ida.zellige.gui.MainAppFrame.GUI_MARKER; + public class SmoothingTask extends AbstractTask<Img < FloatType >> { @@ -56,7 +58,7 @@ public class SmoothingTask extends AbstractTask<Img < FloatType >> @Override protected Img<FloatType> call() throws Exception { - LOGGER.info( "Computing first smoothing..." ); + LOGGER.info( GUI_MARKER,"Computing first smoothing..." ); return PostTreatment.runSmoothing( islandSearchImage.getValue(), sigmaXY.intValue(), sigmaZ.intValue() ); } } diff --git a/src/main/java/fr/pasteur/ida/zellige/steps/Utils.java b/src/main/java/fr/pasteur/ida/zellige/steps/Utils.java index 29c0929fe3dcffaa201c86dbe317d1dd8d6e9b98..c527c8067d9193615184888e5a41ec4d014f486d 100644 --- a/src/main/java/fr/pasteur/ida/zellige/steps/Utils.java +++ b/src/main/java/fr/pasteur/ida/zellige/steps/Utils.java @@ -34,12 +34,8 @@ import net.imglib2.img.Img; import net.imglib2.type.NativeType; import net.imglib2.type.numeric.RealType; import net.imglib2.type.numeric.real.FloatType; -import net.imglib2.view.IterableRandomAccessibleInterval; -import net.imglib2.view.RandomAccessibleIntervalCursor; import net.imglib2.view.Views; - - /** * Some "utils" methods. */ @@ -85,7 +81,6 @@ public class Utils randomAccess.setPosition( z, 2 ); } - public static < T extends RealType< T > & NativeType< T > > T setPositionAndGet( RandomAccess< T > randomAccess, int u, int v ) { setPosition( randomAccess, u, v ); diff --git a/src/main/java/fr/pasteur/ida/zellige/steps/construction/Construction.java b/src/main/java/fr/pasteur/ida/zellige/steps/construction/Construction.java index f52b373dac82cc7bac807faedf94663796d8d33a..f1c8a0b02dfabe54bcf974939b908276b00f7af9 100644 --- a/src/main/java/fr/pasteur/ida/zellige/steps/construction/Construction.java +++ b/src/main/java/fr/pasteur/ida/zellige/steps/construction/Construction.java @@ -1,6 +1,5 @@ package fr.pasteur.ida.zellige.steps.construction; -import fr.pasteur.ida.zellige.ReferenceSurfaceExtraction; import fr.pasteur.ida.zellige.element.ReferenceSurface; import fr.pasteur.ida.zellige.element.Surface; import fr.pasteur.ida.zellige.steps.construction.exception.NoSurfaceFoundException; diff --git a/src/main/java/fr/pasteur/ida/zellige/steps/selection/util/ExtremaDetection.java b/src/main/java/fr/pasteur/ida/zellige/steps/selection/util/ExtremaDetection.java index 6d1cd56334d73e141fa956ef2381e41907c42ca7..dcdf6656690e1999a9a3cbb6d8db875374921ad4 100644 --- a/src/main/java/fr/pasteur/ida/zellige/steps/selection/util/ExtremaDetection.java +++ b/src/main/java/fr/pasteur/ida/zellige/steps/selection/util/ExtremaDetection.java @@ -43,7 +43,6 @@ import org.slf4j.LoggerFactory; public class ExtremaDetection< T extends RealType< T > & NativeType< T > > { - public static final String MAX = "max"; public static final String MIN = "min"; private final static Logger LOGGER = LoggerFactory.getLogger( ExtremaDetection.class ); diff --git a/src/main/java/fr/pasteur/ida/zellige/steps/selection/util/ExtremaDetection2D.java b/src/main/java/fr/pasteur/ida/zellige/steps/selection/util/ExtremaDetection2D.java index e4507dcfae55a74aac52d10d5f59030ff62e6203..a2a5495ff234ad88f9e4ce9a74e910f3b3028345 100644 --- a/src/main/java/fr/pasteur/ida/zellige/steps/selection/util/ExtremaDetection2D.java +++ b/src/main/java/fr/pasteur/ida/zellige/steps/selection/util/ExtremaDetection2D.java @@ -40,7 +40,6 @@ import static fr.pasteur.ida.zellige.steps.selection.util.ExtremaDetection.MAX; public class ExtremaDetection2D< T extends RealType< T > & NativeType< T > > { - private final RandomAccessibleInterval< T > inputSection; private final ImgFactory< T > factory; private final RandomAccessibleInterval< T > extrema; @@ -86,15 +85,13 @@ public class ExtremaDetection2D< T extends RealType< T > & NativeType< T > > } } - /** * @param section the section considered * @param sectionDerivative the corresponding partial derivative section of the input image as a {@link RandomAccessibleInterval} */ private void computeExtrema - ( RandomAccessibleInterval< T > section, RandomAccessibleInterval< T > sectionDerivative - ) + ( RandomAccessibleInterval< T > section, RandomAccessibleInterval< T > sectionDerivative ) { RandomAccess< T > derivativeAccess = Views.extendMirrorSingle( sectionDerivative ).randomAccess(); RandomAccess< T > extremaAccess = extrema.randomAccess(); @@ -125,7 +122,7 @@ public class ExtremaDetection2D< T extends RealType< T > & NativeType< T > > * @param z - the index of the Z dimension * @return - true if the position (v, z) is a local maximum false otherwise. */ - private boolean isALocalExtrema( RandomAccess< T > derivative, int z ) //throws Exception + private boolean isALocalExtrema( RandomAccess< T > derivative, int z ) { derivative.setPosition( z, 1 ); final double tZero = derivative.get().getRealDouble();