diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/controller/MainController.java b/src/main/java/fr/pasteur/ida/zellige/gui/controller/MainController.java index 0edc9cff70cc75ed1a90139eb5eed5e4b53be4c4..29572a056008413c25b5307f3ea4328a83403cea 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/controller/MainController.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/controller/MainController.java @@ -122,6 +122,7 @@ public class MainController< T extends RealType< T > & NativeType< T > > impleme constructionController.getModel().getInput().bind( preprocessingController.getModel().getInput() ); constructionController.getModel().getFactory().bind( preprocessingController.getModel().getFactory() ); 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. tabPane.getTabs().get( 2 ).selectedProperty().addListener( ( observableValue, number, newValue ) -> diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/controller/PreprocessingController.java b/src/main/java/fr/pasteur/ida/zellige/gui/controller/PreprocessingController.java index 115c5489b6ce4c3231a900a5f4b404108d260394..dda67619bb92031ad826b3d3117dccb53c370ac7 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/controller/PreprocessingController.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/controller/PreprocessingController.java @@ -119,6 +119,7 @@ public class PreprocessingController< T extends RealType< T > & NativeType< T > { getModel().getInput().set( ( RandomAccessibleInterval< T > ) newValue.getImgPlus() ); } + getModel().inputNameProperty().set( FilenameUtils.removeExtension( newValue.getName() )); // Set the input factory getModel().getFactory().setValue( ( ImgFactory< T > ) newValue.getImgPlus().factory() ); diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/interactor/ProjectionInteractor.java b/src/main/java/fr/pasteur/ida/zellige/gui/interactor/ProjectionInteractor.java index da9929bce1a952c6234b54ebd1fd6b40ce369e9f..084878978a224864cd7cfd2a7d02eb69d90222a0 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/interactor/ProjectionInteractor.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/interactor/ProjectionInteractor.java @@ -40,7 +40,9 @@ public class ProjectionInteractor< T extends RealType< T > & NativeType< T > > { LOGGER.debug( "The projection has succeed!" ); // 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", "" ); net.imagej.ImageJ ij = new net.imagej.ImageJ( context ); ij.ui().show( imgPlus ); diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/model/PreprocessingModel.java b/src/main/java/fr/pasteur/ida/zellige/gui/model/PreprocessingModel.java index 8c5f28c1d2f0df7cb85ef4c2c8c7d5f59451955b..41e406e986cc67122c8c64780458bd21113bfc11 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/model/PreprocessingModel.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/model/PreprocessingModel.java @@ -1,9 +1,6 @@ package fr.pasteur.ida.zellige.gui.model; -import javafx.beans.property.IntegerProperty; -import javafx.beans.property.SimpleBooleanProperty; -import javafx.beans.property.SimpleIntegerProperty; -import javafx.beans.property.SimpleObjectProperty; +import javafx.beans.property.*; import net.imglib2.RandomAccessibleInterval; import net.imglib2.display.ColorTable; import net.imglib2.img.Img; @@ -17,6 +14,8 @@ import java.util.ArrayList; public class PreprocessingModel< T extends RealType< T > & NativeType< T > > { + private final StringProperty inputName = new SimpleStringProperty(); + private final IntegerProperty bin = new SimpleIntegerProperty(); private final IntegerProperty channel = new SimpleIntegerProperty(); @@ -35,6 +34,13 @@ public class PreprocessingModel< T extends RealType< T > & NativeType< T > > private final SimpleObjectProperty< ArrayList< ColorTable > > colors = new SimpleObjectProperty<>(new ArrayList<>()); + + + public StringProperty inputNameProperty() + { + return inputName; + } + public IntegerProperty binProperty() { return bin; diff --git a/src/main/java/fr/pasteur/ida/zellige/gui/model/ProjectionModel.java b/src/main/java/fr/pasteur/ida/zellige/gui/model/ProjectionModel.java index b22dd857b60a34317c89e65c59431c6a65dd0656..9d0efef0c5c2c78c0ee90ead569d17172834e8a4 100644 --- a/src/main/java/fr/pasteur/ida/zellige/gui/model/ProjectionModel.java +++ b/src/main/java/fr/pasteur/ida/zellige/gui/model/ProjectionModel.java @@ -41,6 +41,7 @@ import java.util.ArrayList; 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< ProjectionProperties< T > > > projectionProperties = new SimpleObjectProperty<>( new ArrayList<>() ); private final SimpleObjectProperty< ImageView[] > imageViews = new SimpleObjectProperty<>(); @@ -48,6 +49,13 @@ public class ProjectionModel< T extends RealType< T > & NativeType< T > > private final SimpleIntegerProperty numberOfChannels = new SimpleIntegerProperty(); private final SimpleObjectProperty<ArrayList< ColorTable >> colors = new SimpleObjectProperty<>(); + + + public SimpleStringProperty inputNameProperty() + { + return inputName; + } + public SimpleObjectProperty< ArrayList< ReferenceSurface< T > > > getReferenceSurfaces() { return referenceSurfaces;