Class Channels

java.lang.Object
qupath.ext.biop.utils.Channels

public class Channels extends Object
Channels class to handle loading and saving channel settings It can modify channels based on either a simple text file or a string of the type position, name, color, minDisplay, maxDisplay eg.
1, First, #0300ff, 0, 100
 3, Third, #ff3300, 10, 1200
Also includes the possibility to save the settings to a textfile in the above format.
  • Constructor Details

    • Channels

      public Channels()
  • Method Details

    • setChannelSettings

      public static void setChannelSettings(File settingsFile)
      Set the channels directly from a text file
      Parameters:
      settingsFile - the file containing the channel settings, generally produced using writeChannelSettings(List, File)
    • setChannelSettings

      public static void setChannelSettings(List<qupath.ext.biop.utils.Channels.Channel> channels)
      This method actually sets the channel displays based on the channels list.
      Parameters:
      channels - the list of channels, created with readChannelSettings(File), getCurrentChannelSettings() or readChannelSettings(String)
    • getCurrentChannelSettings

      public static List<qupath.ext.biop.utils.Channels.Channel> getCurrentChannelSettings()
      Return the current channel names, colors and minMax displays to a list NOTE: Channels that are not currently selected will not be sent
      Returns:
      a list that can be used with or Channels#setChannelSettings(List)
    • readChannelSettings

      public static List<qupath.ext.biop.utils.Channels.Channel> readChannelSettings(String settingsString)
      Read the parameters of a simple string with each line formatted as: position, name, color, minDisplay, maxDisplay eg.
      1, One channel, #0300ff, 0, 100
       3, Another channel, #ff3300, 10, 1200
      Parameters:
      settingsString - a manually created String
      Returns:
      a list that can be used with or Channels#setChannelSettings(List)
    • readChannelSettings

      public static List<qupath.ext.biop.utils.Channels.Channel> readChannelSettings(File settingsFile) throws FileNotFoundException
      Read the settings from a simple text file, generally made using writeChannelSettings(List, File) but could also be made manually
      Parameters:
      settingsFile - the file with the settings.
      Returns:
      a list that can be used with or Channels#setChannelSettings(List)
      Throws:
      FileNotFoundException - in case the file does not exist
    • writeChannelSettings

      public static void writeChannelSettings(List<qupath.ext.biop.utils.Channels.Channel> channelSettings, File settingsFile) throws IOException
      Write the provided Channels to a file
      Parameters:
      channelSettings - settings, obtained using readChannelSettings(String), readChannelSettings(File) or getCurrentChannelSettings()
      settingsFile - a file that will be created or overwritten with the settings converted to text.
      Throws:
      IOException - in case the file cannot be written