Package fr.igred.omero.repository
Class ImageWrapper
- java.lang.Object
-
- fr.igred.omero.GenericObjectWrapper<T>
-
- fr.igred.omero.AnnotatableWrapper<T>
-
- fr.igred.omero.repository.GenericRepositoryObjectWrapper<ImageData>
-
- fr.igred.omero.repository.ImageWrapper
-
public class ImageWrapper extends GenericRepositoryObjectWrapper<ImageData>
Class containing an ImageData.Wraps function calls to the ImageData contained.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class fr.igred.omero.repository.GenericRepositoryObjectWrapper
GenericRepositoryObjectWrapper.ReplacePolicy
-
-
Field Summary
Fields Modifier and Type Field Description static String
ANNOTATION_LINK
Annotation link name for this type of objectstatic String
IJ_ID_PROPERTY
Default IJ property to store image ID.-
Fields inherited from class fr.igred.omero.GenericObjectWrapper
data
-
-
Constructor Summary
Constructors Constructor Description ImageWrapper(ImageData image)
Constructor of the class ImageWrapper
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected String
annotationLinkType()
Returns the type of annotation link for this object.ImageData
asImageData()
Deprecated.Returns the ImageData contained.List<File>
download(Client client, String path)
Downloads the original files from the server.Timestamp
getAcquisitionDate()
Gets the ImageData acquisition dateColor
getChannelColor(Client client, int index)
Gets the current color of the channelColor
getChannelImportedColor(Client client, int index)
Gets the original color of the channelString
getChannelName(Client client, int index)
Gets the name of the channel.List<ChannelWrapper>
getChannels(Client client)
Gets the image channels.List<DatasetWrapper>
getDatasets(Client client)
Retrieves the datasets containing this imageString
getDescription()
Gets the ImageData descriptionList<ImageWrapper>
getFilesetImages(Client client)
Returns the list of images sharing the same fileset as the current image.FolderWrapper
getFolder(Client client, Long folderId)
Deprecated.Gets the folder with the specified id on OMERO.List<FolderWrapper>
getFolders(Client client)
Gets the list of folders linked to this image.String
getFormat()
Returns the format of the image.String
getName()
Gets the ImageData namePixelsWrapper
getPixels()
Gets the Pixels for this image.List<PlateAcquisitionWrapper>
getPlateAcquisitions(Client client)
Returns the plate acquisitions linked to this image.List<PlateWrapper>
getPlates(Client client)
Retrieves the plates containing this image.List<ProjectWrapper>
getProjects(Client client)
Retrieves the projects containing this imageList<FolderWrapper>
getROIFolders(Client client)
Gets the list of folders linked to the ROIs in this image.List<ROIWrapper>
getROIs(Client client)
Gets all ROIs linked to the image in OMEROList<ScreenWrapper>
getScreens(Client client)
Retrieves the screens containing this imageBufferedImage
getThumbnail(Client client, int size)
Retrieves the image thumbnail of the specified size.List<WellWrapper>
getWells(Client client)
Retrieves the wells containing this image.List<WellSampleWrapper>
getWellSamples()
Retrieves the well samples containing this image.List<WellSampleWrapper>
getWellSamples(Client client)
Retrieves the well samples containing this image and updates them from OMERO.boolean
isOrphaned(Client client)
Checks if image is orphaned (not in a WellSample nor linked to a dataset).void
reload(Browser browser)
Reloads the image from OMERO.void
saveROI(Client client, ROIWrapper roi)
Deprecated.Links a ROI to the image in OMEROList<ROIWrapper>
saveROIs(Client client, ROIWrapper... rois)
Links ROIs to the image in OMERO.List<ROIWrapper>
saveROIs(Client client, Collection<? extends ROIWrapper> rois)
Links ROIs to the image in OMERO.void
setDescription(String description)
Sets the description of the image.void
setName(String name)
Sets the name of the image.ImagePlus
toImagePlus(Client client)
Generates the ImagePlus from the ij library corresponding to the image from OMERO WARNING : you need to include the ij library to use this functionImagePlus
toImagePlus(Client client, int[] xBounds, int[] yBounds, int[] cBounds, int[] zBounds, int[] tBounds)
Gets the ImagePlus from the image within the specified boundaries.ImagePlus
toImagePlus(Client client, PixelsWrapper.Bounds bounds)
Gets the ImagePlus from the image within the specified boundaries.ImagePlus
toImagePlus(Client client, ROIWrapper roi)
Gets the ImagePlus from the image, but only inside the ROI.-
Methods inherited from class fr.igred.omero.repository.GenericRepositoryObjectWrapper
copyAnnotationLinks, importImage, importImages, refresh
-
Methods inherited from class fr.igred.omero.AnnotatableWrapper
addAndReplaceFile, addAndReplaceFile, addAndReplaceTable, addAndReplaceTable, addFile, addFileAnnotation, addKeyValuePair, addMapAnnotation, addPairKeyValue, addTable, addTag, addTag, addTag, addTags, addTags, copyAnnotationLinks, getAnnotations, getFileAnnotations, getKeyValuePairs, getMapAnnotations, getMyRating, getRatings, getTable, getTables, getTags, getValue, isLinked, link, link, linkIfNotLinked, rate, removeLink, removeLinks, unlink, unlink
-
Methods inherited from class fr.igred.omero.GenericObjectWrapper
asDataObject, canAnnotate, canChgrp, canChown, canDelete, canEdit, canLink, distinct, flatten, getCreated, getGroupId, getId, getOwner, getUpdated, saveAndUpdate, toString, wrap, wrap
-
-
-
-
Field Detail
-
ANNOTATION_LINK
public static final String ANNOTATION_LINK
Annotation link name for this type of object- See Also:
- Constant Field Values
-
IJ_ID_PROPERTY
public static final String IJ_ID_PROPERTY
Default IJ property to store image ID.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ImageWrapper
public ImageWrapper(ImageData image)
Constructor of the class ImageWrapper- Parameters:
image
- The image to wrap in the ImageWrapper.
-
-
Method Detail
-
getName
public String getName()
Gets the ImageData name- Specified by:
getName
in classGenericRepositoryObjectWrapper<ImageData>
- Returns:
- name.
-
setName
public void setName(String name)
Sets the name of the image.- Parameters:
name
- The name of the image. Mustn't benull
.- Throws:
IllegalArgumentException
- If the name isnull
.
-
asImageData
@Deprecated public ImageData asImageData()
Deprecated.Returns the ImageData contained. UseGenericObjectWrapper.asDataObject()
instead.- Returns:
- See above.
-
getDescription
public String getDescription()
Gets the ImageData description- Specified by:
getDescription
in classGenericRepositoryObjectWrapper<ImageData>
- Returns:
- description.
-
setDescription
public void setDescription(String description)
Sets the description of the image.- Parameters:
description
- The description of the image.
-
getAcquisitionDate
public Timestamp getAcquisitionDate()
Gets the ImageData acquisition date- Returns:
- acquisition date.
-
getFormat
public String getFormat()
Returns the format of the image.- Returns:
- See above.
-
annotationLinkType
protected String annotationLinkType()
Returns the type of annotation link for this object.- Specified by:
annotationLinkType
in classAnnotatableWrapper<ImageData>
- Returns:
- See above.
-
getProjects
public List<ProjectWrapper> getProjects(Client client) throws OMEROServerError, ServiceException, AccessException, ExecutionException
Retrieves the projects containing this image- Parameters:
client
- The client handling the connection.- Returns:
- See above.
- Throws:
OMEROServerError
- Server error.ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.
-
getDatasets
public List<DatasetWrapper> getDatasets(Client client) throws OMEROServerError, ServiceException, AccessException, ExecutionException
Retrieves the datasets containing this image- Parameters:
client
- The client handling the connection.- Returns:
- See above.
- Throws:
OMEROServerError
- Server error.ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.
-
getWellSamples
public List<WellSampleWrapper> getWellSamples()
Retrieves the well samples containing this image.- Returns:
- See above
-
getWellSamples
public List<WellSampleWrapper> getWellSamples(Client client) throws AccessException, ServiceException, ExecutionException
Retrieves the well samples containing this image and updates them from OMERO.- Parameters:
client
- The data browser.- Returns:
- See above
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.
-
getWells
public List<WellWrapper> getWells(Client client) throws AccessException, ServiceException, ExecutionException
Retrieves the wells containing this image.- Parameters:
client
- The client handling the connection.- Returns:
- See above
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.
-
getPlateAcquisitions
public List<PlateAcquisitionWrapper> getPlateAcquisitions(Client client) throws AccessException, ServiceException, ExecutionException
Returns the plate acquisitions linked to this image.- Parameters:
client
- The client handling the connection.- Returns:
- See above.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.
-
getPlates
public List<PlateWrapper> getPlates(Client client) throws AccessException, ServiceException, ExecutionException
Retrieves the plates containing this image.- Parameters:
client
- The client handling the connection.- Returns:
- See above
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.
-
getScreens
public List<ScreenWrapper> getScreens(Client client) throws AccessException, ServiceException, ExecutionException, OMEROServerError
Retrieves the screens containing this image- Parameters:
client
- The client handling the connection.- Returns:
- See above
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.OMEROServerError
- Server error.
-
isOrphaned
public boolean isOrphaned(Client client) throws ServiceException, OMEROServerError
Checks if image is orphaned (not in a WellSample nor linked to a dataset).- Parameters:
client
- The client handling the connection.- Returns:
true
if the image is orphaned,false
otherwise.- Throws:
ServiceException
- Cannot connect to OMERO.OMEROServerError
- Server error.
-
getFilesetImages
public List<ImageWrapper> getFilesetImages(Client client) throws AccessException, ServiceException, ExecutionException, OMEROServerError
Returns the list of images sharing the same fileset as the current image.- Parameters:
client
- The client handling the connection.- Returns:
- See above.
- Throws:
AccessException
- Cannot access data.ServiceException
- Cannot connect to OMERO.ExecutionException
- A Facility can't be retrieved or instantiated.OMEROServerError
- Server error.
-
saveROIs
public List<ROIWrapper> saveROIs(Client client, Collection<? extends ROIWrapper> rois) throws ServiceException, AccessException, ExecutionException
Links ROIs to the image in OMERO.DO NOT USE IT IF A SHAPE WAS DELETED !!!
- Parameters:
client
- The client handling the connection.rois
- ROIs to be added.- Returns:
- The updated list of ROIs.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.
-
saveROIs
public List<ROIWrapper> saveROIs(Client client, ROIWrapper... rois) throws ServiceException, AccessException, ExecutionException
Links ROIs to the image in OMERO.DO NOT USE IT IF A SHAPE WAS DELETED !!!
- Parameters:
client
- The data manager.rois
- ROIs to be added.- Returns:
- The updated list of ROIs.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.
-
saveROI
@Deprecated public void saveROI(Client client, ROIWrapper roi) throws ServiceException, AccessException, ExecutionException
Deprecated.Links a ROI to the image in OMERODO NOT USE IT IF A SHAPE WAS DELETED !!!
- Parameters:
client
- The client handling the connection.roi
- ROI to be added.- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.
-
getROIs
public List<ROIWrapper> getROIs(Client client) throws ServiceException, AccessException, ExecutionException
Gets all ROIs linked to the image in OMERO- Parameters:
client
- The client handling the connection.- Returns:
- List of ROIs linked to the image.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.
-
getROIFolders
public List<FolderWrapper> getROIFolders(Client client) throws ServiceException, AccessException, ExecutionException
Gets the list of folders linked to the ROIs in this image.- Parameters:
client
- The client handling the connection.- Returns:
- See above.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.
-
getFolders
public List<FolderWrapper> getFolders(Client client) throws ServiceException, AccessException, ExecutionException, OMEROServerError
Gets the list of folders linked to this image.- Parameters:
client
- The client handling the connection.- Returns:
- See above.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.OMEROServerError
- Server error.
-
getFolder
@Deprecated public FolderWrapper getFolder(Client client, Long folderId) throws ServiceException, OMEROServerError
Deprecated.Gets the folder with the specified id on OMERO.- Parameters:
client
- The client handling the connection.folderId
- ID of the folder.- Returns:
- The folder if it exists.
- Throws:
ServiceException
- Cannot connect to OMERO.OMEROServerError
- Server error.NoSuchElementException
- Folder does not exist.
-
getPixels
public PixelsWrapper getPixels()
Gets the Pixels for this image.- Returns:
- See above.
-
toImagePlus
public ImagePlus toImagePlus(Client client) throws ServiceException, AccessException, ExecutionException
Generates the ImagePlus from the ij library corresponding to the image from OMERO WARNING : you need to include the ij library to use this function- Parameters:
client
- The client handling the connection.- Returns:
- ImagePlus generated from the current image.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- If an error occurs while retrieving the plane data from the pixels source.ExecutionException
- A Facility can't be retrieved or instantiated.
-
toImagePlus
public ImagePlus toImagePlus(Client client, int[] xBounds, int[] yBounds, int[] cBounds, int[] zBounds, int[] tBounds) throws ServiceException, AccessException, ExecutionException
Gets the ImagePlus from the image within the specified boundaries.- Parameters:
client
- The client handling the connection.xBounds
- Array containing the X bounds from which the pixels should be retrieved.yBounds
- Array containing the Y bounds from which the pixels should be retrieved.cBounds
- Array containing the C bounds from which the pixels should be retrieved.zBounds
- Array containing the Z bounds from which the pixels should be retrieved.tBounds
- Array containing the T bounds from which the pixels should be retrieved.- Returns:
- an ImagePlus from the ij library.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- If an error occurs while retrieving the plane data from the pixels source.ExecutionException
- A Facility can't be retrieved or instantiated.
-
toImagePlus
public ImagePlus toImagePlus(Client client, ROIWrapper roi) throws ServiceException, AccessException, ExecutionException
Gets the ImagePlus from the image, but only inside the ROI.- Parameters:
client
- The client handling the connection.roi
- The ROI.- Returns:
- an ImagePlus from the ij library.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- If an error occurs while retrieving the plane data from the pixels source.ExecutionException
- A Facility can't be retrieved or instantiated.
-
toImagePlus
public ImagePlus toImagePlus(Client client, PixelsWrapper.Bounds bounds) throws ServiceException, AccessException, ExecutionException
Gets the ImagePlus from the image within the specified boundaries.- Parameters:
client
- The client handling the connection.bounds
- The bounds.- Returns:
- an ImagePlus from the ij library.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- If an error occurs while retrieving the plane data from the pixels source.ExecutionException
- A Facility can't be retrieved or instantiated.
-
getChannels
public List<ChannelWrapper> getChannels(Client client) throws ServiceException, AccessException, ExecutionException
Gets the image channels.- Parameters:
client
- The client handling the connection.- Returns:
- the channels.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.
-
getChannelName
public String getChannelName(Client client, int index) throws ServiceException, AccessException, ExecutionException
Gets the name of the channel.- Parameters:
client
- The client handling the connection.index
- Channel number.- Returns:
- name of the channel.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.
-
getChannelImportedColor
public Color getChannelImportedColor(Client client, int index) throws ServiceException, AccessException, ExecutionException
Gets the original color of the channel- Parameters:
client
- The client handling the connection.index
- Channel number.- Returns:
- Original color of the channel.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.
-
getChannelColor
public Color getChannelColor(Client client, int index) throws ServiceException, AccessException, ExecutionException
Gets the current color of the channel- Parameters:
client
- The client handling the connection.index
- Channel number.- Returns:
- Color of the channel.
- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.
-
getThumbnail
public BufferedImage getThumbnail(Client client, int size) throws ServiceException, OMEROServerError, IOException
Retrieves the image thumbnail of the specified size.If the image is not square, the size will be the longest side.
- Parameters:
client
- The client handling the connection.size
- The thumbnail size.- Returns:
- The thumbnail as a
BufferedImage
. - Throws:
ServiceException
- Cannot connect to OMERO.OMEROServerError
- Server error.IOException
- Cannot read thumbnail from store.
-
download
public List<File> download(Client client, String path) throws OMEROServerError, ServiceException, AccessException
Downloads the original files from the server.- Parameters:
client
- The client handling the connection.path
- Path to the file.- Returns:
- See above.
- Throws:
OMEROServerError
- Server error.ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.
-
reload
public void reload(Browser browser) throws ServiceException, AccessException, ExecutionException
Reloads the image from OMERO.- Overrides:
reload
in classGenericRepositoryObjectWrapper<ImageData>
- Parameters:
browser
- The data browser.- Throws:
ServiceException
- Cannot connect to OMERO.AccessException
- Cannot access data.ExecutionException
- A Facility can't be retrieved or instantiated.
-
-