Skip to content
Snippets Groups Projects

New implementation and code cleanup

Merged Céline TREBEAU requested to merge doc-codecleanup into dev
51 files
+ 1706
3368
Compare changes
  • Side-by-side
  • Inline
Files
51
package fr.pasteur.ida.zellige.command;
import ij.IJ;
import net.imagej.Dataset;
import net.imagej.ImgPlus;
import net.imagej.display.ImageDisplayService;
import net.imagej.ops.OpService;
import net.imglib2.RandomAccessibleInterval;
import net.imglib2.type.NativeType;
import net.imglib2.type.numeric.RealType;
import net.imglib2.util.Util;
import org.scijava.ItemIO;
import org.scijava.command.ContextCommand;
import org.scijava.log.LogService;
import org.scijava.plugin.Parameter;
import org.scijava.plugin.Plugin;
import java.util.ArrayList;
@Plugin ( type = ZelligeCommand.class, name = "Zellige", menuPath = "Plugins > Process > Zellige" )
public class ZelligeCommand< T extends RealType < T > & NativeType < T > > extends ContextCommand
{
@Parameter
private ImageDisplayService imageDisplayService;
@Parameter
private LogService logService;
@Parameter
protected OpService ops;
@Parameter
private int sigma;
@Parameter
private int localThreshold;
@Parameter
private int globalThreshold;
@Parameter
private int delta;
@Parameter(type = ItemIO.OUTPUT)
ArrayList < RandomAccessibleInterval < T > > surfaces;
@Override
public void run()
{
/*
* Get current dataset.
*/
Dataset dataset = imageDisplayService.getActiveDataset();
if ( null == dataset )
{
logService.error( "Please open an image before running Zellige." );
return;
}
/*
* Wrap it into an ImgLib2 'Plus' image.
*/
@SuppressWarnings( "unchecked" )
ImgPlus < T > img = ( ImgPlus< T > ) dataset.getImgPlus();
long[] dims = new long[dataset.numDimensions()];
dataset.dimensions(dims);
IJ.log( "Zellige received the image: " + img.getName() );
IJ.log( "Size: " + Util.printInterval( img ) );
IJ.log( "Type: " + img.firstElement().getClass().toGenericString() );
IJ.log( "Dimensionality: " + img.numDimensions() + "D" );
for ( int d = 0; d < img.numDimensions(); d++ )
IJ.log( " - dimension " + d + ": [" + img.axis( d ).type() + "], 1 unit = " + img.averageScale( d ) + " " + img.axis( d ).unit() );
if ( img.numDimensions() == 3 )// Is it a stack ?
{
// SurfacesExtraction <T > extraction =
// new SurfacesExtraction <>( img, localThreshold, globalThreshold, sigma, delta );
// surfaces = extraction.extract();
}
else
{
IJ.log( " This image has to be a z-stack ! " );
}
IJ.log(" Number of surfaces found : " + surfaces.size());
}
}
Loading