Package qupath.ext.biop.utils
Class Channels
- java.lang.Object
-
- qupath.ext.biop.utils.Channels
-
public class Channels extends java.lang.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 Summary
Constructors Constructor Description Channels()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.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 sentstatic java.util.List<qupath.ext.biop.utils.Channels.Channel>
readChannelSettings(java.io.File settingsFile)
Read the settings from a simple text file, generally made usingwriteChannelSettings(List, File)
but could also be made manuallystatic java.util.List<qupath.ext.biop.utils.Channels.Channel>
readChannelSettings(java.lang.String settingsString)
Read the parameters of a simple string with each line formatted as: position, name, color, minDisplay, maxDisplay eg.static void
setChannelSettings(java.io.File settingsFile)
Set the channels directly from a text filestatic void
setChannelSettings(java.util.List<qupath.ext.biop.utils.Channels.Channel> channels)
This method actually sets the channel displays based on the channels list.static void
writeChannelSettings(java.util.List<qupath.ext.biop.utils.Channels.Channel> channelSettings, java.io.File settingsFile)
Write the provided Channels to a file
-
-
-
Method Detail
-
setChannelSettings
public static void setChannelSettings(java.io.File settingsFile)
Set the channels directly from a text file- Parameters:
settingsFile
- the file containing the channel settings, generally produced usingwriteChannelSettings(List, File)
-
setChannelSettings
public static void setChannelSettings(java.util.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 withreadChannelSettings(File)
,getCurrentChannelSettings()
orreadChannelSettings(String)
-
getCurrentChannelSettings
public static java.util.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 {@link Channels#setChannelSettings(List)}
-
readChannelSettings
public static java.util.List<qupath.ext.biop.utils.Channels.Channel> readChannelSettings(java.lang.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 {@link Channels#setChannelSettings(List)}
-
readChannelSettings
public static java.util.List<qupath.ext.biop.utils.Channels.Channel> readChannelSettings(java.io.File settingsFile) throws java.io.FileNotFoundException
Read the settings from a simple text file, generally made usingwriteChannelSettings(List, File)
but could also be made manually- Parameters:
settingsFile
- the file with the settings.- Returns:
- a list that can be used with
or {@link Channels#setChannelSettings(List)}
- Throws:
java.io.FileNotFoundException
- in case the file does not exist
-
writeChannelSettings
public static void writeChannelSettings(java.util.List<qupath.ext.biop.utils.Channels.Channel> channelSettings, java.io.File settingsFile) throws java.io.IOException
Write the provided Channels to a file- Parameters:
channelSettings
- settings, obtained usingreadChannelSettings(String)
,readChannelSettings(File)
orgetCurrentChannelSettings()
settingsFile
- a file that will be created or overwritten with the settings converted to text.- Throws:
java.io.IOException
- in case the file cannot be written
-
-