Phriction Projects Wikis Bioimaging And Optics Platform Image Processing QuPath BIOP Tools QuPath Extension History Version 5 vs 6
Version 5 vs 6
Version 5 vs 6
Content Changes
Content Changes
= Description =
This extension, with source located at rQPEBIOP is the current 'fourre-tout' for all the new features we are currently implementing for QuPath to make our users' lives simpler.
== Requirements ==
Because some features (Like saving display settigns) were not programmer-accessible (`private`), we had to modify QuPath's code. Which is why most features are only available if you are running *QuPath v0.1.4**.
== Installation ==
Once you have QuPath installed, you can copy the `BIOPTools` jar file from
`\\svfas6.epfl.ch\biop\public\0 - BIOP Data\0-Install\QuPath\QuPath\Extensions`
`smb://svfas6.epfl.ch/biop/public/0 - BIOP Data/0-Install/QuPath/QuPath/Extensions`
= Contents ==
== Commands ==
The Extension includes the following commands
=== {nav BIOP > Display Settings... > Save current display settings to file... } ===
Asks the user for a location and a file name to save the current display settings (Brightness & Contast, active channels, channel colors) of the currently opened image) as a JSON file, which can be reused by the command below
=== {nav BIOP > Display Settings... > Load display settings from file... } ===
Asks the user a JSON file created with the command above. This sets the display settings of the current image ot those defined in the file.
=== {nav BIOP > Display Settings... >Apply display settings to similar images in projects} ===
Will apply the currently active Brightness & Contast, active channels and channel colors to all images to of the project as long as
# they share the same number of channels
# they have the same image type (Fluorescence, probably)
= Shortcuts and easier ways to access common QuPath functions in scripts =
Using rQPEBIOP
== Utils Class ==
This class contains general things useful in QuPath
=== Get Pixel Size ===
```lang=java
import ch.epfl.biop.qupath.utils.*
def px_size = Utils.getPixelSize()
```
=== Send Results to a File ===
```lang=java
import ch.epfl.biop.qupath.utils.*
// Define the measurements you want to send over
def results = [ "Nucleus: Area", "Nucleus: DAB OD mean", "Parent", "Class", "Name" ]
// Define the object you want to send
def cells = getCellObjects()
// Define the file and directory where you want to save the results
def resDir = buildFilePath(PROJECT_BASE_DIR, 'results')
mkdirs( resDir )
def resFile = new File( resDir, 'average_distances.csv' )
// Finally send the results. This method will append the image name as the first column
Utils.sendResultsToFile( measurements, cells, resFile )
// If you just want the results to end in `PROJECT_BASE_DIR/results/results.txt` you can use
Utils.sendResultsToFile( measurements, cells )
// If you want to send all results to `PROJECT_BASE_DIR/results/results.txt` you can use
Utils.sendResultsToFile( cells )
```
== Get the full measurements table ==
```lang=java
// Choose the objects for which you want the measurements
def path_objects = getAllObjects()
// Get the Measurements
def measurements = Utils.getAllMeasurements( path_objects )
// Access any measurement that appears in the 'Show annotation measurements' or 'Show detection measurements'
def area = measurements.getNumericValue( one_object, "Area µm2")
// This works with Area, Num Detections, etc
```
== PathUtils Class ==
This class has to do with operations on PathObjects
=== Get Area of a ROI ===
```lang=java
import ch.epfl.biop.qupath.utils.*
def object = getSelectedObject()
PathUtils.getAreaMicrons( object )
PathUtils.getArea( object )
```
== GUIUtils Class ==
=== Get an ImagePlus ===
```lang=java
import ch.epfl.biop.qupath.utils.*
def object = getSelectedObject()
// Get full ImagePlus
def imp = GUIUtils.getImagePlus( object, downsample, sendPathObjectAsRoi, sendChildObjectsInOverlay )
// Get a specific channel or series of channels
def channels = ["Channel 1, "Channel 3"] // Same names as in the 'Adjust Brightness And Contrast' menu
def imp = GUIUtils.getImagePlus( object, downsample, sendPathObjectAsRoi, sendChildObjectsInOverlay, channels )
// For Brightfield, you can only get one channel at a time
def imp_dab = GUIUtils.getImagePlus( object, downsample, sendPathObjectAsRoi, sendChildObjectsInOverlay, ["DAB"] ) // note the [ ], if you give it more channels it only returns the first one
```
=== Get/ Set Min And Max for Channels ===
```lang=java
import ch.epfl.biop.qupath.utils.*
// Channel number is 1-based
def channel = 1
def minmax = GUIUtils.getChannelMinMax( channel ) // min is in minmax[0] and max in minmax[1]
// By channel name
def channel_name = "DAB"
def minmax = GUIUtils.getChannelMinMax( channel_name )
GUIUtils.setChannelMinMax(1, 10.0, 3000.0 )
// or
GUIUtils.setChannelMinMax("DAB", 0.0, 1.0 )
```
=== Set Channel Visibility ==
```lang=java
import ch.epfl.biop.qupath.utils.*
GUIUtils.setActiveChannels( [1,3,4] )
// or
GUIUtils.setActiveChannelsbyName( ["Channel 1, "Channel 3, "Channel 4"] )
```
=== Set Channel Color ===
Use the JavaFX `Color` Class, see https://docs.oracle.com/javase/8/javafx/api/javafx/scene/paint/Color.html
```lang=java
import ch.epfl.biop.qupath.utils.*
import javafx.scene.paint.Color
def color = new Color.rgb(0,0,255,1.0) // red green blue and alpha (opacity, 1.0 means not transparent)
GUIUtils.setChannelColor( 1, color )
// or
GUIUtils.setChannelColor( "DAB", color )
```
=== Save and Load Display Settings ===
```lang=java
import ch.epfl.biop.qupath.utils.*
def save_here = new File( "D:/Display/my_display.txt" )
GUIUTils.saveDisplaySettings( save_here )
// Load
GUIUTils.loadDisplaySettings( save_here )
// Apply current settings to project
GUIUtils.applyDisplaySettingsToProject()
```
= Description =
This extension, with source located at rQPEBIOP is the current 'fourre-tout' for all the new features we are currently implementing for QuPath to make our users' lives simpler.
== Requirements ==
Because some features (Like saving display settigns) were not programmer-accessible (`private`), we had to modify QuPath's code. Which is why most features are only available if you are running *QuPath v0.1.4**.
== Installation ==
Once you have QuPath installed, you can copy the `BIOPTools` jar file from
`\\svfas6.epfl.ch\biop\public\0 - BIOP Data\0-Install\QuPath\QuPath\Extensions`
`smb://svfas6.epfl.ch/biop/public/0 - BIOP Data/0-Install/QuPath/QuPath/Extensions`
= Contents ==
== Commands ==
The Extension includes the following commands
=== {nav BIOP > Display Settings... > Save current display settings to file... } ===
Asks the user for a location and a file name to save the current display settings (Brightness & Contast, active channels, channel colors) of the currently opened image) as a JSON file, which can be reused by the command below
=== {nav BIOP > Display Settings... > Load display settings from file... } ===
Asks the user a JSON file created with the command above. This sets the display settings of the current image ot those defined in the file.
=== {nav BIOP > Display Settings... >Apply display settings to similar images in projects} ===
Will apply the currently active Brightness & Contast, active channels and channel colors to all images to of the project as long as
# they share the same number of channels
# they have the same image type (Fluorescence, probably)
= Shortcuts and easier ways to access common QuPath functions in scripts =
Using rQPEBIOP
== Utils Class ==
This class contains general things useful in QuPath
=== Get Pixel Size ===
```lang=java
import ch.epfl.biop.qupath.utils.*
def px_size = Utils.getPixelSize()
```
=== Send Results to a File ===
```lang=java
import ch.epfl.biop.qupath.utils.*
// Define the measurements you want to send over
def results = [ "Nucleus: Area", "Nucleus: DAB OD mean", "Parent", "Class", "Name" ]
// Define the object you want to send
def cells = getCellObjects()
// Define the file and directory where you want to save the results
def resDir = buildFilePath(PROJECT_BASE_DIR, 'results')
mkdirs( resDir )
def resFile = new File( resDir, 'average_distances.csv' )
// Finally send the results. This method will append the image name as the first column
Utils.sendResultsToFile( measurements, cells, resFile )
// If you just want the results to end in `PROJECT_BASE_DIR/results/results.txt` you can use
Utils.sendResultsToFile( measurements, cells )
// If you want to send all results to `PROJECT_BASE_DIR/results/results.txt` you can use
Utils.sendResultsToFile( cells )
```
== Get the full measurements table ==
```lang=java
// Choose the objects for which you want the measurements
def path_objects = getAllObjects()
// Get the Measurements
def measurements = Utils.getAllMeasurements( path_objects )
// Access any measurement that appears in the 'Show annotation measurements' or 'Show detection measurements'
def area = measurements.getNumericValue( one_object, "Area µm2")
// This works with Area, Num Detections, etc
```
== PathUtils Class ==
This class has to do with operations on PathObjects
=== Get Area of a ROI ===
```lang=java
import ch.epfl.biop.qupath.utils.*
def object = getSelectedObject()
PathUtils.getAreaMicrons( object )
PathUtils.getArea( object )
```
== GUIUtils Class ==
=== Get an ImagePlus ===
```lang=java
import ch.epfl.biop.qupath.utils.*
def object = getSelectedObject()
// Get full ImagePlus
def imp = GUIUtils.getImagePlus( object, downsample, sendPathObjectAsRoi, sendChildObjectsInOverlay )
// Get a specific channel or series of channels
def channels = ["Channel 1", "Channel 3"] // Same names as in the 'Adjust Brightness And Contrast' menu
def imp = GUIUtils.getImagePlus( object, downsample, sendPathObjectAsRoi, sendChildObjectsInOverlay, channels )
// For Brightfield, you can only get one channel at a time
def imp_dab = GUIUtils.getImagePlus( object, downsample, sendPathObjectAsRoi, sendChildObjectsInOverlay, ["DAB"] ) // note the [ ], if you give it more channels it only returns the first one
```
=== Get/ Set Min And Max for Channels ===
```lang=java
import ch.epfl.biop.qupath.utils.*
// Channel number is 1-based
def channel = 1
def minmax = GUIUtils.getChannelMinMax( channel ) // min is in minmax[0] and max in minmax[1]
// By channel name
def channel_name = "DAB"
def minmax = GUIUtils.getChannelMinMax( channel_name )
GUIUtils.setChannelMinMax(1, 10.0, 3000.0 )
// or
GUIUtils.setChannelMinMax("DAB", 0.0, 1.0 )
```
=== Set Channel Visibility ==
```lang=java
import ch.epfl.biop.qupath.utils.*
GUIUtils.setActiveChannels( [1,3,4] )
// or
GUIUtils.setActiveChannelsbyName( ["Channel 1, "Channel 3, "Channel 4"] )
```
=== Set Channel Color ===
Use the JavaFX `Color` Class, see https://docs.oracle.com/javase/8/javafx/api/javafx/scene/paint/Color.html
```lang=java
import ch.epfl.biop.qupath.utils.*
import javafx.scene.paint.Color
def color = new Color.rgb(0,0,255,1.0) // red green blue and alpha (opacity, 1.0 means not transparent)
GUIUtils.setChannelColor( 1, color )
// or
GUIUtils.setChannelColor( "DAB", color )
```
=== Save and Load Display Settings ===
```lang=java
import ch.epfl.biop.qupath.utils.*
def save_here = new File( "D:/Display/my_display.txt" )
GUIUTils.saveDisplaySettings( save_here )
// Load
GUIUTils.loadDisplaySettings( save_here )
// Apply current settings to project
GUIUtils.applyDisplaySettingsToProject()
```
= Description =
This extension, with source located at rQPEBIOP is the current 'fourre-tout' for all the new features we are currently implementing for QuPath to make our users' lives simpler.
== Requirements ==
Because some features (Like saving display settigns) were not programmer-accessible (`private`), we had to modify QuPath's code. Which is why most features are only available if you are running *QuPath v0.1.4**.
== Installation ==
Once you have QuPath installed, you can copy the `BIOPTools` jar file from
`\\svfas6.epfl.ch\biop\public\0 - BIOP Data\0-Install\QuPath\QuPath\Extensions`
`smb://svfas6.epfl.ch/biop/public/0 - BIOP Data/0-Install/QuPath/QuPath/Extensions`
= Contents ==
== Commands ==
The Extension includes the following commands
=== {nav BIOP > Display Settings... > Save current display settings to file... } ===
Asks the user for a location and a file name to save the current display settings (Brightness & Contast, active channels, channel colors) of the currently opened image) as a JSON file, which can be reused by the command below
=== {nav BIOP > Display Settings... > Load display settings from file... } ===
Asks the user a JSON file created with the command above. This sets the display settings of the current image ot those defined in the file.
=== {nav BIOP > Display Settings... >Apply display settings to similar images in projects} ===
Will apply the currently active Brightness & Contast, active channels and channel colors to all images to of the project as long as
# they share the same number of channels
# they have the same image type (Fluorescence, probably)
= Shortcuts and easier ways to access common QuPath functions in scripts =
Using rQPEBIOP
== Utils Class ==
This class contains general things useful in QuPath
=== Get Pixel Size ===
```lang=java
import ch.epfl.biop.qupath.utils.*
def px_size = Utils.getPixelSize()
```
=== Send Results to a File ===
```lang=java
import ch.epfl.biop.qupath.utils.*
// Define the measurements you want to send over
def results = [ "Nucleus: Area", "Nucleus: DAB OD mean", "Parent", "Class", "Name" ]
// Define the object you want to send
def cells = getCellObjects()
// Define the file and directory where you want to save the results
def resDir = buildFilePath(PROJECT_BASE_DIR, 'results')
mkdirs( resDir )
def resFile = new File( resDir, 'average_distances.csv' )
// Finally send the results. This method will append the image name as the first column
Utils.sendResultsToFile( measurements, cells, resFile )
// If you just want the results to end in `PROJECT_BASE_DIR/results/results.txt` you can use
Utils.sendResultsToFile( measurements, cells )
// If you want to send all results to `PROJECT_BASE_DIR/results/results.txt` you can use
Utils.sendResultsToFile( cells )
```
== Get the full measurements table ==
```lang=java
// Choose the objects for which you want the measurements
def path_objects = getAllObjects()
// Get the Measurements
def measurements = Utils.getAllMeasurements( path_objects )
// Access any measurement that appears in the 'Show annotation measurements' or 'Show detection measurements'
def area = measurements.getNumericValue( one_object, "Area µm2")
// This works with Area, Num Detections, etc
```
== PathUtils Class ==
This class has to do with operations on PathObjects
=== Get Area of a ROI ===
```lang=java
import ch.epfl.biop.qupath.utils.*
def object = getSelectedObject()
PathUtils.getAreaMicrons( object )
PathUtils.getArea( object )
```
== GUIUtils Class ==
=== Get an ImagePlus ===
```lang=java
import ch.epfl.biop.qupath.utils.*
def object = getSelectedObject()
// Get full ImagePlus
def imp = GUIUtils.getImagePlus( object, downsample, sendPathObjectAsRoi, sendChildObjectsInOverlay )
// Get a specific channel or series of channels
def channels = ["Channel 1", "Channel 3"] // Same names as in the 'Adjust Brightness And Contrast' menu
def imp = GUIUtils.getImagePlus( object, downsample, sendPathObjectAsRoi, sendChildObjectsInOverlay, channels )
// For Brightfield, you can only get one channel at a time
def imp_dab = GUIUtils.getImagePlus( object, downsample, sendPathObjectAsRoi, sendChildObjectsInOverlay, ["DAB"] ) // note the [ ], if you give it more channels it only returns the first one
```
=== Get/ Set Min And Max for Channels ===
```lang=java
import ch.epfl.biop.qupath.utils.*
// Channel number is 1-based
def channel = 1
def minmax = GUIUtils.getChannelMinMax( channel ) // min is in minmax[0] and max in minmax[1]
// By channel name
def channel_name = "DAB"
def minmax = GUIUtils.getChannelMinMax( channel_name )
GUIUtils.setChannelMinMax(1, 10.0, 3000.0 )
// or
GUIUtils.setChannelMinMax("DAB", 0.0, 1.0 )
```
=== Set Channel Visibility ==
```lang=java
import ch.epfl.biop.qupath.utils.*
GUIUtils.setActiveChannels( [1,3,4] )
// or
GUIUtils.setActiveChannelsbyName( ["Channel 1, "Channel 3, "Channel 4"] )
```
=== Set Channel Color ===
Use the JavaFX `Color` Class, see https://docs.oracle.com/javase/8/javafx/api/javafx/scene/paint/Color.html
```lang=java
import ch.epfl.biop.qupath.utils.*
import javafx.scene.paint.Color
def color = new Color.rgb(0,0,255,1.0) // red green blue and alpha (opacity, 1.0 means not transparent)
GUIUtils.setChannelColor( 1, color )
// or
GUIUtils.setChannelColor( "DAB", color )
```
=== Save and Load Display Settings ===
```lang=java
import ch.epfl.biop.qupath.utils.*
def save_here = new File( "D:/Display/my_display.txt" )
GUIUTils.saveDisplaySettings( save_here )
// Load
GUIUTils.loadDisplaySettings( save_here )
// Apply current settings to project
GUIUtils.applyDisplaySettingsToProject()
```
c4science · Help