Skip to content
Snippets Groups Projects
Commit 3f079c01 authored by Céline  TREBEAU's avatar Céline TREBEAU
Browse files

refactor: changed from observable Properties to raw values where binding was unnecessary

parent 47e64b3d
No related branches found
No related tags found
2 merge requests!47Feature : Multi-channel and Binning,!41Resolve "Consider rescaling (binning) large images"
...@@ -31,7 +31,7 @@ public class SelectionInteractor ...@@ -31,7 +31,7 @@ public class SelectionInteractor
public void runOtsuTask() public void runOtsuTask()
{ {
OtsuThresholdingTask otsuTask = new OtsuThresholdingTask( model.pretreatedImgProperty(), model.imagesProperty().get().getOtsuImg(), model.otsuProperty().getValue().intValue() ); OtsuThresholdingTask otsuTask = new OtsuThresholdingTask( model.pretreatedImgProperty().get(), model.imagesProperty().get().getOtsuImg(), model.otsuProperty().getValue().intValue() );
otsuTask.setOnSucceeded( workerStateEvent -> otsuTask.setOnSucceeded( workerStateEvent ->
model.selectedOtsuProperty().setValue( otsuTask.getValue() ) ); model.selectedOtsuProperty().setValue( otsuTask.getValue() ) );
// otsuTask.setOnFailed( workerStateEvent -> LOGGER.debug( "Otsu classification has failed." ) ); // otsuTask.setOnFailed( workerStateEvent -> LOGGER.debug( "Otsu classification has failed." ) );
...@@ -40,14 +40,14 @@ public class SelectionInteractor ...@@ -40,14 +40,14 @@ public class SelectionInteractor
public void runInterClassification() public void runInterClassification()
{ {
InterClassificationTask interClassificationTask = new InterClassificationTask( model.selectedAmplitudeProperty(), model.selectedOtsuProperty() ); InterClassificationTask interClassificationTask = new InterClassificationTask( model.selectedAmplitudeProperty().get(), model.selectedOtsuProperty().get() );
interClassificationTask.setOnSucceeded( event -> model.interClassifiedImageProperty().setValue( interClassificationTask.getValue() ) ); interClassificationTask.setOnSucceeded( event -> model.interClassifiedImageProperty().setValue( interClassificationTask.getValue() ) );
interClassificationTask.start(); interClassificationTask.start();
} }
public void runIslandSearch() public void runIslandSearch()
{ {
IslandSearchTask islandSearchTask = new IslandSearchTask( model.interClassifiedImageProperty(), model.islandProperty() ); IslandSearchTask islandSearchTask = new IslandSearchTask( model.interClassifiedImageProperty().get(), model.islandProperty().get() );
islandSearchTask.setOnSucceeded( workerStateEvent -> islandSearchTask.setOnSucceeded( workerStateEvent ->
model.islandSearchImageProperty().setValue( islandSearchTask.getValue() ) ); model.islandSearchImageProperty().setValue( islandSearchTask.getValue() ) );
// islandSearchTask.setOnFailed( workerStateEvent -> LOGGER.debug( "FAILED" ) ); // islandSearchTask.setOnFailed( workerStateEvent -> LOGGER.debug( "FAILED" ) );
...@@ -56,7 +56,10 @@ public class SelectionInteractor ...@@ -56,7 +56,10 @@ public class SelectionInteractor
public void runSmoothing() public void runSmoothing()
{ {
SmoothingTask smoothingTask = new SmoothingTask( model.islandSearchImageProperty(), model.xyBlurProperty(), model.zBlurProperty() ); SmoothingTask smoothingTask = new SmoothingTask(
model.islandSearchImageProperty().get(),
model.xyBlurProperty().get(),
model.zBlurProperty().get() );
smoothingTask.setOnSucceeded( event -> smoothingTask.setOnSucceeded( event ->
model.selectedPixelsProperty().setValue( smoothingTask.getValue() ) ); model.selectedPixelsProperty().setValue( smoothingTask.getValue() ) );
smoothingTask.start(); smoothingTask.start();
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
package fr.pasteur.ida.zellige.gui.task; package fr.pasteur.ida.zellige.gui.task;
import fr.pasteur.ida.zellige.steps.selection.classification.Classification; import fr.pasteur.ida.zellige.steps.selection.classification.Classification;
import javafx.beans.property.SimpleObjectProperty;
import net.imglib2.img.Img; import net.imglib2.img.Img;
import net.imglib2.type.logic.BitType; import net.imglib2.type.logic.BitType;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -41,10 +40,10 @@ public class InterClassificationTask extends AbstractTask< Img< BitType > > ...@@ -41,10 +40,10 @@ public class InterClassificationTask extends AbstractTask< Img< BitType > >
{ {
private final static Logger LOGGER = LoggerFactory.getLogger( InterClassificationTask.class ); private final static Logger LOGGER = LoggerFactory.getLogger( InterClassificationTask.class );
private final SimpleObjectProperty< Img< BitType > > selectedAmplitude; private final Img< BitType >selectedAmplitude;
private final SimpleObjectProperty< Img< BitType > > selectedOtsu; private final Img< BitType >selectedOtsu;
public InterClassificationTask( SimpleObjectProperty< Img< BitType > > selectedAmplitude, SimpleObjectProperty< Img< BitType > > selectedOtsu ) public InterClassificationTask( Img< BitType > selectedAmplitude, Img< BitType > selectedOtsu )
{ {
this.selectedAmplitude = selectedAmplitude; this.selectedAmplitude = selectedAmplitude;
this.selectedOtsu = selectedOtsu; this.selectedOtsu = selectedOtsu;
...@@ -56,7 +55,7 @@ public class InterClassificationTask extends AbstractTask< Img< BitType > > ...@@ -56,7 +55,7 @@ public class InterClassificationTask extends AbstractTask< Img< BitType > >
{ {
LOGGER.info(GUI_MARKER, "Computing inter-classification..." ); LOGGER.info(GUI_MARKER, "Computing inter-classification..." );
return Classification.interClassification( selectedAmplitude.getValue(), selectedAmplitude.getValue().factory(), selectedOtsu.getValue() ); return Classification.interClassification( selectedAmplitude, selectedAmplitude.factory(), selectedOtsu );
} }
......
...@@ -29,8 +29,6 @@ ...@@ -29,8 +29,6 @@
package fr.pasteur.ida.zellige.gui.task; package fr.pasteur.ida.zellige.gui.task;
import fr.pasteur.ida.zellige.steps.selection.postTreatment.PostTreatment; import fr.pasteur.ida.zellige.steps.selection.postTreatment.PostTreatment;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import net.imglib2.img.Img; import net.imglib2.img.Img;
import net.imglib2.type.logic.BitType; import net.imglib2.type.logic.BitType;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -42,10 +40,10 @@ public class IslandSearchTask extends AbstractTask< Img< BitType > > ...@@ -42,10 +40,10 @@ public class IslandSearchTask extends AbstractTask< Img< BitType > >
{ {
private final static Logger LOGGER = LoggerFactory.getLogger( IslandSearchTask.class ); private final static Logger LOGGER = LoggerFactory.getLogger( IslandSearchTask.class );
private final SimpleObjectProperty< Img< BitType > > image; private final Img< BitType > image;
private final IntegerProperty islandSize; private final int islandSize;
public IslandSearchTask( SimpleObjectProperty< Img< BitType > > image, IntegerProperty islandSize ) public IslandSearchTask( Img< BitType > image, int islandSize )
{ {
this.image = image; this.image = image;
this.islandSize = islandSize; this.islandSize = islandSize;
...@@ -55,7 +53,7 @@ public class IslandSearchTask extends AbstractTask< Img< BitType > > ...@@ -55,7 +53,7 @@ public class IslandSearchTask extends AbstractTask< Img< BitType > >
protected Img< BitType > call() protected Img< BitType > call()
{ {
LOGGER.info( GUI_MARKER,"Computing Island Search..." ); LOGGER.info( GUI_MARKER,"Computing Island Search..." );
Img< BitType > img = PostTreatment.runIslandSearch( image.getValue(), islandSize.intValue() ); Img< BitType > img = PostTreatment.runIslandSearch( image, islandSize );
LOGGER.info( GUI_MARKER,"Task's end." ); LOGGER.info( GUI_MARKER,"Task's end." );
return img; return img;
// return iSImage; // return iSImage;
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
package fr.pasteur.ida.zellige.gui.task; package fr.pasteur.ida.zellige.gui.task;
import fr.pasteur.ida.zellige.steps.selection.classification.OtsuClassification; import fr.pasteur.ida.zellige.steps.selection.classification.OtsuClassification;
import javafx.beans.property.SimpleObjectProperty;
import net.imglib2.img.Img; import net.imglib2.img.Img;
import net.imglib2.type.logic.BitType; import net.imglib2.type.logic.BitType;
import net.imglib2.type.numeric.real.FloatType; import net.imglib2.type.numeric.real.FloatType;
...@@ -42,12 +41,12 @@ public class OtsuThresholdingTask extends AbstractTask< Img< BitType > > ...@@ -42,12 +41,12 @@ public class OtsuThresholdingTask extends AbstractTask< Img< BitType > >
{ {
private final static Logger LOGGER = LoggerFactory.getLogger( OtsuThresholdingTask.class ); private final static Logger LOGGER = LoggerFactory.getLogger( OtsuThresholdingTask.class );
private final SimpleObjectProperty< Img< FloatType > > pretreatedImage; private final Img< FloatType > pretreatedImage;
private final Img<FloatType> input; private final Img<FloatType> input;
private final int otsuThreshold; private final int otsuThreshold;
public OtsuThresholdingTask( SimpleObjectProperty< Img< FloatType > > pretreatedImage, Img<FloatType> input, int otsuThreshold ) public OtsuThresholdingTask( Img< FloatType > pretreatedImage, Img<FloatType> input, int otsuThreshold )
{ {
this.pretreatedImage = pretreatedImage; this.pretreatedImage = pretreatedImage;
this.input = input; this.input = input;
...@@ -58,7 +57,7 @@ public class OtsuThresholdingTask extends AbstractTask< Img< BitType > > ...@@ -58,7 +57,7 @@ public class OtsuThresholdingTask extends AbstractTask< Img< BitType > >
protected Img< BitType > call() protected Img< BitType > call()
{ {
LOGGER.info( GUI_MARKER,"Computing otsu thresholding..." ); LOGGER.info( GUI_MARKER,"Computing otsu thresholding..." );
Img< BitType > output = OtsuClassification.applyLocalThreshold( pretreatedImage.getValue(), input, otsuThreshold ); Img< BitType > output = OtsuClassification.applyLocalThreshold( pretreatedImage, input, otsuThreshold );
LOGGER.info( GUI_MARKER,"Amplitude thresholds computed..." ); LOGGER.info( GUI_MARKER,"Amplitude thresholds computed..." );
return output; return output;
} }
......
...@@ -29,8 +29,6 @@ ...@@ -29,8 +29,6 @@
package fr.pasteur.ida.zellige.gui.task; package fr.pasteur.ida.zellige.gui.task;
import fr.pasteur.ida.zellige.steps.selection.postTreatment.PostTreatment; import fr.pasteur.ida.zellige.steps.selection.postTreatment.PostTreatment;
import javafx.beans.property.IntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import net.imglib2.img.Img; import net.imglib2.img.Img;
import net.imglib2.type.logic.BitType; import net.imglib2.type.logic.BitType;
import net.imglib2.type.numeric.real.FloatType; import net.imglib2.type.numeric.real.FloatType;
...@@ -43,11 +41,11 @@ public class SmoothingTask extends AbstractTask<Img < FloatType >> ...@@ -43,11 +41,11 @@ public class SmoothingTask extends AbstractTask<Img < FloatType >>
{ {
private final static Logger LOGGER = LoggerFactory.getLogger( SmoothingTask.class ); private final static Logger LOGGER = LoggerFactory.getLogger( SmoothingTask.class );
private final SimpleObjectProperty< Img< BitType > > islandSearchImage; private final Img< BitType > islandSearchImage;
private final IntegerProperty sigmaXY; private final int sigmaXY;
private final IntegerProperty sigmaZ; private final int sigmaZ;
public SmoothingTask( SimpleObjectProperty< Img< BitType > > islandSearchImage, IntegerProperty sigmaXY, IntegerProperty sigmaZ ) public SmoothingTask( Img< BitType > islandSearchImage, int sigmaXY, int sigmaZ )
{ {
this.islandSearchImage = islandSearchImage; this.islandSearchImage = islandSearchImage;
this.sigmaXY = sigmaXY; this.sigmaXY = sigmaXY;
...@@ -58,6 +56,6 @@ public class SmoothingTask extends AbstractTask<Img < FloatType >> ...@@ -58,6 +56,6 @@ public class SmoothingTask extends AbstractTask<Img < FloatType >>
protected Img<FloatType> call() throws Exception protected Img<FloatType> call() throws Exception
{ {
LOGGER.info( GUI_MARKER,"Computing first smoothing..." ); LOGGER.info( GUI_MARKER,"Computing first smoothing..." );
return PostTreatment.runSmoothing( islandSearchImage.getValue(), sigmaXY.intValue(), sigmaZ.intValue() ); return PostTreatment.runSmoothing( islandSearchImage, sigmaXY, sigmaZ );
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment