public void setFromFloatProcessors(FloatProcessor[] fp) { ImageProcessor ip2 = fp[0].convertToByte(false); setPixels(ip2.getPixels()); }
public void setFromFloatProcessors(FloatProcessor[] fp) { ImageProcessor ip2 = fp[0].convertToByte(false); setPixels(ip2.getPixels()); }
public void setFromFloatArrays(float[][] arrays) { ImageProcessor ip2 = new FloatProcessor(roiWidth, roiHeight, arrays[0], null); ip2 = ip2.convertToByte(false); setPixels(ip2.getPixels()); //insert(ip2, roiX, roiY); }
public void setFromFloatArrays(float[][] arrays) { ImageProcessor ip2 = new FloatProcessor(roiWidth, roiHeight, arrays[0], null); ip2 = ip2.convertToByte(false); setPixels(ip2.getPixels()); //insert(ip2, roiX, roiY); }
cp.setPixels(outputBytes); cp.resetMinAndMax(); if (cp.getMax() > max[key.getChannelNumber() - 1]) {
/** Copies the image contained in 'ip' to (xloc, yloc) using one of the transfer modes defined in the Blitter interface. */ public void copyBits(ImageProcessor ip, int xloc, int yloc, int mode) { boolean temporaryFloat = ip.getBitDepth()==32 && (mode==Blitter.MULTIPLY || mode==Blitter.DIVIDE); if (temporaryFloat) { FloatProcessor ipFloat = this.convertToFloatProcessor(); new FloatBlitter(ipFloat).copyBits(ip, xloc, yloc, mode); setPixels(1, ipFloat); } else { ip = ip.convertToByte(true); new ByteBlitter(this).copyBits(ip, xloc, yloc, mode); } }
/** Copies the image contained in 'ip' to (xloc, yloc) using one of the transfer modes defined in the Blitter interface. */ public void copyBits(ImageProcessor ip, int xloc, int yloc, int mode) { boolean temporaryFloat = ip.getBitDepth()==32 && (mode==Blitter.MULTIPLY || mode==Blitter.DIVIDE); if (temporaryFloat) { FloatProcessor ipFloat = this.convertToFloatProcessor(); new FloatBlitter(ipFloat).copyBits(ip, xloc, yloc, mode); setPixels(1, ipFloat); } else { ip = ip.convertToByte(true); new ByteBlitter(this).copyBits(ip, xloc, yloc, mode); } }
pixels[4] = (byte) 255; final ByteProcessor bp = new ByteProcessor(3, 3); bp.setPixels(pixels); stack.addSlice("", bp);
synchronized public ImagePlus makePathVolume(final ArrayList<Path> paths) { final byte[][] snapshot_data = new byte[depth][]; for (int i = 0; i < depth; ++i) snapshot_data[i] = new byte[width * height]; pathAndFillManager.setPathPointsInVolume(paths, snapshot_data, width, height, depth); final ImageStack newStack = new ImageStack(width, height); for (int i = 0; i < depth; ++i) { final ByteProcessor thisSlice = new ByteProcessor(width, height); thisSlice.setPixels(snapshot_data[i]); newStack.addSlice(null, thisSlice); } final ImagePlus newImp = new ImagePlus(xy.getShortTitle() + " Rendered Paths", newStack); newImp.setCalibration(xy.getCalibration()); return newImp; }
@Override public void run(final String ignored) { OpenDialog od; od = new OpenDialog("Select traces.obj file...", null, null); final String fileName = od.getFileName(); final String directory = od.getDirectory(); if (fileName == null) return; System.out.println("Got " + fileName); final boolean success = SinglePathsGraph.loadWithListener(directory + fileName, this); if (!success) { IJ.error("Loading " + directory + fileName); return; } final ImageStack stack = new ImageStack(width, height); for (int z = 0; z < depth; ++z) { final ByteProcessor bp = new ByteProcessor(width, height); bp.setPixels(values[z]); stack.addSlice("", bp); } final ImagePlus imagePlus = new ImagePlus(fileName, stack); imagePlus.show(); }
@Override public void run(final String ignore) { final ImageStack stack = new ImageStack(3, 3); for (int i = 0; i < 3; ++i) { final byte[] pixels = new byte[9]; if (i == 1) pixels[4] = (byte) 255; final ByteProcessor bp = new ByteProcessor(3, 3); bp.setPixels(pixels); stack.addSlice("", bp); } final ImagePlus i = new ImagePlus("test", stack); i.show(); final Image3DUniverse univ = new Image3DUniverse(512, 512); univ.show(); GUI.center(univ.getWindow()); final boolean[] channels = { true, true, true }; final Content c = univ.addContent(i, new Color3f(Color.white), "Volume Rendering of a Single Voxel at (1,1,1)", 10, // threshold channels, 1, // resampling factor ContentConstants.VOLUME); final List<Point3f> linePoints = new ArrayList<Point3f>(); linePoints.add(new Point3f(1, 1, 1)); linePoints.add(new Point3f(2, 2, 2)); univ.addLineMesh(linePoints, new Color3f(Color.red), "Line from (1,1,1) to (2,2,2)", false); univ.resetView(); } }
/** Converts a FloatProcessor to a ByteProcessor. */ ByteProcessor convertFloatToByte() { if (doScaling) { byte[] pixels8 = ip.create8BitImage(); ByteProcessor bp = new ByteProcessor(ip.getWidth(), ip.getHeight(), pixels8); bp.setColorModel(ip.getColorModel()); return bp; } else { ByteProcessor bp = new ByteProcessor(width, height); bp.setPixels(0, (FloatProcessor)ip); bp.setColorModel(ip.getColorModel()); bp.resetMinAndMax(); //don't take min&max from ip return bp; } }
/** Converts a FloatProcessor to a ByteProcessor. */ ByteProcessor convertFloatToByte() { if (doScaling) { byte[] pixels8 = ip.create8BitImage(); ByteProcessor bp = new ByteProcessor(ip.getWidth(), ip.getHeight(), pixels8); bp.setColorModel(ip.getColorModel()); return bp; } else { ByteProcessor bp = new ByteProcessor(width, height); bp.setPixels(0, (FloatProcessor)ip); bp.setColorModel(ip.getColorModel()); bp.resetMinAndMax(); //don't take min&max from ip return bp; } }
public ImagePlus getAverageImage( boolean rescale ) { IJ.showStatus("Creating averaged image..."); IJ.showProgress(0.0); ImageStack newStack = new ImageStack(width,height); for( int z = 0; z < depth; ++z ) { ByteProcessor bp = new ByteProcessor(width,height); byte [] slice = new byte[width*height]; for( int y = 0; y < height; ++y ) for( int x = 0; x < width; ++x ) { int averageValue; float value = cumulativeImage[z][y*width+x]; if( rescale ) averageValue = (int)((255*value)/(maxValue*numberOfImages)); else averageValue = (int)(value/numberOfImages); if( averageValue < 0 ) averageValue = 0; if( averageValue > 255 ) averageValue = 255; slice[y*width+x] = (byte)averageValue; } IJ.showProgress((z + 1.0) / depth); bp.setPixels(slice); newStack.addSlice(null, bp); } IJ.showProgress(1); return new ImagePlus("average of "+numberOfImages+" images",newStack); }
bp.setPixels(luminancePixels[z]); luminanceStack.addSlice("", bp); IJ.showProgress( z / (float)depth );
for( int z = 0; z < templateDepth; ++z ) { ByteProcessor bp = new ByteProcessor( templateWidth, templateHeight ); bp.setPixels( transformedData[z] ); newStack.addSlice( "", bp ); for( int z = 0; z < modelDepth; ++z ) { ByteProcessor bp = new ByteProcessor( modelWidth, modelHeight ); bp.setPixels( foundMappingData[z] ); debugStack.addSlice( "", bp );
bp.setPixels( pixels ); newStack.addSlice( "", bp );
case ImagePlus.COLOR_256: final ByteProcessor bp = new ByteProcessor(width, height); bp.setPixels(new_slice_data_b[z]); stack.addSlice(null, bp); break;
} else { ByteProcessor bp=new ByteProcessor(width,height); bp.setPixels(newPixelsByte); newStack.addSlice("",bp);
for( int z = 0; z < templateDepth; ++z ) { ByteProcessor bp = new ByteProcessor( templateWidth, templateHeight ); bp.setPixels( imageBytes[z] ); newStack.addSlice( "", bp );