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

feat(gui): Add two bound StringProperties to pass input name from...

feat(gui): Add two bound StringProperties to pass input name from Preprocessing to Projection controller

           - Introduced two StringProperty fields in the GUI, bound to each other
           - Used to transfer the input name from the PreprocessingController to the ProjectionController
           - Input name is now displayed in the Projection view
parent e7432a54
No related branches found
No related tags found
No related merge requests found
...@@ -122,6 +122,7 @@ public class MainController< T extends RealType< T > & NativeType< T > > impleme ...@@ -122,6 +122,7 @@ public class MainController< T extends RealType< T > & NativeType< T > > impleme
constructionController.getModel().getInput().bind( preprocessingController.getModel().getInput() ); constructionController.getModel().getInput().bind( preprocessingController.getModel().getInput() );
constructionController.getModel().getFactory().bind( preprocessingController.getModel().getFactory() ); constructionController.getModel().getFactory().bind( preprocessingController.getModel().getFactory() );
projectionController.getModel().getColors().bind( preprocessingController.getModel().getColors() ); projectionController.getModel().getColors().bind( preprocessingController.getModel().getColors() );
projectionController.getModel().inputNameProperty().bind(preprocessingController.getModel().inputNameProperty());
// Sets the projection display when the projection tab is clicked on. // Sets the projection display when the projection tab is clicked on.
tabPane.getTabs().get( 2 ).selectedProperty().addListener( ( observableValue, number, newValue ) -> tabPane.getTabs().get( 2 ).selectedProperty().addListener( ( observableValue, number, newValue ) ->
......
...@@ -119,6 +119,7 @@ public class PreprocessingController< T extends RealType< T > & NativeType< T > ...@@ -119,6 +119,7 @@ public class PreprocessingController< T extends RealType< T > & NativeType< T >
{ {
getModel().getInput().set( ( RandomAccessibleInterval< T > ) newValue.getImgPlus() ); getModel().getInput().set( ( RandomAccessibleInterval< T > ) newValue.getImgPlus() );
} }
getModel().inputNameProperty().set( FilenameUtils.removeExtension( newValue.getName() ));
// Set the input factory // Set the input factory
getModel().getFactory().setValue( ( ImgFactory< T > ) newValue.getImgPlus().factory() ); getModel().getFactory().setValue( ( ImgFactory< T > ) newValue.getImgPlus().factory() );
......
...@@ -40,7 +40,9 @@ public class ProjectionInteractor< T extends RealType< T > & NativeType< T > > ...@@ -40,7 +40,9 @@ public class ProjectionInteractor< T extends RealType< T > & NativeType< T > >
{ {
LOGGER.debug( "The projection has succeed!" ); LOGGER.debug( "The projection has succeed!" );
// Wraps the projection inside an ImgPlus to display the colors if necessary. // Wraps the projection inside an ImgPlus to display the colors if necessary.
ImgPlus< T > imgPlus = ReferenceSurfaceProjection.setColorsAndName( task.getValue(), getModel().getColors().get(), "" ); String inputName = getModel().inputNameProperty().get();
String projectionName = String.format( "%s_proj_%d", inputName, ( index + 1 ) );
ImgPlus< T > imgPlus = ReferenceSurfaceProjection.setColorsAndName( task.getValue(), getModel().getColors().get(), projectionName );
Context context = ( Context ) IJ.runPlugIn( "org.scijava.Context", "" ); Context context = ( Context ) IJ.runPlugIn( "org.scijava.Context", "" );
net.imagej.ImageJ ij = new net.imagej.ImageJ( context ); net.imagej.ImageJ ij = new net.imagej.ImageJ( context );
ij.ui().show( imgPlus ); ij.ui().show( imgPlus );
......
package fr.pasteur.ida.zellige.gui.model; package fr.pasteur.ida.zellige.gui.model;
import javafx.beans.property.IntegerProperty; import javafx.beans.property.*;
import javafx.beans.property.SimpleBooleanProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import net.imglib2.RandomAccessibleInterval; import net.imglib2.RandomAccessibleInterval;
import net.imglib2.display.ColorTable; import net.imglib2.display.ColorTable;
import net.imglib2.img.Img; import net.imglib2.img.Img;
...@@ -17,6 +14,8 @@ import java.util.ArrayList; ...@@ -17,6 +14,8 @@ import java.util.ArrayList;
public class PreprocessingModel< T extends RealType< T > & NativeType< T > > public class PreprocessingModel< T extends RealType< T > & NativeType< T > >
{ {
private final StringProperty inputName = new SimpleStringProperty();
private final IntegerProperty bin = new SimpleIntegerProperty(); private final IntegerProperty bin = new SimpleIntegerProperty();
private final IntegerProperty channel = new SimpleIntegerProperty(); private final IntegerProperty channel = new SimpleIntegerProperty();
...@@ -35,6 +34,13 @@ public class PreprocessingModel< T extends RealType< T > & NativeType< T > > ...@@ -35,6 +34,13 @@ public class PreprocessingModel< T extends RealType< T > & NativeType< T > >
private final SimpleObjectProperty< ArrayList< ColorTable > > colors = new SimpleObjectProperty<>(new ArrayList<>()); private final SimpleObjectProperty< ArrayList< ColorTable > > colors = new SimpleObjectProperty<>(new ArrayList<>());
public StringProperty inputNameProperty()
{
return inputName;
}
public IntegerProperty binProperty() public IntegerProperty binProperty()
{ {
return bin; return bin;
......
...@@ -41,6 +41,7 @@ import java.util.ArrayList; ...@@ -41,6 +41,7 @@ import java.util.ArrayList;
public class ProjectionModel< T extends RealType< T > & NativeType< T > > public class ProjectionModel< T extends RealType< T > & NativeType< T > >
{ {
private final SimpleStringProperty inputName = new SimpleStringProperty();
private final SimpleObjectProperty< ArrayList< ReferenceSurface< T > > > referenceSurfaces = new SimpleObjectProperty<>( new ArrayList<>() ); private final SimpleObjectProperty< ArrayList< ReferenceSurface< T > > > referenceSurfaces = new SimpleObjectProperty<>( new ArrayList<>() );
private final SimpleObjectProperty< ArrayList< ProjectionProperties< T > > > projectionProperties = new SimpleObjectProperty<>( new ArrayList<>() ); private final SimpleObjectProperty< ArrayList< ProjectionProperties< T > > > projectionProperties = new SimpleObjectProperty<>( new ArrayList<>() );
private final SimpleObjectProperty< ImageView[] > imageViews = new SimpleObjectProperty<>(); private final SimpleObjectProperty< ImageView[] > imageViews = new SimpleObjectProperty<>();
...@@ -48,6 +49,13 @@ public class ProjectionModel< T extends RealType< T > & NativeType< T > > ...@@ -48,6 +49,13 @@ public class ProjectionModel< T extends RealType< T > & NativeType< T > >
private final SimpleIntegerProperty numberOfChannels = new SimpleIntegerProperty(); private final SimpleIntegerProperty numberOfChannels = new SimpleIntegerProperty();
private final SimpleObjectProperty<ArrayList< ColorTable >> colors = new SimpleObjectProperty<>(); private final SimpleObjectProperty<ArrayList< ColorTable >> colors = new SimpleObjectProperty<>();
public SimpleStringProperty inputNameProperty()
{
return inputName;
}
public SimpleObjectProperty< ArrayList< ReferenceSurface< T > > > getReferenceSurfaces() public SimpleObjectProperty< ArrayList< ReferenceSurface< T > > > getReferenceSurfaces()
{ {
return referenceSurfaces; return referenceSurfaces;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment