Skip to content

Instantly share code, notes, and snippets.

@kouichi-c-nakamura
Last active January 24, 2019 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kouichi-c-nakamura/1fee6b8b33a227d47854224fa185bb94 to your computer and use it in GitHub Desktop.
Save kouichi-c-nakamura/1fee6b8b33a227d47854224fa185bb94 to your computer and use it in GitHub Desktop.
function fac = getGatewayFacility(gateway,classname)
% getGatewayFacility is a MATLAB function to be used with OMERO Java
% Gateway.
%
% in Java, the following code returns the XxxxxFacility object fac.
% XxxxxFacility fac = gateway.getFacility(XxxxxFacility.class)
%
% However, running the same code in MATLAB requires special handling and
% this functions does that for you. For more details, see
% https://docs.openmicroscopy.org/latest/omero/developers/Java.html
% http://www.openmicroscopy.org/community/viewtopic.php?f=6&t=8615
%
%
% SYNTAX
% fac = getGatewayFacility(classname)
%
% INPUT ARGUMENTS
% classname 'AdminFacility' | 'BrowseFacility' | 'DataManagerFacility' |
% 'Facility' | 'MetadataFacility' | 'RawDataFacility' |
% 'ROIFacility' | 'SearchFacility' | 'TablesFacility' |
% 'TablesFacilityHelper' | 'TransferFacility' |
% 'TransferFacilityHelper'
%
% omero.gateway.facility Java class name in char row vector
% eg. 'BrowseFacility' for omero.gateway.facility.BrowseFacility
%
% https://downloads.openmicroscopy.org/latest/omero/api//omero/gateway/facility/package-summary.html
%
% OUTPUT ARGUMENTS
% fac omero.gateway.facility.XxxxxxFacility Java object
%
%
% EXAMPLE
% browse = getGatewayFacility(gateway,'BrowseFacility')
%
% Written by Kouichi C. Nakamura Ph.D.
% MRC Brain Network Dynamics Unit
% University of Oxford
% kouichi.c.nakamura@gmail.com
% 23-Jan-2019 16:07:10
%
% See also
% https://docs.openmicroscopy.org/latest/omero/developers/Java.html#read-data
% http://www.openmicroscopy.org/community/viewtopic.php?f=6&t=8615
%TODO by convetion, it's better to be getFacility, but this name confilcts
% with gateway object's getFacility method.
%TODO it is possible to check classname
clazz = java.lang.Class.forName(['omero.gateway.facility.',classname ], ...
false, gateway.getClass().getClassLoader());
fac = gateway.getFacility(clazz);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment