Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 10-multi-channel-image-handling
  • 25-multithreads-heavy-tasks
  • 9-gui-features
  • dev
  • dev-batch-mode
  • dev-display
  • master
  • median-3d
  • Cnam
  • zellige-core-1.0.0
  • zellige-core-1.1.0
  • zellige-core-1.1.1
  • zellige-core-1.1.3
13 results

Target

Select target project
  • ida-public/zellige-core
1 result
Select Git revision
  • 10-multi-channel-image-handling
  • 25-multithreads-heavy-tasks
  • 9-gui-features
  • dev
  • dev-batch-mode
  • dev-display
  • master
  • median-3d
  • Cnam
  • zellige-core-1.0.0
  • zellige-core-1.1.0
  • zellige-core-1.1.1
  • zellige-core-1.1.3
13 results
Show changes
Showing
with 368 additions and 851 deletions
......@@ -33,18 +33,26 @@ import net.imglib2.type.numeric.RealType;
public class MainModel< T extends RealType< T > & NativeType< T > >
{
private final PreprocessingModel< T > preprocessingModel;
private final SelectionModel selectionModel;
private final ConstructionModel< T > constructionModel;
private final ProjectionModel< T > projectionModel;
public MainModel( SelectionModel selectionModel, ConstructionModel< T > constructionModel, ProjectionModel< T > projectionModel )
public MainModel( PreprocessingModel< T > preprocessingModel, SelectionModel selectionModel, ConstructionModel< T > constructionModel, ProjectionModel< T > projectionModel )
{
this.preprocessingModel = preprocessingModel;
this.selectionModel = selectionModel;
this.constructionModel = constructionModel;
this.projectionModel = projectionModel;
}
public PreprocessingModel< T > getPreprocessingModel()
{
return preprocessingModel;
}
public SelectionModel getSelectionModel()
{
return selectionModel;
......
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 net.imglib2.RandomAccessibleInterval;
import net.imglib2.display.ColorTable;
import net.imglib2.img.Img;
import net.imglib2.img.ImgFactory;
import net.imglib2.type.NativeType;
import net.imglib2.type.numeric.RealType;
import net.imglib2.type.numeric.real.FloatType;
import java.util.ArrayList;
public class PreprocessingModel< T extends RealType< T > & NativeType< T > >
{
private final IntegerProperty bin = new SimpleIntegerProperty();
private final IntegerProperty channel = new SimpleIntegerProperty();
private final IntegerProperty nbOfChannels = new SimpleIntegerProperty();
private final SimpleObjectProperty< RandomAccessibleInterval<T> > input = new SimpleObjectProperty<>();
private final SimpleObjectProperty< RandomAccessibleInterval<T> > input_channel = new SimpleObjectProperty<>();
private final SimpleObjectProperty< ImgFactory< T > > factory = new SimpleObjectProperty<>();
private final SimpleObjectProperty< Img< FloatType > > pretreatedImg = new SimpleObjectProperty<>();
private final SimpleBooleanProperty parameterChanged = new SimpleBooleanProperty(false);
private final SimpleObjectProperty< ArrayList< ColorTable > > colors = new SimpleObjectProperty<>(new ArrayList<>());
public IntegerProperty binProperty()
{
return bin;
}
public SimpleObjectProperty< Img< FloatType > > pretreatedImgProperty()
{
return pretreatedImg;
}
public IntegerProperty getChannel()
{
return channel;
}
public SimpleBooleanProperty getParameterChanged()
{
return parameterChanged;
}
public SimpleObjectProperty< ImgFactory< T > > getFactory()
{
return factory;
}
public SimpleObjectProperty< RandomAccessibleInterval< T > > getInput()
{
return input;
}
public IntegerProperty getNbOfChannels()
{
return nbOfChannels;
}
public SimpleObjectProperty< ArrayList<ColorTable > > getColors()
{
return colors;
}
public SimpleObjectProperty< RandomAccessibleInterval< T > > getInput_channel()
{
return input_channel;
}
}
......@@ -28,311 +28,48 @@
*/
package fr.pasteur.ida.zellige.gui.model;
import fr.pasteur.ida.zellige.element.Projection;
import fr.pasteur.ida.zellige.element.ReferenceSurface;
import fr.pasteur.ida.zellige.steps.projection.ReferenceSurfaceProjection;
import fr.pasteur.ida.zellige.gui.ProjectionProperties;
import javafx.beans.property.*;
import net.imglib2.img.Img;
import net.imglib2.img.display.imagej.ImageJFunctions;
import javafx.scene.image.ImageView;
import net.imglib2.display.ColorTable;
import net.imglib2.type.NativeType;
import net.imglib2.type.numeric.RealType;
import net.imglib2.type.numeric.integer.UnsignedShortType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
public class ProjectionModel< T extends RealType< T > & NativeType< T > >
{
private final static Logger LOGGER = LoggerFactory.getLogger( ProjectionModel.class );
private final SimpleObjectProperty< ArrayList< ReferenceSurface< T > > > referenceSurfaces;
private final SimpleBooleanProperty delta1Functions;
private final SimpleBooleanProperty delta2Functions;
private final IntegerProperty delta1;
private final IntegerProperty delta2;
private final StringProperty method;
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<>();
private final SimpleIntegerProperty numberOfChannels = new SimpleIntegerProperty();
private final BooleanProperty rawHM;
private final BooleanProperty projection;
private final BooleanProperty extractedHM;
private final BooleanProperty reduced3Dspace;
private final BooleanProperty segmentedSurface;
private final BooleanProperty segmentedSurfaceMask;
private final BooleanProperty rawHMDisplay;
private final BooleanProperty projectionDisplay;
private final BooleanProperty extractedHMDisplay;
private final BooleanProperty reduced3DspaceDisplay;
private final BooleanProperty segmentedSurfaceDisplay;
private final BooleanProperty segmentedSurfaceMaskDisplay;
public ProjectionModel()
{
this.referenceSurfaces = new SimpleObjectProperty<>();
this.delta1Functions = new SimpleBooleanProperty( false );
this.delta2Functions = new SimpleBooleanProperty( false );
this.method = new SimpleStringProperty();
this.delta1 = new SimpleIntegerProperty();
this.delta2 = new SimpleIntegerProperty();
this.rawHM = new SimpleBooleanProperty();
this.projection = new SimpleBooleanProperty();
this.extractedHM = new SimpleBooleanProperty();
this.reduced3Dspace = new SimpleBooleanProperty();
this.segmentedSurface = new SimpleBooleanProperty();
this.segmentedSurfaceMask = new SimpleBooleanProperty();
this.rawHMDisplay = new SimpleBooleanProperty( true );
this.projectionDisplay = new SimpleBooleanProperty( true );
this.extractedHMDisplay = new SimpleBooleanProperty( true );
this.reduced3DspaceDisplay = new SimpleBooleanProperty( true );
this.segmentedSurfaceDisplay = new SimpleBooleanProperty( true );
this.segmentedSurfaceMaskDisplay = new SimpleBooleanProperty( true );
}
public void showSegmentedSurfaceMask()
{
for ( ReferenceSurface< T > referenceSurface : referenceSurfaces.getValue() )
{
ImageJFunctions.show( referenceSurface.getProjection().getSegmentedSurfaceMask(), "Surface_mask_" + referenceSurface.getIndex() );
}
}
public void showSegmentedSurface()
{
for ( ReferenceSurface< T > referenceSurface : referenceSurfaces.getValue() )
{
ImageJFunctions.show( referenceSurface.getProjection().getSegmentedSurface(), "Segmented_surface_" + referenceSurface.getIndex() );
}
}
public void showReduced3DSpace()
{
for ( ReferenceSurface< T > referenceSurface : referenceSurfaces.getValue() )
{
ImageJFunctions.show( referenceSurface.getProjection().getReduced3DSpace(), "Reduced_3D_space_" + referenceSurface.getIndex() );
}
}
public void showExtractedHeightMaps()
{
for ( ReferenceSurface< T > referenceSurface : referenceSurfaces.getValue() )
{
ImageJFunctions.show( referenceSurface.getProjection().getExtractedHeightMap(), "Extracted_HM_" + referenceSurface.getIndex() );
}
}
public void showRawHeightMap()
{
for ( ReferenceSurface< T > referenceSurface : referenceSurfaces.getValue() )
{
ImageJFunctions.show( referenceSurface.getzMap(), "Raw_HM_" + referenceSurface.getIndex() );
}
}
public void showProjections()
{
for ( ReferenceSurface< T > referenceSurface : referenceSurfaces.getValue() )
{
ImageJFunctions.show( referenceSurface.getProjection().get(), "Projection_" + referenceSurface.getIndex() );
}
}
public void runProjection()
{
LOGGER.debug( "Starting projections ! " );
if ( ! delta1Functions.getValue() )
{
LOGGER.debug( "Output with delta1 " );
setOutputDelta1();
}
if ( ! delta2Functions.getValue() )
{
LOGGER.debug( "Output with delta2 " );
setOutputDelta2();
}
showOutput();
}
public void showOutput()
{
if ( rawHM.get() && rawHMDisplay.getValue() )
{
showRawHeightMap();
rawHMDisplay.setValue( false );
}
if ( projection.get() && projectionDisplay.get() )
{
showProjections();
projectionDisplay.setValue( false );
}
if ( extractedHM.get() && extractedHMDisplay.get() )
{
showExtractedHeightMaps();
extractedHMDisplay.setValue( false );
}
if ( segmentedSurface.get() && segmentedSurfaceDisplay.get() )
{
showSegmentedSurface();
segmentedSurface.setValue( false );
}
if ( reduced3Dspace.get() && reduced3DspaceDisplay.get() )
{
showReduced3DSpace();
reduced3DspaceDisplay.setValue( false );
}
if ( segmentedSurfaceMask.get() && segmentedSurfaceMaskDisplay.get() )
{
showSegmentedSurfaceMask();
segmentedSurfaceMask.setValue( false );
}
}
public void setOutputDelta1()
{
for ( ReferenceSurface< T > referenceSurface : referenceSurfaces.getValue() )
{
Projection< T > projection = referenceSurface.getProjection();
Img< UnsignedShortType > extractedHeightMap = ReferenceSurfaceProjection.getProjectionHeightMap( referenceSurface, method.get(), delta1.intValue() );
projection.setExtractedHeightMap( extractedHeightMap );
projection.setProjection( ReferenceSurfaceProjection.projection1( referenceSurface, this.method.get() ) );
projection.setSegmentedSurface( ReferenceSurfaceProjection.getSegmentedSurface( extractedHeightMap, referenceSurface.getInput(), referenceSurface.getFactory() ) );
projection.setReduced3DSpace( ReferenceSurfaceProjection.getExtractedHeightMapSubStack( referenceSurface, delta1.intValue() ) );
}
delta1Functions.setValue( true );
}
public void setOutputDelta2()
{
for ( ReferenceSurface< T > referenceSurface : referenceSurfaces.getValue() )
{
Projection< T > projection = referenceSurface.getProjection();
projection.setSegmentedSurfaceMask( ReferenceSurfaceProjection.getSegmentedSurfaceMask( projection.getSegmentedSurface(), delta2.intValue() ) );
}
delta2Functions.setValue( true );
}
public ArrayList< ReferenceSurface< T > > getReferenceSurfaces()
{
return referenceSurfaces.get();
}
public SimpleObjectProperty< ArrayList< ReferenceSurface< T > > > referenceSurfacesProperty()
private final SimpleObjectProperty<ArrayList< ColorTable >> colors = new SimpleObjectProperty<>();
public SimpleObjectProperty< ArrayList< ReferenceSurface< T > > > getReferenceSurfaces()
{
return referenceSurfaces;
}
public SimpleBooleanProperty delta1FunctionsProperty()
{
return delta1Functions;
}
public SimpleBooleanProperty delta2FunctionsProperty()
{
return delta2Functions;
}
public IntegerProperty delta1Property()
{
return delta1;
}
public IntegerProperty delta2Property()
{
return delta2;
}
public BooleanProperty rawHMProperty()
{
return rawHM;
}
public boolean isProjection()
{
return projection.get();
}
public BooleanProperty projectionProperty()
public SimpleObjectProperty< ImageView[] > getImageViews()
{
return projection;
return imageViews;
}
public BooleanProperty extractedHMProperty()
{
return extractedHM;
}
public BooleanProperty reduced3DspaceProperty()
{
return reduced3Dspace;
}
public BooleanProperty segmentedSurfaceProperty()
{
return segmentedSurface;
}
public BooleanProperty segmentedSurfaceMaskProperty()
{
return segmentedSurfaceMask;
}
public String getMethod()
{
return method.get();
}
public void setMethod( String method )
{
this.method.set( method );
}
public StringProperty methodProperty()
{
return method;
}
public BooleanProperty rawHMDisplayProperty()
{
return rawHMDisplay;
}
public BooleanProperty projectionDisplayProperty()
{
return projectionDisplay;
}
public BooleanProperty extractedHMDisplayProperty()
{
return extractedHMDisplay;
}
public BooleanProperty reduced3DspaceDisplayProperty()
public SimpleIntegerProperty getNumberOfChannels()
{
return reduced3DspaceDisplay;
return numberOfChannels;
}
public BooleanProperty segmentedSurfaceDisplayProperty()
public SimpleObjectProperty< ArrayList< ProjectionProperties< T > > > getProjectionProperties()
{
return segmentedSurfaceDisplay;
return projectionProperties;
}
public BooleanProperty segmentedSurfaceMaskDisplayProperty()
public SimpleObjectProperty< ArrayList< ColorTable > > getColors()
{
return segmentedSurfaceMaskDisplay;
return colors;
}
}
/*-
* #%L
* Zellige
* %%
* Copyright (C) 2020 - 2023 Institut Pasteur
* %%
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* #L%
*/
package fr.pasteur.ida.zellige.gui.parameter;
import fr.pasteur.ida.zellige.gui.ZDoubleProperty;
import javafx.beans.property.IntegerProperty;
public class ConstructionParameter
{
private final double c1;
private final int r1;
private final double st1;
private final double c2;
private final int r2;
private final double st2;
private final int surfaceSize;
public ConstructionParameter( ZDoubleProperty c1, IntegerProperty r1, ZDoubleProperty st1, ZDoubleProperty c2, IntegerProperty r2, ZDoubleProperty st2, ZDoubleProperty surfaceSize )
{
this.c1 = c1.value();
this.r1 = r1.intValue();
this.st1 = st1.value();
this.c2 = c2.value();
this.r2 = r2.intValue();
this.st2 = st2.value();
this.surfaceSize = surfaceSize.intValue();
}
public double getC1()
{
return c1;
}
public int getR1()
{
return r1;
}
public double getSt1()
{
return st1;
}
public double getC2()
{
return c2;
}
public int getR2()
{
return r2;
}
public double getSt2()
{
return st2;
}
public int getSurfaceSize()
{
return surfaceSize;
}
}
package fr.pasteur.ida.zellige.gui.task;
import fr.pasteur.ida.zellige.steps.selection.util.Binning;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.img.Img;
import net.imglib2.type.NativeType;
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 );
private final int bin;
private final RandomAccessibleInterval<T> input;
public BinningTask( int bin, RandomAccessibleInterval< T > input )
{
this.bin = bin;
this.input = input;
}
@Override
protected Img<T> call() {
LOGGER.info( GUI_MARKER,"Binning" );
Img<T> binnedImage = Binning.run( input, bin );
LOGGER.info( GUI_MARKER,"Image binned !" );
return binnedImage;
}
}