[ome-users] OMERO: No exceptions thrown upon missing images

b.gerritsen at nki.nl b.gerritsen at nki.nl
Wed Jul 15 10:00:28 BST 2009


Hello Chris,

Thanks for clarifying this!

We would like the possibility to tell OMERO that an omero object (image, plate, dataset, project, etc...) is not available because it has been archived. In our case all images including the database will be archived. Since our production system will have limited space we will have to remove the pixel data of some images while keeping the omero database intact as if they hadn't been removed. If omero generates images on the fly we will have no way of knowing something is wrong until maybe after analysis of large datasets. Currently we're considering to remove the data from an image and make the file inaccessible so that omero will throw a permission denied exception when a user or client-program tries to access it.

Kind Regards,
Bram
________________________________________
From: Chris Allan [callan at blackcat.ca]
Sent: Wednesday, July 15, 2009 10:29 AM
To: Bram Gerritsen
Cc: ome-users at lists.openmicroscopy.org.uk
Subject: Re: [ome-users] OMERO: No exceptions thrown upon missing images

On Tue, 2009-07-14 at 14:14 +0200, b.gerritsen at nki.nl wrote:
> Dear omero developers,

Hello Bram.

>
> OMERO Beta 4.0.3 does not throw an exception when trying to access an image that does exist in the database but does NOT exist in the omero data directory. In fact the missing image will be generated and look like a black canvas.

Correct, this is expected behaviour. OMERO creates files in the binary
repository on demand.

>
> I traced this behavior back to line 92 in ome.io.nio.RomioPixelBuffer private method "getFileChannel()": "RandomAccessFile file = new RandomAccessFile(getPath(), "rw");". If a file is opened as read-write ("rw") the RandomAccessFile class will not throw a FileNotFoundException. It would have when it is instructed to open a file as "r". The code below will duplicate the omero behavior:
>
> ---
> try {
>     RandomAccessFile f = new RandomAccessFile ("myNonExistentFile", "rw"); // This creates the file if it doesn't exist
>     FileChannel fc = f.getChannel();
>     fc.map(MapMode.READ_ONLY, 0, 1000); // Map 1000 bytes from a file into memory... in case of a non-existent file there will be 1000 bytes written to the file.
> } catch (Exception e) {
>     e.printStackTrace();
> }
> ---
>
> A solution might be to add the following lines before line 92 in ome.io.nio.RomioPixelBuffer:
>
> ---
> if (!new File(getPath()).exists()) {
>     throw new FileNotFoundException(getPath());
> }

If that code was in place you wouldn't be able to create the "pixel
buffer" except explicity. These are not the calling semantics of the
OMERO I/O API.

Is there something specific that you would like to happen if there is no
pixel data available for an image?

> ---
>
> Kind Regards,
> Bram Gerritsen

Thanks for the ideas.

-Chris




More information about the ome-users mailing list