Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
PGM_Reader Class Reference
Inheritance diagram for PGM_Reader:
ImagePlus PlugIn

Public Member Functions

void run (String path)
 
ImageProcessor openFile (String path) throws IOException
 
void openHeader (StreamTokenizer tok) throws IOException
 
void openAsciiImage (StreamTokenizer tok, int size, byte[] pixels) throws IOException
 
void openRawImage (InputStream is, int size, byte[] pixels) throws IOException
 
ImageProcessor open16bitRawImage (InputStream is, int width, int height) throws IOException
 
ImageProcessor open16bitAsciiImage (StreamTokenizer tok, int width, int height) throws IOException
 
- Public Member Functions inherited from ImagePlus
 ImagePlus ()
 
 ImagePlus (String title, Image img)
 
 ImagePlus (String title, ImageProcessor ip)
 
 ImagePlus (String pathOrURL)
 
synchronized boolean lock ()
 
synchronized boolean lockSilently ()
 
synchronized void unlock ()
 
void draw ()
 
void draw (int x, int y, int width, int height)
 
void updateAndDraw ()
 
void repaintWindow ()
 
void updateAndRepaintWindow ()
 
void updateImage ()
 
void show ()
 
void show (String statusMessage)
 
void setActivated ()
 
Image getImage ()
 
int getID ()
 
void setImage (Image img)
 
void setProcessor (String title, ImageProcessor ip)
 
void setFileInfo (FileInfo fi)
 
void setColor (Color c)
 
boolean isProcessor ()
 
ImageProcessor getProcessor ()
 
synchronized void trimProcessor ()
 
void killProcessor ()
 
ImageProcessor getMask ()
 
ImageStatistics getStatistics ()
 
ImageStatistics getStatistics (int mOptions)
 
ImageStatistics getStatistics (int mOptions, int nBins)
 
ImageStatistics getStatistics (int mOptions, int nBins, double histMin, double histMax)
 
String getTitle ()
 
String getShortTitle ()
 
void setTitle (String title)
 
int getWidth ()
 
int getHeight ()
 
int getStackSize ()
 
int getType ()
 
int getBitDepth ()
 
void setProperty (String key, Object value)
 
Object getProperty (String key)
 
Properties getProperties ()
 
LookUpTable createLut ()
 
boolean isInvertedLut ()
 
int[] getPixel (int x, int y)
 
Roi getRoi ()
 
void setRoi (Roi roi)
 
void setRoi (int x, int y, int width, int height)
 
void setRoi (Rectangle r)
 
void createNewRoi (int x, int y)
 
void killRoi ()
 
void restoreRoi ()
 
FileInfo getFileInfo ()
 
FileInfo getOriginalFileInfo ()
 
boolean imageUpdate (Image img, int flags, int x, int y, int w, int h)
 
synchronized void flush ()
 
void setIgnoreFlush (boolean ignoreFlush)
 
ImagePlus createImagePlus ()
 
void copyScale (ImagePlus imp)
 
void startTiming ()
 
long getStartTime ()
 
Calibration getCalibration ()
 
void setCalibration (Calibration cal)
 
void setGlobalCalibration (Calibration global)
 
void mouseMoved (int x, int y)
 
void updateStatusbarValue ()
 
String getLocationAsString (int x, int y)
 
String toString ()
 
ImageCanvas getCanvas ()
 
void setCanvas (ImageCanvas ic)
 

Additional Inherited Members

- Data Fields inherited from ImagePlus
boolean changes
 
double pixelWidth = 1.0
 
double pixelHeight = 1.0
 
double pixelDepth = 1.0
 
String unit = "pixel"
 
String units = "pixels"
 
boolean sCalibrated
 
- Static Public Attributes inherited from ImagePlus
static final int GRAY8 = 0
 
static final int GRAY16 = 1
 
static final int GRAY32 = 2
 
static final int COLOR_256 = 3
 
static final int COLOR_RGB = 4
 
- Protected Member Functions inherited from ImagePlus
void setType (int type)
 
- Protected Attributes inherited from ImagePlus
Image img
 
ImageProcessor ip
 
int width
 
int height
 
boolean locked = false
 
ImageCanvas imageCanvas
 

Detailed Description

This plugin opens PGM (portable graymap) 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.

Definition at line 56 of file PGM_Reader.java.

Member Function Documentation

void run ( String  arg)
inline

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.

Implements PlugIn.

Definition at line 62 of file PGM_Reader.java.


The documentation for this class was generated from the following file: