- java.lang.Object
-
- ij.ImagePlus
-
- ij.plugin.PGM_Reader
-
- All Implemented Interfaces:
Measurements
,PlugIn
,java.awt.image.ImageObserver
,java.lang.Cloneable
public class PGM_Reader extends ImagePlus implements PlugIn
This plugin opens PxM format images. The portable graymap format is a lowest common denominator grayscale file format. The definition is as follows: - A "magic number" for identifying the file type. A pgm file's magic number is the two characters "P2". - Whitespace (blanks, TABs, CRs, LFs). - A width, formatted as ASCII characters in decimal. - Whitespace. - A height, again in ASCII decimal. - Whitespace. - The maximum gray value, again in ASCII decimal. - Whitespace. - Width * height gray values, each in ASCII decimal, between 0 and the specified maximum value, separated by whi- tespace, starting at the top-left corner of the graymap, proceeding in normal English reading order. A value of 0 means black, and the maximum value means white. - Characters from a "#" to the next end-of-line are ignored (comments). - No line should be longer than 70 characters. Here is an example of a small graymap in this format: P2 # feep.pgm 24 7 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3 3 3 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 15 15 15 0 0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 15 0 0 3 3 3 0 0 0 7 7 7 0 0 0 11 11 11 0 0 0 15 15 15 15 0 0 3 0 0 0 0 0 7 0 0 0 0 0 11 0 0 0 0 0 15 0 0 0 0 0 3 0 0 0 0 0 7 7 7 7 0 0 11 11 11 11 0 0 15 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 There is a PGM variant that stores the pixel data as raw bytes: -The "magic number" is "P5" instead of "P2". -The gray values are stored as plain bytes, instead of ASCII decimal. -No whitespace is allowed in the grays section, and only a single character of whitespace (typically a newline) is allowed after the maxval. -The files are smaller and many times faster to read and write. Kai Barthel Nov 16 2004: Extended to support PPM (portable pixmap) format images (24 bits only). -The "magic numbers" are "P6" (raw) "P3" (ASCII). Ulf Dittmer April 2005: Extended to support PBM (bitmap) images (P1 and P4) Jarek Sacha (jarek.at.ieee.org) December 2005: Extended PPM support to 48 bit color images.
-
-
Field Summary
-
Fields inherited from class ij.ImagePlus
changes, CLOSED, COLOR_256, COLOR_RGB, compositeImage, currentSlice, dimensionsSet, flattenTitle, GRAY16, GRAY32, GRAY8, img, ip, locked, nChannels, nFrames, nSlices, OPENED, roi, SAVED, setIJMenuBar, UPDATED, win
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Fields inherited from interface ij.measure.Measurements
ADD_TO_OVERLAY, ALL_STATS, AREA, AREA_FRACTION, CENTER_OF_MASS, CENTROID, CIRCULARITY, ELLIPSE, FERET, INTEGRATED_DENSITY, INVERT_Y, KURTOSIS, LABELS, LIMIT, MAX_STANDARDS, MEAN, MEDIAN, MIN_MAX, MODE, NaN_EMPTY_CELLS, PERIMETER, RECT, SCIENTIFIC_NOTATION, SHAPE_DESCRIPTORS, SKEWNESS, SLICE, STACK_POSITION, STD_DEV
-
-
Constructor Summary
Constructors Constructor Description PGM_Reader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImageProcessor
open16bitAsciiImage(java.io.StreamTokenizer tok, int width, int height)
ImageProcessor
open16bitRawImage(java.io.InputStream is, int width, int height)
void
openAsciiImage(java.io.StreamTokenizer tok, int size, byte[] pixels)
ImageStack
openFile(java.lang.String path)
void
openHeader(java.io.StreamTokenizer tok)
void
openRawImage(java.io.InputStream is, int size, byte[] pixels)
void
run(java.lang.String arg)
This method is called when the plugin is loaded.-
Methods inherited from class ij.ImagePlus
addImageListener, clone, close, convertIndexToPosition, convertToImageProcessor, copy, copy, copyAttributes, copyScale, copyToSystem, createEmptyStack, createHyperStack, createImagePlus, createLut, createNewRoi, createRoiMask, createThresholdMask, crop, crop, crop, crop, cropAndSave, cut, deleteRoi, draw, draw, duplicate, flatten, flattenStack, flush, getAllStatistics, getBitDepth, getBufferedImage, getBytesPerPixel, getC, getCalibration, getCanvas, getChannel, getChannelProcessor, getClipboard, getCompositeMode, getCurrentSlice, getDefault16bitRange, getDimensions, getDimensions, getDisplayMode, getDisplayRangeMax, getDisplayRangeMin, getFileInfo, getFrame, getGlobalCalibration, getHeight, getHideOverlay, getID, getImage, getImageProperties, getImageStack, getImageStackSize, getInfoProperty, getListeners, getLocalCalibration, getLocationAsString, getLuts, getMask, getNChannels, getNDimensions, getNFrames, getNSlices, getNumericProp, getNumericProperty, getOpenAsHyperStack, getOriginalFileInfo, getOverlay, getPixel, getPlot, getProcessor, getProp, getProperties, getPropertiesAsArray, getProperty, getPropsInfo, getRawStatistics, getRoi, getShortTitle, getSizeInBytes, getSlice, getStack, getStackIndex, getStackSize, getStartTime, getStaticGlobalCalibration, getStatistics, getStatistics, getStatistics, getStatistics, getStringProperty, getT, getTitle, getType, getWidth, getWindow, getZ, hasImageStack, hide, imageUpdate, isComposite, isDisplayedHyperStack, isHyperStack, isInvertedLut, isLocked, isLockedByAnotherThread, isProcessor, isRGB, isStack, isThreshold, isVisible, killRoi, killStack, lock, lockSilently, logImageListeners, mouseMoved, notifyListeners, okToDeleteRoi, paste, paste, paste, plotHistogram, plotHistogram, removeImageListener, removeScale, repaintWindow, resetClipboard, resetDisplayRange, resetRoi, resetStack, resize, resize, restoreRoi, revert, saveRoi, setActivated, setActiveChannels, setAntialiasRendering, setBorderColor, setC, setCalibration, setColor, setDeactivated, setDefault16bitRange, setDefaultDisplayRange, setDimensions, setDisplayMode, setDisplayRange, setDisplayRange, setFileInfo, setGlobalCalibration, setHideOverlay, setIgnoreFlush, setIgnoreGlobalCalibration, setIJMenuBar, setIJMenuBar, setImage, setImage, setLut, setOpenAsHyperStack, setOverlay, setOverlay, setOverlay, setPlot, setPosition, setPosition, setPositionWithoutUpdate, setProcessor, setProcessor, setProp, setProp, setProperties, setProperty, setRoi, setRoi, setRoi, setRoi, setSlice, setSliceWithoutUpdate, setStack, setStack, setStack, setT, setTemporary, setTitle, setType, setTypeToColor256, setWindow, setZ, show, show, startTiming, tempOverlay, toString, trimProcessor, unlock, updateAndDraw, updateAndRepaintWindow, updateChannelAndDraw, updateImage, updatePosition, updateStatusbarValue, updateVirtualSlice, waitTillActivated, windowActivated
-
-
-
-
Method Detail
-
run
public void run(java.lang.String arg)
Description copied from interface:PlugIn
This method is called when the plugin is loaded. 'arg', which may be blank, is the argument specified for this plugin in IJ_Props.txt.
-
openFile
public ImageStack openFile(java.lang.String path) throws java.io.IOException
- Throws:
java.io.IOException
-
openHeader
public void openHeader(java.io.StreamTokenizer tok) throws java.io.IOException
- Throws:
java.io.IOException
-
openAsciiImage
public void openAsciiImage(java.io.StreamTokenizer tok, int size, byte[] pixels) throws java.io.IOException
- Throws:
java.io.IOException
-
openRawImage
public void openRawImage(java.io.InputStream is, int size, byte[] pixels) throws java.io.IOException
- Throws:
java.io.IOException
-
open16bitRawImage
public ImageProcessor open16bitRawImage(java.io.InputStream is, int width, int height) throws java.io.IOException
- Throws:
java.io.IOException
-
open16bitAsciiImage
public ImageProcessor open16bitAsciiImage(java.io.StreamTokenizer tok, int width, int height) throws java.io.IOException
- Throws:
java.io.IOException
-
-