Class Core

java.lang.Object
com.pathomation.Core

public class Core extends Object

Java SDK

Java wrapper library for PMA.start, a universal viewer for whole slide imaging and microscopy

  • Field Details

    • bytes

      public static BlockingQueue<Long> bytes
      Readable bytes for upload and download methods. To integrate into the progress bar.
  • Constructor Details

    • Core

      public Core()
  • Method Details

    • getPmaSessions

      public static Map<String,Object> getPmaSessions()
      Returns:
      the pmaSessions
    • getPmaUsernames

      public static Map<String,String> getPmaUsernames()
      Returns:
      the pmaUsernames
    • getPmaSlideInfos

      public static Map<String,Object> getPmaSlideInfos()
      Returns:
      the pmaSlideInfos
    • getPmaCoreLiteURL

      public static String getPmaCoreLiteURL()
      Returns:
      the pmaCoreLiteURL
    • getPmaCoreLiteSessionID

      public static String getPmaCoreLiteSessionID()
      Returns:
      the pmaCoreLiteSessionID
    • getPmaAmountOfDataDownloaded

      public static Map<String,Integer> 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

      public static String pmaUrl(String... varargs) throws Exception
      This method is used to get the url related to the session's ID
      Parameters:
      varargs - Array of optional arguments

      sessionID : 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

      public static String urlReader(String url)
      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

      public static Document domParser(String s)
      This method is used to parse a XML content
      Parameters:
      s - XML content to parse
      Returns:
      Document parsed XML
    • getSessions

      public static org.json.JSONArray getSessions(String pmaControlURL, String pmaCoreSessionID)
      This method is used to get the list of sessions
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmaCoreSessionID - PMA.core session ID
      Returns:
      JSONArray containing the list of sessions
    • getSessionIds

      public static Map<String,Map<String,String>> getSessionIds(String pmaControlURL, String pmaCoreSessionID)
      This method is used to get the list of sessions' IDs
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmaCoreSessionID - PMA.core session ID
      Returns:
      Mapinvalid input: '<'String, Mapinvalid input: '<'String, String>> containing the sessions' IDs
    • getCaseCollections

      public static org.json.JSONArray getCaseCollections(String pmaControlURL, String pmaCoreSessionID)
      This method is used to get case collections
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmaCoreSessionID - PMA.core session ID
      Returns:
      JSONArray containing the list of case sessions
    • getProjects

      public static org.json.JSONArray getProjects(String pmaControlURL, String pmaCoreSessionID)
      This method is used to get the list of projects
      Parameters:
      pmaControlURL - URL for PMA.Control
      pmaCoreSessionID - PMA.core session ID
      Returns:
      JSONArray containing the list of projects
    • queryUrl

      public static String queryUrl(String... varargs)
      This method is used to create the query URL for a session ID
      Parameters:
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      Query URL
    • isLite

      public static Boolean isLite(String... varargs)
      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 arguments

      pmaCoreURL : 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

      public static String getVersionInfo(String... varargs)
      This method is used to get the version number
      Parameters:
      varargs - Array of optional arguments

      pmaCoreURL : First optional argument(String), default value(Class field pmaCoreLiteURL), url of PMA.core instance

      Returns:
      Version number
    • getVersionInfoPmaControl

      public static org.json.JSONObject getVersionInfoPmaControl(String pmaControlURL)
      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

      public static String getBuildRevision(String... varargs)
      This method is used to get the version number
      Parameters:
      varargs - Array of optional arguments

      pmaCoreURL : First optional argument(String), default value(Class field pmaCoreLiteURL), url of PMA.core instance

      Returns:
      Version number
    • getAPIVersion

      public static List<Integer> getAPIVersion(String... varargs) throws Exception
      This method is used to get the API version in a list fashion
      Parameters:
      varargs - Array of optional arguments

      pmacoreURL : 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

      public static String getAPIVersionString(String... varargs) throws Exception
      This method is used to get the API version in a single string
      Parameters:
      varargs - Array of optional arguments

      pmacoreURL : 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

      public static String connect(String... varargs)
      This method is used to authenticate & connect to a PMA.core instance using credentials
      Parameters:
      varargs - Array of optional arguments

      pmacoreURL : 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

      public static Boolean disconnect(String... varargs)
      This method is used to disconnect from a running PMA.core instance
      Parameters:
      varargs - Array of optional arguments

      sessionID : 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

      public static boolean ping(String... varargs)
      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 arguments

      sessionID : 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

      public static List<String> getRootDirectories(String... varargs)
      This method is used to get root-directories available for a sessionID
      Parameters:
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      Array of root-directories available to a session's ID
    • getDirectories

      public static List<String> getDirectories(String startDir, Object... varargs)
      This method is used to get sub-directories available to sessionID in the start directory following a recursive (or not) approach
      Parameters:
      startDir - Start directory
      varargs - Array of optional arguments

      sessionID : 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

      public static String getFirstNonEmptyDirectory(String... varargs)
      This method is used to get the first non empty directory
      Parameters:
      varargs - Array of optional arguments

      startDir : 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

      public static List<String> getSlides(String startDir, Object... varargs)
      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 directory
      varargs - Array of optional arguments

      sessionID : 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

      public static String getSlideFileExtension(String slideRef)
      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

      public static String getSlideFileName(String slideRef)
      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

      public static String getUid(String slideRef, String... varargs) throws Exception
      This method is used to get the UID for a defined slide
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : 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

      public static String getFingerPrint(String slideRef, String... varargs)
      This method is used to get the fingerprint for a specific slide
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      Fingerprint of the slide
    • whoAmI

      public static Map<String,String> whoAmI(String... varargs)
      This method is used to get information about a session
      Parameters:
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      Information about a session
    • getTileSize

      public static List<Integer> getTileSize(String... varargs)
      This method is used to get tile size information for sessionID
      Parameters:
      varargs - Array of optional arguments

      sessionID : 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

      public static Map<String,Object> getSlideInfo(String slideRef, String... varargs)
      This method is used to get a raw image in the form of nested maps
      Parameters:
      slideRef - slide's path or UID
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      Nested maps forming a raw image
    • getSlidesInfo

      public static Map<String,Map<String,Object>> getSlidesInfo(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 UID
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      Nested maps forming raw images
    • getMaxZoomLevel

      public static int getMaxZoomLevel(String slideRef, String... varargs)
      This method is used to determine the maximum zoom level that still represents an optical magnification
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      Max zoom level that still represents an optical magnification
    • getZoomLevelsList

      public static List<Integer> getZoomLevelsList(String slideRef, Object... varargs)
      This method is used to get list with all zoom levels, from 0 to max zoom level
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : 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

      public static Map<Integer,List<Integer>> getZoomLevelsDict(String slideRef, Object... varargs)
      This method is used to get a map with the number of tiles per zoom level
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : 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

      public static List<Float> getPixelsPerMicrometer(String slideRef, Object... varargs)
      This method is used to get the physical dimension in terms of pixels per micrometer of a slide
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      zoomLevel : 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

      public static List<Integer> getPixelDimensions(String slideRef, Object... varargs)
      This method is used to get the total dimensions of a slide image at a given zoom level
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      zoomLevel : 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

      public static List<Integer> getNumberOfTiles(String slideRef, Object... varargs)
      This method is used to determine the number of tiles needed to reconstitute a slide at a given zoom level
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      zoomLevel : 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

      public static List<Float> getPhysicalDimensions(String slideRef, String... varargs)
      This method is used to Determine the physical dimensions of the sample represented by the slide
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : 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

      public static int getNumberOfChannels(String slideRef, String... varargs)
      This method is used to get the number of channels for a slide
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      Number of channels for a slide (1 when slide is brightfield)
    • getNumberOfLayers

      public static int getNumberOfLayers(String slideRef, String... varargs)
      This method is used to get the number of (z-stacked) layers for a slide
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      Number of layers for a slide
    • getNumberOfZStackLayers

      public static int getNumberOfZStackLayers(String slideRef, String... varargs)
      This method is used to get the number of (z-stacked) layers for a slide
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      Number of Z-Stack layers for a slide
    • isFluorescent

      public static Boolean isFluorescent(String slideRef, String... varargs)
      This method is used to determine whether a slide is a fluorescent image or not
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      True if slide is a fluorescent image, false otherwise
    • isMultiLayer

      public static Boolean isMultiLayer(String slideRef, String... varargs)
      This method is used to determine whether a slide contains multiple (stacked) layers or not
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      True if slide contains multiple (stacked) layers, false otherwise
    • getLastModifiedDate

      public static String getLastModifiedDate(String slideRef, String... varargs)
      This method is used to convert the slide last modified time stamp into a human readable format
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      Slide's last modification date
    • isZStack

      public static Boolean isZStack(String slideRef, String... varargs)
      This method is used to determine whether a slide is a z-stack or not
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      True if slide is a z-stack, false otherwise
    • getMagnification

      public static int getMagnification(String slideRef, Object... varargs)
      This method is used to get the magnification represented at a certain zoom level
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      zoomLevel : 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

      public static List<String> getAssociatedImageTypes(String slideRef, String... varargs)
      This method is used to return the list of image types associated with a slide (thumbnail, barcode...)
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      List of associated image types
    • getBarcodeUrl

      public static String getBarcodeUrl(String slideRef, String... varargs)
      This method is used to get the URL that points to the barcode (alias for "label") for a slide
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      URL that points to the barcode (alias for "label") for a slide
    • getBarcodeImage

      public static Image getBarcodeImage(String slideRef, String... varargs)
      This method is used to get the barcode (alias for "label") image for a slide
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      Barcode (alias for "label") image for a slide
    • getBarcodeText

      public static String getBarcodeText(String slideRef, String... varargs)
      This method is used to get the text encoded by the barcode
      Parameters:
      slideRef - slide's path or UID
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      The barcode text
    • getLabelUrl

      public static String getLabelUrl(String slideRef, String... varargs)
      This method is used to get the URL that points to the label for a slide
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      Url that points to the label for a slide
    • getLabelImage

      public static Image getLabelImage(String slideRef, String... varargs)
      This method is used to get the label image for a slide
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      Image label for a slide
    • getThumbnailUrl

      public static String getThumbnailUrl(String slideRef, Object... varargs)
      This method is used to get the URL that points to the thumbnail for a slide
      Parameters:
      slideRef - slide's path or UID
      varargs - Array of optional arguments

      sessionID : 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

      public static Image getThumbnailImage(String slideRef, Object... varargs)
      This method is used to get the thumbnail image for a slide
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : 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

      public static String getTileUrl(String slideRef, Object... varargs) throws Exception
      This method is used to create the url to retrieve a single tile at position (x, y)
      Parameters:
      slideRef - slide's path or UID
      varargs - Array of optional arguments

      x : 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

      public static Image getTile(String slideRef, Object... varargs) throws Exception
      This method is used to get a single tile at position (x, y)
      Parameters:
      slideRef - slide's path or UID
      varargs - Array of optional arguments

      x : 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

      public static Image getRegion(String slideRef, Object... varargs)
      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 UID
      varargs - Array of optional arguments

      x : 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

      public static String getRegionUrl(String slideRef, Object... varargs) throws Exception
      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 UID
      varargs - Array of optional arguments

      x : 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

      public static Stream getTiles(String slideRef, Object... varargs)
      This method is used to get all tiles with a (fromX, fromY, toX, toY) rectangle
      Parameters:
      slideRef - slide's path or UID
      varargs - Array of optional arguments

      fromX : 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

      public static Map<String,String> getSubmittedForms(String slideRef, String... varargs)
      This method is used to find out what forms where submitted for a specific slide
      Parameters:
      slideRef - slide's path or UID
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      Map of forms submitted for a defined slide
    • getSubmittedFormData

      public static org.json.JSONArray getSubmittedFormData(String slideRef, String... varargs)
      This method is used to get submitted forms data in json Array format
      Parameters:
      slideRef - slide's path or UID
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      Submitted forms data in json Array format
    • prepareFormMap

      public static Map<String,String> 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 slide
      Parameters:
      formID - Form's ID
      varargs - Array of optional arguments

      sessionID : 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

      public static Map<String,String> 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 slide
      Parameters:
      varargs - Array of optional arguments

      slideRef : 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 later
      formID - To be elaborated later
      formMap - To be elaborated later
      varargs - 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 ID
      pathOrUid - slide's path
      classification - slide's classification
      layerID - slide's layer id
      notes - "Annotation" + number or app name.
      geometry - annotation's geometry
      color - annotation's color
      Throws:
      Exception
    • getAnnotations

      public static org.json.JSONArray getAnnotations(String slideRef, String... varargs)
      This method is used to retrieve the annotations for slide slideRef
      Parameters:
      slideRef - slide's path
      varargs - Array of optional arguments

      sessionID : 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 path
      layerID - slide's layer id
      sessionID - session's ID
      Throws:
      Exception
    • showSlide

      public static void showSlide(String slideRef, String... varargs) throws Exception
      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 UID
      varargs - Array of optional arguments

      sessionID : 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

      public static Map<String,Map<String,String>> getFilesForSlide(String slideRef, String... varargs)
      This method is used to map of files related to a slide
      Parameters:
      slideRef - slide's path or UID
      varargs - Array of optional arguments

      sessionID : First optional argument(String), default value(null), session's ID

      Returns:
      Map of all files related to a slide
    • enumerateFilesForSlide

      public static List<String> enumerateFilesForSlide(String slideRef, String... varargs)
      This method is used to get list of files related to a slide for PMA.start ONLY
      Parameters:
      slideRef - slide's path or UID
      varargs - Array of optional arguments

      sessionID : 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 UID
      varargs - Array of optional arguments

      sessionID : 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 directory
      pattern - Search pattern
      varargs - Array of optional arguments

      sessionID : 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

      public static boolean download(Object... varargs) throws Exception
      * 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

      public static Boolean addServer(String sessionId, String url, int length)
      This method returns a boolean result based on the input parameters.
      Parameters:
      sessionId -
      url -
      length -
      Returns:
      boolean
    • sessions

      public static Map<String,Object> sessions()
      This method returns pmaSessions.
      Returns:
      pmaSessions
    • connectToCloud

      public static CloudServerData connectToCloud(String username, String password)
      This method connect to cloud with json data.
      Parameters:
      username -
      password -
      Returns:
      cloudServerData
    • postItem

      public static String postItem(String url, String payload)
      This method makes DataOutputStream connection to send data to cloud.
      Parameters:
      url -
      payload -
      Returns:
      response String
    • getCloudAuth

      public static String getCloudAuth(String accessToken)
      This method make authorization with token to connect cloud
      Parameters:
      accessToken -
      Returns:
      response String
    • getJSONResponse

      public static org.json.JSONObject getJSONResponse(String value)
      This method reads and returns the input json data
      Parameters:
      value -
      Returns:
      jsonResponse
    • getJSONAsStringBuffer

      public static StringBuffer getJSONAsStringBuffer(HttpURLConnection con)
      Parameters:
      con - url to retrieve JSON from
      Returns:
      StringBuffer Json result
    • isJSONObject

      public static Boolean isJSONObject(String value)
      Parameters:
      value - json returned as String
      Returns:
      Boolean true if it's a JSONObject, false if it's an Array
    • getJSONArrayResponse

      public static org.json.JSONArray getJSONArrayResponse(String value)
      This method is used to get a JSONArray from a String argument
      Parameters:
      value - String argument
      Returns:
      JSONArray converts String argument to JSONArray