|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.core.BasicItem<D> net.sf.basedb.core.ChildItem<SpotImagesData> net.sf.basedb.core.SpotImages
public class SpotImages
Holds settings for creating small spot iamges from 1-3 image files and the raw data information for a single raw bioassay.
For performance and disk space reasons the spot images are placed
NxN (N given by the NUM_SPOT_IMAGES
constant) into JPEG
files, which are put in a zip file.
Field Summary | |
---|---|
static int |
NUM_SPOT_IMAGES
The number of spot images to place side by side in each file. |
static Item |
TYPE
The type of item represented by this class. |
Constructor Summary | |
---|---|
SpotImages(SpotImagesData data)
|
Method Summary | |
---|---|
private RenderedImage |
convertTiffImage(RenderedImage image,
byte[] conversionTable)
Convert TIFF image from 16 bits to 8 bits if needed |
void |
createSpotImages(File spotImagesFile,
int xScale,
int yScale,
int xOffset,
int yOffset,
int spotsize,
float gamma,
float quality,
File redImageFile,
File greenImageFile,
File blueImageFile,
ProgressReporter progress)
Creates spot images with 8 bits per channel, from source images. |
void |
disconnectSpotImages()
Disconnects the generated spot image file from this item. |
File |
getBlueImageFile()
Get the file which was used for the blue channel in the spot images. |
float |
getGamma()
Get the gamma correction value. |
File |
getGreenImageFile()
Get the file which was used for the green channel in the spot images. |
(package private) static SpotImages |
getNew(DbControl dc,
RawBioAssay rawBioAssay)
Create a new Image item. |
float |
getQuality()
Get the quality used for the jpeg compression. |
RawBioAssay |
getRawBioAssay()
Get the raw bioassay the spot images belongs to. |
File |
getRedImageFile()
Get the file which was used for the red channel in the spot images. |
(package private) SharedData |
getSharedParent()
Get the shareable parent item of this child item. |
SpotImage |
getSpotImage(RawData data)
Get a spot as a PNG image. |
List<SpotImage> |
getSpotImages(List<RawData> data)
Get a list of spot PNG images from a list of RawData . |
File |
getSpotImagesFile()
Get the file which holds the spot images. |
int |
getSpotsize()
Get the size of the spots in pixels. |
Item |
getType()
Get the type of item represented by the object. |
int |
getXOffset()
Get the X-axis offset used to convert data coordinates to image pixel values: xPixel = (xData - xOffset) / xScale . |
int |
getXScale()
Get the X-axis scale factor used to convert data coordinates to image pixel values: xPixel = (xData - xOffset) / xScale . |
int |
getYOffset()
Get the Y-axis offset used to convert data coordinates to image pixel values: yPixel = (yData - yOffset) / yScale . |
int |
getYScale()
Get the Y-axis scale factor used to convert data coordinates to image pixel values: yPixel = (yData - yOffset) / yScale . |
private boolean |
insideImage(float x,
float y,
int spotsize,
int width,
int height)
Check if entire spot is inside the soure image. |
private RenderedOp |
loadTiffImage(File file,
int band)
Loads a TIFF file and returns a RenderedOp . |
private RenderedOp |
mergeColorImages()
Merge the three color images into a single image. |
private RenderedOp |
rescaleColors(RenderedOp image,
boolean red,
boolean green,
boolean blue)
Rescale the colors of the images so we use the whole 16-bit color range. |
private void |
saveImage(ZipOutputStream zipFileStream,
String fileName,
RenderedImage image,
float quality)
Saving an image as jpeg and putting it in a zip file |
private void |
setBlueImageFile(File blueImageFile)
|
private void |
setGamma(float gamma)
|
private void |
setGreenImageFile(File greenImageFile)
|
private void |
setQuality(float quality)
|
(package private) void |
setRawBioAssay(RawBioAssay rawBioAssay)
Set the raw bioassay the spot images belongs to. |
private void |
setRedImageFile(File redImageFile)
|
private void |
setSpotsize(int spotsize)
|
private void |
setXOffset(int xOffset)
|
private void |
setXScale(int xScale)
|
private void |
setYOffset(int yOffset)
|
private void |
setYScale(int yScale)
|
Methods inherited from class net.sf.basedb.core.ChildItem |
---|
getPermissionForWriteDeleteAndCreate, getPluginPermissions, initPermissions |
Methods inherited from class net.sf.basedb.core.BasicItem |
---|
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, onAfterInsert, onBeforeCommit, onRollback, setDbControl, setProjectDefaults, toString, toTransferable, validate |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Item TYPE
Item.SPOTIMAGES
,
getType()
public static final int NUM_SPOT_IMAGES
Constructor Detail |
---|
SpotImages(SpotImagesData data)
Method Detail |
---|
static SpotImages getNew(DbControl dc, RawBioAssay rawBioAssay) throws BaseException
Image
item.
dc
- The DbControl
which will be used for
permission checking and database accessrawBioAssay
- The RawBioAssay
to create spot images for
SpotImages
item
BaseException
- If there is an errorRawBioAssay.getSpotImages()
public Item getType()
Identifiable
Item
enumeration.
SharedData getSharedParent()
ChildItem
ChildItem.initPermissions(int, int)
method to calculate
the logged in user's permissions for the child item.
getSharedParent
in class ChildItem<SpotImagesData>
public RawBioAssay getRawBioAssay() throws PermissionDeniedException, BaseException
RawBioAssay
item
PermissionDeniedException
- If the logged in user doesn't have
Permission.READ
permission
BaseException
- If there is another errorvoid setRawBioAssay(RawBioAssay rawBioAssay) throws PermissionDeniedException, InvalidDataException
InvalidDataException
- If the raw bioassay is null
PermissionDeniedException
public int getXScale()
xPixel = (xData - xOffset) / xScale
. The scale is
always a positive integer.
private void setXScale(int xScale) throws InvalidDataException
InvalidDataException
public int getYScale()
yPixel = (yData - yOffset) / yScale
. The scale is
always a positive integer.
private void setYScale(int yScale) throws InvalidDataException
InvalidDataException
public int getXOffset()
xPixel = (xData - xOffset) / xScale
. The offset may be
positive or negative.
private void setXOffset(int xOffset)
public int getYOffset()
yPixel = (yData - yOffset) / yScale
. The offset may be
positive or negative.
private void setYOffset(int yOffset)
public int getSpotsize()
private void setSpotsize(int spotsize) throws InvalidDataException
InvalidDataException
public float getQuality()
private void setQuality(float quality) throws InvalidDataException
InvalidDataException
public float getGamma()
private void setGamma(float gamma) throws InvalidDataException
InvalidDataException
public File getRedImageFile() throws PermissionDeniedException, BaseException
PermissionDeniedException
- If the logged in user doesn't
have read permission for the file
BaseException
- If there is another errorprivate void setRedImageFile(File redImageFile) throws PermissionDeniedException
PermissionDeniedException
public File getGreenImageFile() throws PermissionDeniedException, BaseException
PermissionDeniedException
- If the logged in user doesn't
have read permission for the file
BaseException
- If there is another errorprivate void setGreenImageFile(File greenImageFile) throws PermissionDeniedException
PermissionDeniedException
public File getBlueImageFile() throws PermissionDeniedException, BaseException
PermissionDeniedException
- If the logged in user doesn't
have read permission for the file
BaseException
- If there is another errorprivate void setBlueImageFile(File blueImageFile) throws PermissionDeniedException
PermissionDeniedException
public File getSpotImagesFile() throws PermissionDeniedException, BaseException
PermissionDeniedException
- If the logged in user doesn't
have read permission for the file
BaseException
- If there is another errorpublic void disconnectSpotImages() throws PermissionDeniedException, BaseException
DbControl.deleteItem(BasicItem)
method.
PermissionDeniedException
- If the logged in user doesn't have
write permission
BaseException
- If there is an errorpublic void createSpotImages(File spotImagesFile, int xScale, int yScale, int xOffset, int yOffset, int spotsize, float gamma, float quality, File redImageFile, File greenImageFile, File blueImageFile, ProgressReporter progress) throws PermissionDeniedException, InvalidDataException, BaseException
spotImagesFile
- The file which will hold the created zip file with the spot images.
Any existing content will be replacedxScale
- X-axis scale factor from data values to pixel values, must be > 0yScale
- Y-axis scale factor from data values to pixel values, must be > 0xOffset
- X offset in data value, can be any valueyOffset
- Y offset in data value, can be any valuespotsize
- The size of the spot i pixels, must be > 0gamma
- Gamma correction value, must be > 1.0quality
- The JPEG compression qualtity, must be a value between 0.0 and 1.0redImageFile
- The file containing the image to be used for the red channel
or nullgreenImageFile
- The file containing the image to be used for the green channel
or nullblueImageFile
- The file containing the image to be used for the blue channel
or nullprogress
- A ProgressReporter
object if the calling client is
interested in the progress or null if not
PermissionDeniedException
- If the logged in user doesn't have write
permission for the raw bioassay or to the specified spot images file or doesn't have
use permission for any of the image files
InvalidDataException
- If the directory or file name is null or all image files are
null, or any of the other values are out of range
ItemAlreadyExistsException
- If a file with the same name already exists in
the directory
BaseException
- If there is another errorpublic SpotImage getSpotImage(RawData data) throws InvalidDataException, ItemNotFoundException, BaseException
SpotImage
.
data
- A RawData
object representing the spot
SpotImage
as a PNG image
InvalidDataException
- If the data object is null
ItemNotFoundException
- If a spot image for the position is not found
BaseException
- If there is another errorpublic List<SpotImage> getSpotImages(List<RawData> data) throws InvalidDataException, ItemNotFoundException, PermissionDeniedException, BaseException
RawData
.
It is returned as a list of SpotImage
objects. The returned list
will be mapped to the incomming list. If a spot image is not found, null will
be put at its position in the list. That will make both list to always have the same size.
It is more efficient having the list sorted by the RawData
's position.
data
- A list of RawData
objects representing the spots
SpotImage
objects as PNG images
InvalidDataException
- If the list of data is null
ItemNotFoundException
- If the file with the spot images is not found
PermissionDeniedException
- If the logged in user doesn't have
read permission for the file continaing the spot images
BaseException
- If there is another errorprivate RenderedOp mergeColorImages() throws BaseException
BaseException
private RenderedOp rescaleColors(RenderedOp image, boolean red, boolean green, boolean blue)
image
- Image to rescalered
- TRUE if the red channel isn't empty and should be included in the calculationgreen
- TRUE if green red channel isn't empty and should be included in the calculationblue
- TRUE if the blue channel isn't empty and should be included in the calculation
private RenderedOp loadTiffImage(File file, int band) throws BaseException
RenderedOp
.
file
- A Base File
object pointing to the image to be loadedband
- The index of the TIFF directory to load
BaseException
private RenderedImage convertTiffImage(RenderedImage image, byte[] conversionTable) throws BaseException
image
- TIFF image to convertconversionTable
- Conversion table
RenderedOp
object of the image
BaseException
- If there is an errorprivate void saveImage(ZipOutputStream zipFileStream, String fileName, RenderedImage image, float quality) throws IOException
zipFileStream
- Destination stream to where the JPEG is saved tofileName
- The filename of the imageimage
- The image to be savedquality
- The quality setting of the JPEG image
IOException
private boolean insideImage(float x, float y, int spotsize, int width, int height)
x
- Spot x coordinatey
- Spot y coordinatespotsize
- Spot width and heightwidth
- Source image widthheight
- Source image height
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |