|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectoptics.Optics
optics.OpticalSurface
optics.OpticalPlane
optics.OpticalImage
public class OpticalImage
Class to implement an OpticalImage, being a
OpticalPlane conatining an image. The actual image is
held as two-dimensional RealDataArray
from jfftw, so held as double[] array.
| Field Summary | |
|---|---|
protected ColourScale |
colourScale
Colourscale used for image display |
protected jfftw.RealDataArray |
data
The image RealDataArray. |
protected Grid |
grid
The image grid giving sampling and size information |
protected double |
max
Maximum value of the image |
protected double |
waveLength
Image wavelength, defaults to GREEN |
| Fields inherited from class optics.OpticalPlane |
|---|
blockedNormal, maxRadius, planeNormal |
| Fields inherited from class optics.OpticalSurface |
|---|
CLEAR, group, REFLECTING, REFRACTING, refractiveIndex, surfacePoint, surfaceType |
| Fields inherited from class optics.Optics |
|---|
DEFAULT_WAVELENGTH, errorStream, fmt, MICRONS |
| Constructor Summary | |
|---|---|
OpticalImage(double z,
int w,
int h)
Form a OpticalImage with specified position, size
and sampling interval defaults to unity |
|
OpticalImage(Position p,
java.awt.image.BufferedImage bi,
int band,
double dx,
double dy)
Form an OpticalImage with specfied position and
load a band of a BufferedImage. |
|
OpticalImage(Position p,
int w,
int h)
Forms an OpticalImage with specified position, size
and sampling interval defaults to unity. |
|
OpticalImage(Position p,
int w,
int h,
double dx,
double dy)
Form a OpticalImage with specified
reference point, sizrand sampling interval. |
|
OpticalImage(Position p,
jfftw.RealDataArray da,
double dx,
double dy)
Forms an OpticalImage from a
|
|
| Method Summary | |
|---|---|
void |
add(int i,
int j,
double value)
Method to add to the specifed pixel value |
boolean |
add(javax.vecmath.Point2d p,
double value)
Method to add a value to the closest pixel to the point in the plane taking into account samplein and the image centre. |
void |
add(javax.vecmath.Point2i pt,
double value)
Method to add to the specifed pixel value |
boolean |
add(Ray ray)
Boolean method to add an Intensity ray, returns true to ray strikes the plane withinside the image. |
int |
add(RayPencil pencil)
Method to add IntensityRaypencil to the OpticalImage
and return the number of ray sucessfully added |
void |
calculateIntensityRange()
Method to calcuate the intensity range |
void |
clear()
Method to clear the image data by setting it to zero. |
void |
draw(java.awt.Graphics2D g)
Overload of draw method to draw plane of correct height. |
java.awt.image.BufferedImage |
getBufferedImage()
Method to get the image as a displayable BufferedImage of type double. |
ColourScale |
getColourScale()
Method get the colour scale, may be null if not set. |
jfftw.RealDataArray |
getDataArray()
Method get the underlying RealDataArray |
Grid |
getGrid()
Method to get the image grid giving size and sampling parameters. |
int |
getHeight()
Method get the height of the image |
javax.vecmath.Point2d |
getLocation(int i,
int j)
Method to get the two-dimensional location of the specified pixel in plane. |
javax.vecmath.Point2d |
getLocation(javax.vecmath.Point2i p)
Method to get the location of the specified pixel in the plane |
double |
getMaxIntensity()
Method to get the Maximum intensity in the OpticalImage |
double |
getMaxRadius()
Method to get the maximum radius of the plane. |
double |
getMinIntensity()
Method to get the Minumum intensity in the OpticalImage |
double |
getPixel(int i,
int j)
Method to get the specified value |
double |
getPixel(javax.vecmath.Point2d p)
Get the pixel value closes to the specifed Point2d taking the sample interval and centre into account. |
double |
getPixel(javax.vecmath.Point2i pt)
Method to get the specified value |
Position |
getPosition(int i,
int j)
Method to get the position of the specifed pixel as a three-dimensional Poistion. |
Position |
getPosition(javax.vecmath.Point2i p)
Method to get the Position of the specifed pixel as a three-dimensional Poistion |
javax.vecmath.Point2i |
getSample(javax.vecmath.Point2d p)
Get the pixel location closest to the specified Point2d taking sample interval and centre into account. |
SourcePoint |
getSourcePoint(int i,
int j)
Method to get a SourcePoint for specied pixel with
fixed brightness given by the pixel value. |
SourcePoint |
getSourcePoint(javax.vecmath.Point2i pt)
Method to get a SourcePoint for specied pixel with
fixed brightness given by the pixel value. |
double |
getWaveLength()
Method to get the wavelength |
int |
getWidth()
Method get the width of the image |
OpticalImage |
imagedThrough(LensSystem lens,
double imagePlane,
double mag,
int raysPerPixel)
Method to image the OpticalImage through a given
OpticalGroup
The current plane of the OpticalImage is used as the object plane. |
OpticalImage |
imagedThrough(LensSystem lens,
double mag,
int raysPerPixel)
Method to image the Optical Image through a given OpticalGroup at a given magnification. |
void |
setColourScale(ColourScale cs)
Method to set the colour scale for display |
void |
setPixel(int i,
int j,
double value)
Method to set the specifed pixel. |
void |
setPixel(javax.vecmath.Point2i pt,
double value)
Method to set the specifed pixel. |
void |
setRange(double xSize,
double ySize)
Method to set the sample grid by specifing the image size. |
void |
setSampleGrid(double dx,
double dy)
Method to set the sample grid. |
void |
setSurfacePoint(Position p)
Overloaded method to set the surface point also sets the grid centre. |
void |
setTestGrid(int xgap,
int ygap)
Method to build a test grid with a series of white lines of unit intensity and one pixel wide. |
void |
setWaveLength(double lambda)
Method to set the wavelength |
| Methods inherited from class optics.OpticalPlane |
|---|
clone, distance, getBounds, getCurvature, getEdgePlane, getNormal, getPlaneNormal, pointInPlane, scale, setMaxRadius, setPlaneNormal, toString |
| Methods inherited from class optics.OpticalSurface |
|---|
distance, edit, entranceAperture, exitAperture, fromString, fromTokens, getGroup, getIndex, getNormal, getPoint, getRefractiveIndex, getSurfacePoint, getSurfaceType, getSurfaceType, makeStandAlone, pointInPlane, setGroup, setRefractiveIndex, setSurfaceType |
| Methods inherited from class optics.Optics |
|---|
getDefaultWaveLength, getErrorStream, getFormatString, getName, getStaticName, getVersion, printError, setDefaultWaveLength, setErrorStream, setFormatString, setMicrons |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected Grid grid
protected jfftw.RealDataArray data
protected double waveLength
protected ColourScale colourScale
protected double max
| Constructor Detail |
|---|
public OpticalImage(Position p,
int w,
int h,
double dx,
double dy)
OpticalImage with specified
reference point, sizrand sampling interval. The image data
is pre-set to zero.
p - the surface point, also specifes the image centre.w - the width of the image in pixelsh - the height of the image in pixelsdx - the x sample intervaldy - the y sample internal
public OpticalImage(Position p,
jfftw.RealDataArray da,
double dx,
double dy)
OpticalImage from a
RealDataArray, which is assumed to be two-dimensional.
- Parameters:
p - the surface point, also specifies the image centre.da - the RealDataArray holding the data (not copied)dx - the x sample internal.dy - the y sample internal.
public OpticalImage(Position p,
int w,
int h)
OpticalImage with specified position, size
and sampling interval defaults to unity.
p - the surface pointw - the width of the image in pixelsh - the height of the image in pixels
public OpticalImage(double z,
int w,
int h)
OpticalImage with specified position, size
and sampling interval defaults to unity
z - location of the OpticalImagew - the width of the image in pixelsh - the height of the image in pixels
public OpticalImage(Position p,
java.awt.image.BufferedImage bi,
int band,
double dx,
double dy)
OpticalImage with specfied position and
load a band of a BufferedImage.
If the band specifed is not
legal, then the centre band is taken automatically.
p - the poisitionbi - the BufferedImageband - the image band.dx - x sample interval.dy - y sample interval.| Method Detail |
|---|
public void setSampleGrid(double dx,
double dy)
dx - x sample intervaldy - y sample interval
public void setRange(double xSize,
double ySize)
xSize - the horizontal sizeySize - the verstical size.public void setSurfacePoint(Position p)
setSurfacePoint in class OpticalSurfacep - the Surface pointpublic int getWidth()
int width of the imagepublic int getHeight()
int width of the imagepublic double getMaxRadius()
getMaxRadius in class OpticalPlanedouble The Maximum radiuspublic void setWaveLength(double lambda)
public double getWaveLength()
double the wavelengthpublic jfftw.RealDataArray getDataArray()
RealDataArray
RealDataArray the underlying
RealDataArray.public Grid getGrid()
Grid the image grid.public void clear()
public void setColourScale(ColourScale cs)
cs - the ColourScalepublic ColourScale getColourScale()
ColourScale the current colourscale
public void setPixel(int i,
int j,
double value)
i - the i pixel indexj - the j pixel indexvalue - the value
public void setPixel(javax.vecmath.Point2i pt,
double value)
pt - the pxel locationvalue - the value
public double getPixel(int i,
int j)
i - the i pixel indexj - the j pixel index
double the pixel valuepublic double getPixel(javax.vecmath.Point2i pt)
pt - pixel location
double the pixel value
public Position getPosition(int i,
int j)
i - the i pixel indexj - the j pixel index
Position the Positionpublic Position getPosition(javax.vecmath.Point2i p)
p - the Pixel location
Position the Position
public SourcePoint getSourcePoint(int i,
int j)
SourcePoint for specied pixel with
fixed brightness given by the pixel value.
i - the i pixel indexj - the j pixel index
SourcePoint of the specified pixel.public SourcePoint getSourcePoint(javax.vecmath.Point2i pt)
SourcePoint for specied pixel with
fixed brightness given by the pixel value.
pt - the pixel location
SourcePoint of the specified pixel.
public javax.vecmath.Point2d getLocation(int i,
int j)
i - the i pixel indexj - the j pixel index
Point2d the location.public javax.vecmath.Point2d getLocation(javax.vecmath.Point2i p)
p - pixel index.
Point2d the location.public javax.vecmath.Point2i getSample(javax.vecmath.Point2d p)
p - the point
Point2i the pixel locationpublic double getPixel(javax.vecmath.Point2d p)
Double.NaN
if it is outsize the image.
p - the point in the plane
public void add(int i,
int j,
double value)
i - the x pixel locationj - the j pixel locationvalue - value to be added
public void add(javax.vecmath.Point2i pt,
double value)
pt - the pixel locationvalue - to be addeed
public boolean add(javax.vecmath.Point2d p,
double value)
p - the point in the imagevalue - the avlue to be added
boolean true if within the image, else false.public boolean add(Ray ray)
Not the ray is not propagated to the plane.
ray - the Intensity ray to be added.
boolean true if inside image.public int add(RayPencil pencil)
IntensityRaypencil to the OpticalImage
and return the number of ray sucessfully added
pencil - the Raypencil
int number of rays sucessfully added.public void calculateIntensityRange()
getMaxIntensity(),
getMinIntensity()public double getMaxIntensity()
double the maximum valuepublic double getMinIntensity()
double the minumum valuepublic java.awt.image.BufferedImage getBufferedImage()
double. If the colourscale is not
pretset it will deafult to a linear grey scale.
Note the actual data array is ued to make the displayable raster.
BufferedImage displayable buffered image.
public void setTestGrid(int xgap,
int ygap)
xgap - the x separation.ygap - the y separation.
public OpticalImage imagedThrough(LensSystem lens,
double mag,
int raysPerPixel)
The reference point of the current optical image is set to the object plane.
lens - the Lens systemmag - the linear magnificationraysPerPixel - rays traced per pixel
public OpticalImage imagedThrough(LensSystem lens,
double imagePlane,
double mag,
int raysPerPixel)
OpticalImage through a given
OpticalGroup
The current plane of the OpticalImage is used as the object plane.
The output image is scaled by the magnification factor.
For large images and large number of rays this calcualtion can be rather slow.
lens - the optical groupimagePlane - Location of image planemag - magnification (used to scale output image only)raysPerPixel - rays traced per pixels
OpticalImage the image.public void draw(java.awt.Graphics2D g)
draw in interface Diagram2DComponentdraw in class OpticalPlaneg - the Graphics2D
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||