Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add isRGB method #94

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions src/main/java/omero/gateway/facility/RawDataFacility.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,24 @@ public List<ResolutionDescription> getResolutionDescriptions(SecurityContext ctx

}

/**
* Checks if the image is considered RGB by the Bioformats Reader
* @param ctx The SecurityContext
* @param pixels The PixelsData object
* @return See above
* @throws DataSourceException If an error occurs while retrieving the data
*/
public boolean isRGB(SecurityContext ctx, PixelsData pixels) throws DataSourceException {
if (pixels == null)
return false;

try {
return getDataSink(ctx, pixels, gateway).isRGB();
} catch (DSOutOfServiceException e) {
throw new DataSourceException("Can't initiate DataSink", e);
}
}

/**
* Retrieves a data sink corresponding the pixels.
*
Expand Down
14 changes: 14 additions & 0 deletions src/main/java/omero/gateway/rnd/DataSink.java
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,20 @@ public Plane2D getTile(int z, int t, int c, int x,
return new Plane2D(array, w, h, bytesPerPixels, strategy);
}

/**
* Checks if the image is considered RGB by the Bioformats Reader.
* @return See above.
* @throws DataSourceException
* If an error occurs.
*/
public boolean isRGB() throws DataSourceException {
try {
return store.isRGB();
} catch (Exception e) {
throw new DataSourceException("Cannot access RawPixelStore", e);
}
}

/**
* Extracts a 2D plane from the pixels set this object is working for.
*
Expand Down
Loading