|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectij.ImagePlus
ij.plugin.PGM_Reader
public class PGM_Reader
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, GRAY16, GRAY32, GRAY8, img, ip, locked, nChannels, nFrames, nSlices, OPENED, roi, 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, AREA, AREA_FRACTION, CENTER_OF_MASS, CENTROID, CIRCULARITY, ELLIPSE, FERET, INTEGRATED_DENSITY, INVERT_Y, KURTOSIS, LABELS, LIMIT, MAX_STANDARDS, MEAN, MEDIAN, MIN_MAX, MODE, PERIMETER, RECT, SCIENTIFIC_NOTATION, SHAPE_DESCRIPTORS, SKEWNESS, SLICE, STACK_POSITION, STD_DEV |
Constructor Summary | |
---|---|
PGM_Reader()
|
Method Summary | |
---|---|
ImageProcessor |
open16bitAsciiImage(StreamTokenizer tok,
int width,
int height)
|
ImageProcessor |
open16bitRawImage(InputStream is,
int width,
int height)
|
void |
openAsciiImage(StreamTokenizer tok,
int size,
byte[] pixels)
|
ImageStack |
openFile(String path)
|
void |
openHeader(StreamTokenizer tok)
|
void |
openRawImage(InputStream is,
int size,
byte[] pixels)
|
void |
run(String arg)
This method is called when the plugin is loaded. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public PGM_Reader()
Method Detail |
---|
public void run(String arg)
PlugIn
run
in interface PlugIn
public ImageStack openFile(String path) throws IOException
IOException
public void openHeader(StreamTokenizer tok) throws IOException
IOException
public void openAsciiImage(StreamTokenizer tok, int size, byte[] pixels) throws IOException
IOException
public void openRawImage(InputStream is, int size, byte[] pixels) throws IOException
IOException
public ImageProcessor open16bitRawImage(InputStream is, int width, int height) throws IOException
IOException
public ImageProcessor open16bitAsciiImage(StreamTokenizer tok, int width, int height) throws IOException
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |