Java Code Examples for net.imglib2.img.display.imagej.ImageJFunctions#wrapFloat()

The following examples show how to use net.imglib2.img.display.imagej.ImageJFunctions#wrapFloat() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PDFWriter.java    From Colocalisation_Analysis with GNU General Public License v3.0 5 votes vote down vote up
@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);
}
 
Example 2
Source File: PDFWriter.java    From Colocalisation_Analysis with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 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);
	
	Overlay overlay = new Overlay();
	
	/*
	 * check if we should draw a regression line for the current
	 * histogram.
	 */
	if (histogram.getDrawingSettings().contains(Histogram2D.DrawingFlags.RegressionLine)) {
		AutoThresholdRegression<T> autoThreshold = this.container.getAutoThreshold();
		if (histogram != null && autoThreshold != null) {
			drawLine(histogram, overlay, image.dimension(0), image.dimension(1),
					autoThreshold.getAutoThresholdSlope(), autoThreshold.getAutoThresholdIntercept());
			overlay.setStrokeColor(java.awt.Color.WHITE);
			imp.setOverlay(overlay);
		}
	}
	
	addImageToList(imp, name);
	// reset the imp from the log scaling we applied earlier
	imp.getProcessor().reset();
}
 
Example 3
Source File: InteractiveProjections.java    From SPIM_Registration with GNU General Public License v2.0 4 votes vote down vote up
protected ImagePlus showProjection( final Img< FloatType > img )
{
	final ImagePlus imp = ImageJFunctions.wrapFloat( img, "Max Projection" );
	imp.show();
	return imp;
}
 
Example 4
Source File: EasyDisplay.java    From Colocalisation_Analysis with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void handleImage(RandomAccessibleInterval<T> image, String name) {
	ImagePlus imp = ImageJFunctions.wrapFloat( image, name );
	double max = ImageStatistics.getImageMax( image ).getRealDouble();
	showImage( imp, max );
}
 
Example 5
Source File: EasyDisplay.java    From Colocalisation_Analysis with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void handleHistogram(Histogram2D<T> histogram, String name) {
	ImagePlus imp = ImageJFunctions.wrapFloat( histogram.getPlotImage(), name );
	double max = ImageStatistics.getImageMax( histogram.getPlotImage() ).getRealDouble();
	showImage( imp, max );
}
 
Example 6
Source File: SingleWindowDisplay.java    From Colocalisation_Analysis with GNU General Public License v3.0 4 votes vote down vote up
/**
 * 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();
}