Class Core
Java SDK
Java wrapper library for PMA.start, a universal viewer for whole slide imaging and microscopy
-
Field Summary
Modifier and TypeFieldDescriptionstatic BlockingQueue<Long>
Readable bytes for upload and download methods. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription_pma_filesToUpload
(String localSourceSlide, String targetFolder, String sessionID) This method will check the remote folder for a slide with the same name and search in the local folder for files that are related to the slide entered in the input parameters.static org.json.JSONObject
_pma_get_DataIdTypeConString_forUpload
(String localSourceSlide, String targetFolder, String sessionID) This method is for getting JSON data: uploadID, upload type and upload URLs.static org.json.JSONArray
add_Annotations
(String sessionID, String pathOrUid, String classification, int layerID, String notes, String geometry, String color) This method is used to add the annotations for slidestatic Boolean
This method returns a boolean result based on the input parameters.static boolean
clear_annotations
(String slideRef, int layerID, String sessionID) This method is used to delete all the annotations for slidestatic String
This method is used to authenticate & connect to a PMA.core instance using credentialsstatic CloudServerData
connectToCloud
(String username, String password) This method connect to cloud with json data.static Boolean
disconnect
(String... varargs) This method is used to disconnect from a running PMA.core instancestatic Document
This method is used to parse a XML contentstatic boolean
* This method downloads single slide and multipart slide.
param varargs:enumerateFilesForSlide
(String slideRef, String... varargs) This method is used to get list of files related to a slide for PMA.start ONLYenumerateFilesForSlidePMACore
(String slideRef, String... varargs) This method is used to get list of files related to a slide for PMA.core ONLYstatic org.json.JSONArray
getAnnotations
(String slideRef, String... varargs) This method is used to retrieve the annotations for slide slideRefgetAPIVersion
(String... varargs) This method is used to get the API version in a list fashionstatic String
getAPIVersionString
(String... varargs) This method is used to get the API version in a single stringgetAssociatedImageTypes
(String slideRef, String... varargs) This method is used to return the list of image types associated with a slide (thumbnail, barcode...)getAvailableForms
(String... varargs) This method is used to get a Map of the forms available to fill out, either system-wide (leave slideref to "null"), or for a particular slidestatic Image
getBarcodeImage
(String slideRef, String... varargs) This method is used to get the barcode (alias for "label") image for a slidestatic String
getBarcodeText
(String slideRef, String... varargs) This method is used to get the text encoded by the barcodestatic String
getBarcodeUrl
(String slideRef, String... varargs) This method is used to get the URL that points to the barcode (alias for "label") for a slidestatic String
getBuildRevision
(String... varargs) This method is used to get the version numberstatic org.json.JSONArray
getCaseCollections
(String pmaControlURL, String pmaCoreSessionID) This method is used to get case collectionsstatic String
getCloudAuth
(String accessToken) This method make authorization with token to connect cloudgetDirectories
(String startDir, Object... varargs) This method is used to get sub-directories available to sessionID in the start directory following a recursive (or not) approachgetFilesForSlide
(String slideRef, String... varargs) This method is used to map of files related to a slidestatic String
getFingerPrint
(String slideRef, String... varargs) This method is used to get the fingerprint for a specific slidestatic String
getFirstNonEmptyDirectory
(String... varargs) This method is used to get the first non empty directorystatic org.json.JSONArray
getJSONArrayResponse
(String value) This method is used to get a JSONArray from a String argumentstatic StringBuffer
static org.json.JSONObject
getJSONResponse
(String value) This method reads and returns the input json datastatic Image
getLabelImage
(String slideRef, String... varargs) This method is used to get the label image for a slidestatic String
getLabelUrl
(String slideRef, String... varargs) This method is used to get the URL that points to the label for a slidestatic String
getLastModifiedDate
(String slideRef, String... varargs) This method is used to convert the slide last modified time stamp into a human readable formatstatic int
getMagnification
(String slideRef, Object... varargs) This method is used to get the magnification represented at a certain zoom levelstatic int
getMaxZoomLevel
(String slideRef, String... varargs) This method is used to determine the maximum zoom level that still represents an optical magnificationstatic int
getNumberOfChannels
(String slideRef, String... varargs) This method is used to get the number of channels for a slidestatic int
getNumberOfLayers
(String slideRef, String... varargs) This method is used to get the number of (z-stacked) layers for a slidegetNumberOfTiles
(String slideRef, Object... varargs) This method is used to determine the number of tiles needed to reconstitute a slide at a given zoom levelstatic int
getNumberOfZStackLayers
(String slideRef, String... varargs) This method is used to get the number of (z-stacked) layers for a slidegetPhysicalDimensions
(String slideRef, String... varargs) This method is used to Determine the physical dimensions of the sample represented by the slidegetPixelDimensions
(String slideRef, Object... varargs) This method is used to get the total dimensions of a slide image at a given zoom levelgetPixelsPerMicrometer
(String slideRef, Object... varargs) This method is used to get the physical dimension in terms of pixels per micrometer of a slidestatic String
static String
static org.json.JSONArray
getProjects
(String pmaControlURL, String pmaCoreSessionID) This method is used to get the list of projectsstatic Image
Gets a region of the slide at the specified scale Format can be 'jpg' or 'png' Quality is an integer value and varies from 0 (as much compression as possible; not recommended) to 100 (100%, no compression) x,y,width,height is the region to get rotation is the rotation in degrees of the slide to getstatic String
getRegionUrl
(String slideRef, Object... varargs) This method is used to create the url to retrieve a region of the slide at the specified scale (x,y,width,height)getRootDirectories
(String... varargs) This method is used to get root-directories available for a sessionIDgetSessionIds
(String pmaControlURL, String pmaCoreSessionID) This method is used to get the list of sessions' IDsstatic org.json.JSONArray
getSessions
(String pmaControlURL, String pmaCoreSessionID) This method is used to get the list of sessionsstatic String
getSlideFileExtension
(String slideRef) This method is used to determine the file extension for a slide's pathstatic String
getSlideFileName
(String slideRef) This method is used to determine file name (with extension) for a slide's pathgetSlideInfo
(String slideRef, String... varargs) This method is used to get a raw image in the form of nested mapsThis method is used to get a list of slides available to sessionID in the start directory following a recursive (or not) approachgetSlidesInfo
(List<String> slideRefs, String... varargs) This method is used to get raw images in the form of nested mapsstatic org.json.JSONArray
getSubmittedFormData
(String slideRef, String... varargs) This method is used to get submitted forms data in json Array formatgetSubmittedForms
(String slideRef, String... varargs) This method is used to find out what forms where submitted for a specific slidestatic Image
getThumbnailImage
(String slideRef, Object... varargs) This method is used to get the thumbnail image for a slidestatic String
getThumbnailUrl
(String slideRef, Object... varargs) This method is used to get the URL that points to the thumbnail for a slidestatic Image
This method is used to get a single tile at position (x, y)static Stream
This method is used to get all tiles with a (fromX, fromY, toX, toY) rectanglegetTileSize
(String... varargs) This method is used to get tile size information for sessionIDstatic String
getTileUrl
(String slideRef, Object... varargs) This method is used to create the url to retrieve a single tile at position (x, y)static String
This method is used to get the UID for a defined slidestatic String
getVersionInfo
(String... varargs) This method is used to get the version numberstatic org.json.JSONObject
getVersionInfoPmaControl
(String pmaControlURL) This method is used to get version info from PMA.control instance running at pmacontrolURLgetZoomLevelsDict
(String slideRef, Object... varargs) This method is used to get a map with the number of tiles per zoom levelgetZoomLevelsList
(String slideRef, Object... varargs) This method is used to get list with all zoom levels, from 0 to max zoom levelstatic Boolean
isFluorescent
(String slideRef, String... varargs) This method is used to determine whether a slide is a fluorescent image or notstatic Boolean
isJSONObject
(String value) static Boolean
checks to see if PMA.core.lite (server component of PMA.start) is running at a given endpoint. if pmaCoreURL is omitted, default check is to see if PMA.start is effectively running at localhost (defined by pmaCoreLiteURL).static Boolean
isMultiLayer
(String slideRef, String... varargs) This method is used to determine whether a slide contains multiple (stacked) layers or notstatic Boolean
This method is used to determine whether a slide is a z-stack or notstatic boolean
This method is used to test if sessionID is valid and the server is online and reachable This method works only for PMA.core, don't use it for PMA.start for it will return always falsestatic String
This method is used to get the url related to the session's IDstatic String
This method makes DataOutputStream connection to send data to cloud.prepareFormMap
(String formID, String... varargs) This method is used to prepare a form-dictionary that can be used later on to submit new form data for a slidestatic String
This method is used to create the query URL for a session IDsearchSlides
(String startDir, String pattern, String... varargs) This method is used to search for slides in a directory that satisfy a certain search patternsessions()
This method returns pmaSessions.static void
setDebugFlag
(boolean flag) This method is used to determine whether the Java SDK runs in debugging mode or not.static void
This method is used to launch the default web browser and load a web-based viewer for the slidestatic String
submitFormData
(String slideRef, String formID, String formMap, String... varargs) To be elaborated laterstatic boolean
upload
(String localSourceSlide, String targetFolder, String sessionID, ProgressHttpEntityWrapper.ProgressCallback progressCallback, Object... varargs) Uploads a slide to a PMA.core server.static String
This method is used to retrieve HTML Code from URLThis method is used to get information about a session
-
Field Details
-
bytes
Readable bytes for upload and download methods. To integrate into the progress bar.
-
-
Constructor Details
-
Core
public Core()
-
-
Method Details
-
getPmaSessions
- Returns:
- the pmaSessions
-
getPmaUsernames
- Returns:
- the pmaUsernames
-
getPmaSlideInfos
- Returns:
- the pmaSlideInfos
-
getPmaCoreLiteURL
- Returns:
- the pmaCoreLiteURL
-
getPmaCoreLiteSessionID
- Returns:
- the pmaCoreLiteSessionID
-
getPmaAmountOfDataDownloaded
- Returns:
- the pmaAmountOfDataDownloaded
-
setDebugFlag
public static void setDebugFlag(boolean flag) This method is used to determine whether the Java SDK runs in debugging mode or not. When in debugging mode (flag = true), extra output is produced when certain conditions in the code are not met- Parameters:
flag
- Debugging mode (activated or deactivated)
-
pmaUrl
This method is used to get the url related to the session's ID- Parameters:
varargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Url related to the session's ID
- Throws:
Exception
- if sessionID is invalid
-
urlReader
This method is used to retrieve HTML Code from URL- Parameters:
url
- to get HTML code from- Returns:
- String HTML code generated from the url argument
-
domParser
This method is used to parse a XML content- Parameters:
s
- XML content to parse- Returns:
- Document parsed XML
-
getSessions
This method is used to get the list of sessions- Parameters:
pmaControlURL
- URL for PMA.ControlpmaCoreSessionID
- PMA.core session ID- Returns:
- JSONArray containing the list of sessions
-
getSessionIds
public static Map<String,Map<String, getSessionIdsString>> (String pmaControlURL, String pmaCoreSessionID) This method is used to get the list of sessions' IDs- Parameters:
pmaControlURL
- URL for PMA.ControlpmaCoreSessionID
- PMA.core session ID- Returns:
- Mapinvalid input: '<'String, Mapinvalid input: '<'String, String>> containing the sessions' IDs
-
getCaseCollections
This method is used to get case collections- Parameters:
pmaControlURL
- URL for PMA.ControlpmaCoreSessionID
- PMA.core session ID- Returns:
- JSONArray containing the list of case sessions
-
getProjects
This method is used to get the list of projects- Parameters:
pmaControlURL
- URL for PMA.ControlpmaCoreSessionID
- PMA.core session ID- Returns:
- JSONArray containing the list of projects
-
queryUrl
This method is used to create the query URL for a session ID- Parameters:
varargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Query URL
-
isLite
checks to see if PMA.core.lite (server component of PMA.start) is running at a given endpoint. if pmaCoreURL is omitted, default check is to see if PMA.start is effectively running at localhost (defined by pmaCoreLiteURL). note that PMA.start may not be running, while it is actually installed. This method doesn't detect whether PMA.start is installed; merely whether it's running! if pmaCoreURL is specified, then the method checks if there's an instance of PMA.start (results in True), PMA.core (results in False) or nothing (at least not a Pathomation software platform component) at all (results in None)- Parameters:
varargs
- Array of optional argumentspmaCoreURL : First optional argument(String), default value(Class field pmaCoreLiteURL), url of PMA.core instance
- Returns:
- Checks if there is a PMA.core.lite or PMA.core instance running
-
getVersionInfo
This method is used to get the version number- Parameters:
varargs
- Array of optional argumentspmaCoreURL : First optional argument(String), default value(Class field pmaCoreLiteURL), url of PMA.core instance
- Returns:
- Version number
-
getVersionInfoPmaControl
This method is used to get version info from PMA.control instance running at pmacontrolURL- Parameters:
pmaControlURL
- PMA Control's URL- Returns:
- JSONObject containing the version info
-
getBuildRevision
This method is used to get the version number- Parameters:
varargs
- Array of optional argumentspmaCoreURL : First optional argument(String), default value(Class field pmaCoreLiteURL), url of PMA.core instance
- Returns:
- Version number
-
getAPIVersion
This method is used to get the API version in a list fashion- Parameters:
varargs
- Array of optional argumentspmacoreURL : First optional argument(String), default value(Class field pmaCoreLiteURL), url of PMA.core instance
- Returns:
- API version in a list fashion
- Throws:
Exception
- If GetAPIVersion isn't available on the API
-
getAPIVersionString
This method is used to get the API version in a single string- Parameters:
varargs
- Array of optional argumentspmacoreURL : First optional argument(String), default value(Class field pmaCoreLiteURL), url of PMA.core instance
- Returns:
- API version in a single string
- Throws:
Exception
- If GetAPIVersion isn't available on the API
-
connect
This method is used to authenticate & connect to a PMA.core instance using credentials- Parameters:
varargs
- Array of optional argumentspmacoreURL : First optional argument(String), default value(Class field pmaCoreLiteURL), url of PMA.core instance
pmacoreUsername : Second optional argument(String), default value(""), username for PMA.core instance
pmacorePassword : Third optional argument(String), default value(""), password for PMA.core instance
- Returns:
- session's ID if session was created successfully, otherwise null
-
disconnect
This method is used to disconnect from a running PMA.core instance- Parameters:
varargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- true if there was a PMA.core instance running to disconnect from, false otherwise
-
ping
This method is used to test if sessionID is valid and the server is online and reachable This method works only for PMA.core, don't use it for PMA.start for it will return always false- Parameters:
varargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- true if sessionID is valid and the server is online and reachable, false otherwise
-
getRootDirectories
This method is used to get root-directories available for a sessionID- Parameters:
varargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Array of root-directories available to a session's ID
-
getDirectories
This method is used to get sub-directories available to sessionID in the start directory following a recursive (or not) approach- Parameters:
startDir
- Start directoryvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
recursivity : Second optional argument(Boolean or Integer), default value(Boolean, false), if it's a Boolean if defines either no recursivity or a limitless recursivity, if it's an Integer it defines a limited in depth recursivity or no recursivity at all if this Integer equals 0
- Returns:
- Sub-directories available to a session's ID in a start directory
-
getFirstNonEmptyDirectory
This method is used to get the first non empty directory- Parameters:
varargs
- Array of optional argumentsstartDir : First optional argument(String), default value(null), start directory
sessionID : Second optional argument(String), default value(null), session's ID
- Returns:
- Path to the first non empty directory found
-
getSlides
This method is used to get a list of slides available to sessionID in the start directory following a recursive (or not) approach- Parameters:
startDir
- Start directoryvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
recursivity : Second optional argument(Boolean or Integer), default value(Boolean, false), if it's a Boolean if defines either no recursivity or a limitless recursivity, if it's an Integer it defines a limited in depth recursivity or no recursivity at all if this Integer equals 0
- Returns:
- List of slides available to a session's ID in a start directory
-
getSlideFileExtension
This method is used to determine the file extension for a slide's path- Parameters:
slideRef
- slide's path- Returns:
- File extension extracted from a slide's path
-
getSlideFileName
This method is used to determine file name (with extension) for a slide's path- Parameters:
slideRef
- slide's path- Returns:
- File name extracted from a slide's path
-
getUid
This method is used to get the UID for a defined slide- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- UID for a defined slide's path
- Throws:
Exception
- if PMA.core not found
-
getFingerPrint
This method is used to get the fingerprint for a specific slide- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Fingerprint of the slide
-
whoAmI
This method is used to get information about a session- Parameters:
varargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Information about a session
-
getTileSize
This method is used to get tile size information for sessionID- Parameters:
varargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- A list of two items (duplicated) relative to the tile size information for a session's ID
-
getSlideInfo
This method is used to get a raw image in the form of nested maps- Parameters:
slideRef
- slide's path or UIDvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Nested maps forming a raw image
-
getSlidesInfo
public static Map<String,Map<String, getSlidesInfoObject>> (List<String> slideRefs, String... varargs) This method is used to get raw images in the form of nested maps- Parameters:
slideRefs
- List of slides' path or UIDvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Nested maps forming raw images
-
getMaxZoomLevel
This method is used to determine the maximum zoom level that still represents an optical magnification- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Max zoom level that still represents an optical magnification
-
getZoomLevelsList
This method is used to get list with all zoom levels, from 0 to max zoom level- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
minNumberOfTiles : Second optional argument(Integer), default value(0), minimal number of tiles used to specify that you're only interested in zoom levels that include at least a given number of tiles
- Returns:
- List with all zoom levels, from 0 to max zoom level
-
getZoomLevelsDict
This method is used to get a map with the number of tiles per zoom level- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
minNumberOfTiles : Second optional argument(Integer), default value(0), minimal number of tiles used to specify that you're only interested in zoom levels that include at least a given number of tiles
- Returns:
- Map with the number of tiles per zoom level
-
getPixelsPerMicrometer
This method is used to get the physical dimension in terms of pixels per micrometer of a slide- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentszoomLevel : First optional argument(Integer), default value(null), zoom level
sessionID : Second optional argument(String), default value(null), session's ID
- Returns:
- Two items list containing the physical dimension in terms of pixels per micrometer of a slide
-
getPixelDimensions
This method is used to get the total dimensions of a slide image at a given zoom level- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentszoomLevel : First optional argument(Integer), default value(null), zoom level
sessionID : Second optional argument(String), default value(null), session's ID
- Returns:
- Two items list with the total dimensions of a slide image at a given zoom level
-
getNumberOfTiles
This method is used to determine the number of tiles needed to reconstitute a slide at a given zoom level- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentszoomLevel : First optional argument(Integer), default value(null), zoom level
sessionID : Second optional argument(String), default value(null), session's ID
- Returns:
- Three items list to determine the number of tiles needed to reconstitute a slide at a given zoom level
-
getPhysicalDimensions
This method is used to Determine the physical dimensions of the sample represented by the slide- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Two items list to determine the physical dimensions of the sample represented by the slide
-
getNumberOfChannels
This method is used to get the number of channels for a slide- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Number of channels for a slide (1 when slide is brightfield)
-
getNumberOfLayers
This method is used to get the number of (z-stacked) layers for a slide- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Number of layers for a slide
-
getNumberOfZStackLayers
This method is used to get the number of (z-stacked) layers for a slide- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Number of Z-Stack layers for a slide
-
isFluorescent
This method is used to determine whether a slide is a fluorescent image or not- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- True if slide is a fluorescent image, false otherwise
-
isMultiLayer
This method is used to determine whether a slide contains multiple (stacked) layers or not- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- True if slide contains multiple (stacked) layers, false otherwise
-
getLastModifiedDate
This method is used to convert the slide last modified time stamp into a human readable format- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Slide's last modification date
-
isZStack
This method is used to determine whether a slide is a z-stack or not- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- True if slide is a z-stack, false otherwise
-
getMagnification
This method is used to get the magnification represented at a certain zoom level- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentszoomLevel : First optional argument(Integer), default value(false), zoom level
exact : Second optional argument(Boolean), default value(null), defines if exact or not
sessionID : Third optional argument(String), default value(null), session's ID
- Returns:
- Magnification represented at a certain zoom level
-
getAssociatedImageTypes
This method is used to return the list of image types associated with a slide (thumbnail, barcode...)- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- List of associated image types
-
getBarcodeUrl
This method is used to get the URL that points to the barcode (alias for "label") for a slide- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- URL that points to the barcode (alias for "label") for a slide
-
getBarcodeImage
This method is used to get the barcode (alias for "label") image for a slide- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Barcode (alias for "label") image for a slide
-
getBarcodeText
This method is used to get the text encoded by the barcode- Parameters:
slideRef
- slide's path or UIDvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- The barcode text
-
getLabelUrl
This method is used to get the URL that points to the label for a slide- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Url that points to the label for a slide
-
getLabelImage
This method is used to get the label image for a slide- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Image label for a slide
-
getThumbnailUrl
This method is used to get the URL that points to the thumbnail for a slide- Parameters:
slideRef
- slide's path or UIDvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
height : Second optional argument(Integer), default value(0), height of the requested thumbnail, if value set to 0 it will be ignored
width : Third optional argument(Integer), default value(0), width of the requested thumbnail, if value set to 0 it will be ignored
- Returns:
- URL that points to the thumbnail for a slide
-
getThumbnailImage
This method is used to get the thumbnail image for a slide- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
height : Second optional argument(Integer), default value(0), height of the requested thumbnail, if value set to 0 it will be ignored
width : Third optional argument(Integer), default value(0), width of the requested thumbnail, if value set to 0 it will be ignored
- Returns:
- Image thumbnail for a slide
-
getTileUrl
This method is used to create the url to retrieve a single tile at position (x, y)- Parameters:
slideRef
- slide's path or UIDvarargs
- Array of optional argumentsx : First optional argument(Integer), default value(0), x position
y : Second optional argument(Integer), default value(0), y position
zoomLevel : Third optional argument(Integer), default value(null), zoom level
zStack : Fourth optional argument(Integer), default value(0), Number of z stacks
sessionID : Fifth optional argument(String), default value(null), session's ID
format : Sixth optional argument(String), default value(jpg), image format
quality : Seventh optional argument(Integer), default value(100), quality
- Returns:
- Url to retrieve a single tile at position (x, y)
- Throws:
Exception
- if unable to determine the PMA.core instance the session ID belong to
-
getTile
This method is used to get a single tile at position (x, y)- Parameters:
slideRef
- slide's path or UIDvarargs
- Array of optional argumentsx : First optional argument(Integer), default value(0), x position
y : Second optional argument(Integer), default value(0), y position
zoomLevel : Third optional argument(Integer), default value(null), zoom level
zStack : Fourth optional argument(Integer), default value(0), Number of z stacks
sessionID : Fifth optional argument(String), default value(null), session's ID
format : Sixth optional argument(String), default value(jpg), image format
quality : Seventh optional argument(Integer), default value(100), quality
- Returns:
- Single tile at position (x, y)
- Throws:
Exception
- if unable to determine the PMA.core instance the session ID belong to
-
getRegion
Gets a region of the slide at the specified scale Format can be 'jpg' or 'png' Quality is an integer value and varies from 0 (as much compression as possible; not recommended) to 100 (100%, no compression) x,y,width,height is the region to get rotation is the rotation in degrees of the slide to get- Parameters:
slideRef
- slide's path or UIDvarargs
- Array of optional argumentsx : First optional argument(Integer), default value(0), starting x position
y : Second optional argument(Integer), default value(0), starting y position
width : Third optional argument(Integer), default value(0), ending width position
height : Fourth optional argument(Integer), default value(0), height
scale : Fifth optional argument(Integer), default value(1), scale
zStack : Sixth optional argument(Integer), default value(0), Number of z stacks
sessionID : Seventh optional argument(String), default value(null), session's ID
format : Eighth optional argument(String), default value(jpg), image format
quality : Ninth optional argument(Integer), default value(100), quality
rotation : Tenth optional argument(Integer), default value(0), rotation
contrast : Eleventh optional argument(Integer), default value(null), contrast
brightness : Twelfth optional argument(Integer), default value(null), brightness
dpi : Thirteenth optional argument(Integer), default value(300), dpi
flipVertical : Fourteenth optional argument(Boolean), default value(false), flip vertical
flipHorizontal : Fifteenth optional argument(Boolean), default value(false), flip horizontal
annotationsLayerType : Sixteenth optional argument(String), default value(null), annotations layer type
drawFilename : Seventeenth optional argument(Integer), default value(0), draw filename
downloadInsteadOfDisplay : Eighteenth optional argument(Boolean), default value(false), download instead of display
drawScaleBar : Nineteenth optional argument(Boolean), default value(false), draw scale bar
gamma : Twentieth optional argument(ArrayList), default value([]), gamma
channelClipping : Twenty-first optional argument(ArrayList), default value([]), channel clipping
- Returns:
- Gets a region of the slide at the specified scale
-
getRegionUrl
This method is used to create the url to retrieve a region of the slide at the specified scale (x,y,width,height)- Parameters:
slideRef
- slide's path or UIDvarargs
- Array of optional argumentsx : First optional argument(Integer), default value(0), starting x position
y : Second optional argument(Integer), default value(0), starting y position
width : Third optional argument(Integer), default value(0), ending width position
height : Fourth optional argument(Integer), default value(0), height
scale : Fifth optional argument(Integer), default value(1), scale
zStack : Sixth optional argument(Integer), default value(0), Number of z stacks
sessionID : Seventh optional argument(String), default value(null), session's ID
format : Eighth optional argument(String), default value(jpg), image format
quality : Ninth optional argument(Integer), default value(100), quality
rotation : Tenth optional argument(Integer), default value(0), rotation
contrast : Eleventh optional argument(Integer), default value(null), contrast
brightness : Twelfth optional argument(Integer), default value(null), brightness
dpi : Thirteenth optional argument(Integer), default value(300), dpi
flipVertical : Fourteenth optional argument(Boolean), default value(false), flip vertical
flipHorizontal : Fifteenth optional argument(Boolean), default value(false), flip horizontal
annotationsLayerType : Sixteenth optional argument(String), default value(null), annotations layer type
drawFilename : Seventeenth optional argument(Integer), default value(0), draw filename
downloadInsteadOfDisplay : Eighteenth optional argument(Boolean), default value(false), download instead of display
drawScaleBar : Nineteenth optional argument(Boolean), default value(false), draw scale bar
gamma : Twentieth optional argument(ArrayList), default value([]), gamma
channelClipping : Twenty-first optional argument(ArrayList), default value([]), channel clipping
- Returns:
- Url to retrieve a region at position (x, y, width, height)
- Throws:
Exception
- if unable to determine the PMA.core instance the session ID belong to
-
getTiles
This method is used to get all tiles with a (fromX, fromY, toX, toY) rectangle- Parameters:
slideRef
- slide's path or UIDvarargs
- Array of optional argumentsfromX : First optional argument(Integer), default value(0), starting x position
fromY : Second optional argument(Integer), default value(0), starting y position
toX : Third optional argument(Integer), default value(0), ending x position
toY : Fourth optional argument(Integer), default value(0), ending y position
zoomLevel : Fifth optional argument(Integer), default value(null), zoom level
zStack : Sixth optional argument(Integer), default value(0), Number of z stacks
sessionID : Seventh optional argument(String), default value(null), session's ID
format : Eigth optional argument(String), default value(jpg), image format
quality : Ninth optional argument(Integer), default value(100), quality
- Returns:
- All tiles with a (fromX, fromY, toX, toY) rectangle
-
getSubmittedForms
This method is used to find out what forms where submitted for a specific slide- Parameters:
slideRef
- slide's path or UIDvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Map of forms submitted for a defined slide
-
getSubmittedFormData
This method is used to get submitted forms data in json Array format- Parameters:
slideRef
- slide's path or UIDvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Submitted forms data in json Array format
-
prepareFormMap
This method is used to prepare a form-dictionary that can be used later on to submit new form data for a slide- Parameters:
formID
- Form's IDvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Form-map that can be used later on to submit new form data for a slide
-
getAvailableForms
This method is used to get a Map of the forms available to fill out, either system-wide (leave slideref to "null"), or for a particular slide- Parameters:
varargs
- Array of optional argumentsslideRef : First optional argument(String), default value(null), slide's path
sessionID : Second optional argument(String), default value(null), session's ID
- Returns:
- Map of the forms available to fill out, either system-wide (leave slideref to "null"), or for a particular slide
-
submitFormData
public static String submitFormData(String slideRef, String formID, String formMap, String... varargs) To be elaborated later- Parameters:
slideRef
- To be elaborated laterformID
- To be elaborated laterformMap
- To be elaborated latervarargs
- To be elaborated later- Returns:
- To be elaborated later
-
add_Annotations
public static org.json.JSONArray add_Annotations(String sessionID, String pathOrUid, String classification, int layerID, String notes, String geometry, String color) throws Exception This method is used to add the annotations for slide- Parameters:
sessionID
- session's IDpathOrUid
- slide's pathclassification
- slide's classificationlayerID
- slide's layer idnotes
- "Annotation" + number or app name.geometry
- annotation's geometrycolor
- annotation's color- Throws:
Exception
-
getAnnotations
This method is used to retrieve the annotations for slide slideRef- Parameters:
slideRef
- slide's pathvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Annotations for a slide in a json Array format
-
clear_annotations
public static boolean clear_annotations(String slideRef, int layerID, String sessionID) throws Exception This method is used to delete all the annotations for slide- Parameters:
slideRef
- slide's pathlayerID
- slide's layer idsessionID
- session's ID- Throws:
Exception
-
showSlide
This method is used to launch the default web browser and load a web-based viewer for the slide- Parameters:
slideRef
- slide's path or UIDvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Throws:
Exception
- if unable to determine the PMA.core instance the session ID belongs to
-
getFilesForSlide
This method is used to map of files related to a slide- Parameters:
slideRef
- slide's path or UIDvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- Map of all files related to a slide
-
enumerateFilesForSlide
This method is used to get list of files related to a slide for PMA.start ONLY- Parameters:
slideRef
- slide's path or UIDvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- List of all files related to a selected slide for PMA.start ONLY
-
enumerateFilesForSlidePMACore
public static List<Map<String,String>> enumerateFilesForSlidePMACore(String slideRef, String... varargs) This method is used to get list of files related to a slide for PMA.core ONLY- Parameters:
slideRef
- slide's path or UIDvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- List of all files related to a selected slide for PMA.core ONLY
-
searchSlides
public static List<String> searchSlides(String startDir, String pattern, String... varargs) throws Exception This method is used to search for slides in a directory that satisfy a certain search pattern- Parameters:
startDir
- Start directorypattern
- Search patternvarargs
- Array of optional argumentssessionID : First optional argument(String), default value(null), session's ID
- Returns:
- List of slides in a directory that satisfy a certain search pattern
- Throws:
Exception
- If called on PMA.start
-
download
* This method downloads single slide and multipart slide.
param varargs:0: mainSlideFile is full path of the slide. Is a required income parameter!
1: saveDirectory is a directory where slide will be saved. Is a required income parameter!
2: sessionID Is a required income parameter!
3: callback to return readable bytes. Optional parameter.
The parameter is used to read the bytes to be downloaded,
callback must be null if not needed.
4: relativePath optional parameter, used when downloading files that include a folder and subfolders with compound files one by one.
In this case, the folders and subfolders must be prepared in advance before the download method,
and the saveDirectory parameter must be the full path including the folders, subfolders, file, and extension.
- Returns:
- true if download is done.
Callback usage model:
ProgressHttpEntityWrapper.ProgressCallback progressCallback = new ProgressHttpEntityWrapper.ProgressCallback() {
public void progress(long bytesRead, long transferred, long totalBytes, String filename) {
bytesRead - readable bytes
transferred - total in %
totalBytes - += bytesRead
filename - name of downloaded file
}
};
Core.download(***); - Throws:
Exception
- if incoming parameters are not valid
-
upload
public static boolean upload(String localSourceSlide, String targetFolder, String sessionID, ProgressHttpEntityWrapper.ProgressCallback progressCallback, Object... varargs) throws Exception Uploads a slide to a PMA.core server. Requires a PMA.start installation :param str localSourceSlide: The local PMA.start relative file to upload :param str targetFolder: The root directory and path to upload to the PMA.core server :param str sessionID: A valid session id for a PMA.core :param function callback: If True a default progress will be printed. If a function is passed it will be called for progress on each file upload. The function has the following signature: `callback(float progress)`- Parameters:
localSourceSlide
- this is the full path of the slide including the extension.targetFolder
- this is the full path to the remote folder to a PMA.core server.sessionID
- is a required income parameter!progressCallback
- optional parameter. The parameter is used to read the bytes to be uploaded, it must be null if not needed.varargs
- optional parameter.if varargs is null this method uploads all files from multipart slide like .vsi and .mrxs.
To load multipart slides file by file, you need to fill in the following varargs parameters:
0 - relativePath is full path of file
1 - URL is upload url
2 - uploadID is generated ID for upload
3 - uploadType is generated type for upload
4 - uploadFile is file which one will be uploaded- Returns:
- true if upload is done
Callback usage model:
ProgressHttpEntityWrapper.ProgressCallback progressCallback = new ProgressHttpEntityWrapper.ProgressCallback() {
public void progress(long bytesRead, long transferred, long totalBytes, String filename) {
bytesRead - readable bytes
transferred - total in %
totalBytes - += bytesRead
filename - name of downloaded file
}
};
Core.upload(***); - Throws:
Exception
-
_pma_filesToUpload
public static List<HashMap<String,String>> _pma_filesToUpload(String localSourceSlide, String targetFolder, String sessionID) This method will check the remote folder for a slide with the same name and search in the local folder for files that are related to the slide entered in the input parameters.- Parameters:
localSourceSlide
-targetFolder
-sessionID
-- Returns:
- uploadFiles
-
_pma_get_DataIdTypeConString_forUpload
public static org.json.JSONObject _pma_get_DataIdTypeConString_forUpload(String localSourceSlide, String targetFolder, String sessionID) This method is for getting JSON data: uploadID, upload type and upload URLs.- Parameters:
localSourceSlide
-targetFolder
-sessionID
-- Returns:
- jsonResponse
-
addServer
This method returns a boolean result based on the input parameters.- Parameters:
sessionId
-url
-length
-- Returns:
- boolean
-
sessions
This method returns pmaSessions.- Returns:
- pmaSessions
-
connectToCloud
This method connect to cloud with json data.- Parameters:
username
-password
-- Returns:
- cloudServerData
-
postItem
This method makes DataOutputStream connection to send data to cloud.- Parameters:
url
-payload
-- Returns:
- response String
-
getCloudAuth
This method make authorization with token to connect cloud- Parameters:
accessToken
-- Returns:
- response String
-
getJSONResponse
This method reads and returns the input json data- Parameters:
value
-- Returns:
- jsonResponse
-
getJSONAsStringBuffer
- Parameters:
con
- url to retrieve JSON from- Returns:
- StringBuffer Json result
-
isJSONObject
- Parameters:
value
- json returned as String- Returns:
- Boolean true if it's a JSONObject, false if it's an Array
-
getJSONArrayResponse
This method is used to get a JSONArray from a String argument- Parameters:
value
- String argument- Returns:
- JSONArray converts String argument to JSONArray
-