本文整理汇总了Java中net.imglib2.img.display.imagej.ImageJFunctions.wrapFloat方法的典型用法代码示例。如果您正苦于以下问题:Java ImageJFunctions.wrapFloat方法的具体用法?Java ImageJFunctions.wrapFloat怎么用?Java ImageJFunctions.wrapFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.imglib2.img.display.imagej.ImageJFunctions
的用法示例。
在下文中一共展示了ImageJFunctions.wrapFloat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public void run(String arg0)
{
// get the current ImageJ ImagePlus
ImagePlus imp = WindowManager.getCurrentImage();
// test if an image is open, otherwise load blobs
if ( imp == null )
{
imp = new ImagePlus( getClass().getResource( "/blobs.tif" ).getFile() );
imp.show();
}
// wrap it into an ImgLib2 Img (no copying)
Img<FloatType> img = ImageJFunctions.wrapFloat( imp );
// test if it could be wrapped
if ( img == null )
{
IJ.log( "Cannot wrap image" );
return;
}
// process wrapped image with ImgLib2
process( img );
}
示例2: run
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public void run(String arg0)
{
// get the current ImageJ ImagePlus
ImagePlus imp = WindowManager.getCurrentImage();
// test if an image is open, otherwise load blobs
if ( imp == null )
{
imp = new ImagePlus( getClass().getResource( "/blobs.tif" ).getFile() );
imp.show();
}
// wrap it into an ImgLib2 Img (no copying)
Img<FloatType> img = ImageJFunctions.wrapFloat( imp );
// test if it could be wrapped
if ( img == null )
{
IJ.log( "Cannot wrap image" );
return;
}
// process wrapped image with ImgLib2
process( img );
}
示例3: run
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public void run(String arg0)
{
// get the current ImageJ ImagePlus
ImagePlus imp = WindowManager.getCurrentImage();
// test if an image is open, otherwise load blobs
if ( imp == null )
{
imp = new ImagePlus( getClass().getResource( "/blobs.tif" ).getFile() );
imp.show();
}
// wrap it into an ImgLib2 Img (no copying)
Img<FloatType> img = ImageJFunctions.wrapFloat( imp );
if ( img == null )
{
IJ.log( "Cannot wrap image" );
return;
}
// process wrapped image with ImgLib2
process( img );
}
示例4: run
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public void run(String arg0)
{
// get the current ImageJ ImagePlus
ImagePlus imp = WindowManager.getCurrentImage();
// test if an image is open, otherwise load blobs
if ( imp == null )
{
imp = new ImagePlus( getClass().getResource( "/blobs.tif" ).getFile() );
imp.show();
}
// wrap it into an ImgLib2 Img (no copying)
Img<FloatType> img = ImageJFunctions.wrapFloat( imp );
// test if it could be wrapped
if ( img == null )
{
IJ.log( "Cannot wrap image" );
return;
}
// process wrapped image with ImgLib2
process( img );
}
示例5: wrapImagePlus
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public static Img<? extends RealType<?>> wrapImagePlus( ImagePlus imp){
Img<? extends RealType<?>> img = null;
int type = imp.getType();
switch( type ){
case ImagePlus.GRAY8:
img = ImageJFunctions.wrapByte(imp);
break;
case ImagePlus.GRAY16:
img = ImageJFunctions.wrapShort(imp);
break;
case ImagePlus.GRAY32:
img = ImageJFunctions.wrapFloat(imp);
break;
case ImagePlus.COLOR_256:
IJ.error("image type ("+type+") not handled. "+imp.toString() );
//img = ImageJFunctions.wrapRGBA(imp);
break;
case ImagePlus.COLOR_RGB:
IJ.error("image type ("+type+") not handled. "+imp.toString() );
//img = ImageJFunctions.wrapRGBA(imp);
break;
default:
IJ.error("image type ("+type+") not handled. "+imp.toString() );
break;
}
return img;
}
示例6: run
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public void run(String arg0)
{
// get the current ImageJ ImagePlus
ImagePlus imp = WindowManager.getCurrentImage();
// test if an image is open, otherwise load blobs
if ( imp == null )
{
imp = new ImagePlus( getClass().getResource( "/blobs.tif" ).getFile() );
imp.show();
}
// wrap it into an ImgLib2 Img (no copying)
Img<FloatType> img = ImageJFunctions.wrapFloat( imp );
// test if it could be wrapped
if ( img == null )
{
IJ.log( "Cannot wrap image" );
return;
}
// process wrapped image with ImgLib2
process( img );
// re-draw the ImgPlus instance
// works because we actually changed the img itself
imp.updateAndDraw();
}
示例7: run
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public void run(String arg0)
{
// get the current ImageJ ImagePlus
ImagePlus imp = WindowManager.getCurrentImage();
// test if an image is open, otherwise load blobs
if ( imp == null )
{
imp = new ImagePlus( getClass().getResource( "/blobs.tif" ).getFile() );
imp.show();
}
// wrap it into an ImgLib2 Img (no copying)
Img<FloatType> img = ImageJFunctions.wrapFloat( imp );
if ( img == null )
{
IJ.log( "Cannot wrap image" );
return;
}
// process part of the image with ImgLib2
long[] min = new long[ img.numDimensions() ];
long[] max = new long[ img.numDimensions() ];
for ( int d = 0; d < img.numDimensions(); ++d )
{
min[ d ] = 20;
max[ d ] = img.dimension( d ) - 20;
}
process( Views.iterable( Views.interval( img, min, max ) ) );
}
示例8: run
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public void run(String arg0)
{
// get the current ImageJ ImagePlus
ImagePlus imp = WindowManager.getCurrentImage();
Img<FloatType> img;
// test if an image is open, otherwise load blobs
if ( imp == null )
{
// create the ImgOpener
ImgOpener imgOpener = new ImgOpener();
// load the image as FloatType using the ArrayImg
try
{
img = imgOpener.openImg( getClass().getResource( "/Drosophila.tif.zip" ).getFile(), new ArrayImgFactory<FloatType>(), new FloatType() );
}
catch (ImgIOException e)
{
e.printStackTrace();
return;
}
// display the image
ImageJFunctions.show( img );
}
else
{
// wrap it into an ImgLib2 Img (no copying)
img = ImageJFunctions.wrapFloat( imp );
}
// process wrapped image with ImgLib2
process( img );
}
示例9: run
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public void run(String arg0)
{
// get the current ImageJ ImagePlus
ImagePlus imp = WindowManager.getCurrentImage();
// test if an image is open, otherwise load blobs
if ( imp == null )
{
imp = new ImagePlus( getClass().getResource( "/blobs.tif" ).getFile() );
imp.show();
}
// wrap it into an ImgLib2 Img (no copying)
Img<FloatType> img = ImageJFunctions.wrapFloat( imp );
if ( img == null )
{
IJ.log( "Cannot wrap image" );
return;
}
// process part of the image with ImgLib2
long[] min = new long[ img.numDimensions() ];
long[] max = new long[ img.numDimensions() ];
for ( int d = 0; d < img.numDimensions(); ++d )
{
min[ d ] = 20;
max[ d ] = img.dimension( d ) - 20;
}
process( Views.interval( img, min, max ) );
}
示例10: handleImage
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
@Override
public void handleImage(RandomAccessibleInterval<T> image, String name) {
ImagePlus imp = ImageJFunctions.wrapFloat( image, name );
// set the display range
double max = ImageStatistics.getImageMax(image).getRealDouble();
imp.setDisplayRange(0.0, max);
addImageToList(imp, name);
}
示例11: handleHistogram
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
/**
* Handles a histogram the following way: create snapshot, log data, reset the
* display range, apply the Fire LUT and finally store it as an iText PDF image.
* Afterwards the image is reset to its orignal state again
*/
@Override
public void handleHistogram(Histogram2D<T> histogram, String name) {
RandomAccessibleInterval<LongType> image = histogram.getPlotImage();
ImagePlus imp = ImageJFunctions.wrapFloat( image, name );
// make a snapshot to be able to reset after modifications
imp.getProcessor().snapshot();
imp.getProcessor().log();
imp.updateAndDraw();
imp.getProcessor().resetMinAndMax();
IJ.run(imp,"Fire", null);
addImageToList(imp, name);
// reset the imp from the log scaling we applied earlier
imp.getProcessor().reset();
}
示例12: preview
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
@Override
public void preview(){
// check which parameter changed and update necessary value
if( initInterupted ){
return;
}
if( !wasStateChanged() ){
return;
}
else{
needUpdate=true;
}
if( !readyToFire){
if( needUpdate ){ // wait 200 millisecond and try to preview again
try {
TimeUnit.MILLISECONDS.sleep(200);
} catch (InterruptedException e) {
e.printStackTrace();
}
preview();
}
return;
}
readyToFire = false;
// update labelMap slice to visualize
if( changed.get("hMin") || changed.get("thresh") || changed.get("pos") || changed.get("peakFlooding") || changed.get("allowSplitting") || changed.get("displayOrient"))
{
Img<IntType> img_currentSegmentation = segmentTreeLabeler.getLabelMap( getHMin(), getThresh(), peakFlooding, allowSplitting, displayOrient, pos[displayOrient]-1);
RandomAccessibleInterval<IntType> rai_currentSegmentation = Views.dropSingletonDimensions(img_currentSegmentation);
imp_curSeg = ImageJFunctions.wrapFloat(rai_currentSegmentation, "treeCut");
segDispRange[0] = 0;
segDispRange[1] = segmentTreeLabeler.getNLabels();
}
render();
readyToFire = true;
needUpdate = false;
}
示例13: run
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public void run(String arg0)
{
// get the current ImageJ ImagePlus
ImagePlus imp = WindowManager.getCurrentImage();
Img<FloatType> img;
// test if an image is open, otherwise load blobs
if ( imp == null )
{
// create the ImgOpener
ImgOpener imgOpener = new ImgOpener();
// load the image as FloatType using the ArrayImg
try
{
img = imgOpener.openImg( getClass().getResource( "/blobs.tif" ).getFile(), new ArrayImgFactory<FloatType>(), new FloatType() );
}
catch (ImgIOException e)
{
e.printStackTrace();
return;
}
// display the image
ImageJFunctions.show( img );
}
else
{
// wrap it into an ImgLib2 Img (no copying)
img = ImageJFunctions.wrapFloat( imp );
}
// test if it could be wrapped
if ( img == null )
{
IJ.log( "Cannot wrap image" );
return;
}
// process wrapped image with ImgLib2
process( img );
}
示例14: drawImage
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
/**
* Draws the passed ImageResult on the ImagePlus of this class. If the image
* is part of a CompositeImageResult then contained lines will also be drawn
*/
protected void drawImage(RandomAccessibleInterval<? extends RealType<?>> img) {
// get ImgLib image as ImageJ image
imp = ImageJFunctions.wrapFloat((RandomAccessibleInterval<T>) img, "TODO");
imagePanel.updateImage(imp);
// set the display range
// check if a LUT should be applied
if (listOfLUTs.containsKey(img)) {
// select linked look up table
IJ.run(imp, listOfLUTs.get(img), null);
}
imp.getProcessor().resetMinAndMax();
boolean overlayModified = false;
Overlay overlay = new Overlay();
// if it is the 2d histogram, we want to show the regression line
if (isHistogram(img)) {
Histogram2D<T> histogram = mapOf2DHistograms.get(img);
/*
* check if we should draw a regression line for the current
* histogram.
*/
if (histogram.getDrawingSettings().contains(Histogram2D.DrawingFlags.RegressionLine)) {
AutoThresholdRegression<T> autoThreshold = dataContainer.getAutoThreshold();
if (histogram != null && autoThreshold != null) {
if (img == histogram.getPlotImage()) {
drawLine(overlay, img, autoThreshold.getAutoThresholdSlope(),
autoThreshold.getAutoThresholdIntercept());
overlayModified = true;
}
}
}
}
if (overlayModified) {
overlay.setStrokeColor(java.awt.Color.WHITE);
imp.setOverlay(overlay);
}
imagePanel.repaint();
}
示例15: wrapDouble
import net.imglib2.img.display.imagej.ImageJFunctions; //导入方法依赖的package包/类
public static RandomAccessibleInterval< DoubleType > wrapDouble( final ImagePlus input )
{
return new ConvertedRandomAccessibleInterval< FloatType, DoubleType >( ImageJFunctions.wrapFloat( input ), new RealDoubleConverter< FloatType >(), new DoubleType() );
}