Package qupath.lib.extension.svg
Class SvgTools.SvgBuilder
java.lang.Object
qupath.lib.extension.svg.SvgTools.SvgBuilder
- Enclosing class:
- SvgTools
Builder class to enable the export of rendered QuPath objects as SVG images.
 This can be useful to generate high-quality figures using a vector representation of objects, 
 which may be further customized in other applications (e.g. to change line thickness, color).
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic enumEnum defining ways in which raster images may be included in the SVG file.
- 
Constructor SummaryConstructorsConstructorDescriptionCreate a new builder, which will later be customized.SvgBuilder(QuPathViewer viewer) Create a builder initialized according to the current viewer.
- 
Method SummaryModifier and TypeMethodDescriptionCreate a String representation of the SVG document.downsample(double downsample) Specify downsample factor (defined in terms of the full resolution image space).Specify whether the underlying (raster) image should be embedded in any export.fillAnnotations(boolean doFill) Request whether annotations are drawn as 'filled' shapes.fillDetections(boolean doFill) Request whether detections are drawn as 'filled' shapes.height(int height) Export image height.hierarchy(PathObjectHierarchy hierarchy) Specify thePathObjectHierarchy.imageData(ImageData<BufferedImage> imageData) Specify theImageData.Specify if/how raster images should be included in the SVG.includeOverlays(boolean doInclude) Specify whether overlays should be included.Specify whether the underlying (raster) image should be included in any export.options(OverlayOptions options) Specify the overlay options to control display.pathObjects(Collection<? extends PathObject> pathObjects) Specify a collection of objects to export.pathObjects(PathObject... pathObjects) Specify an array of objects to export.region(ImageRegion region) Specify the region (in terms of the full resolution image space) for export.showSelection(boolean doShow) Request whether selected objects are displayed.size(int width, int height) Export image size.width(int width) Export image width.voidWrite the SVG image to a file, including any references images if required.
- 
Constructor Details- 
SvgBuilderCreate a builder initialized according to the current viewer.- Parameters:
- viewer-
 
- 
SvgBuilderpublic SvgBuilder()Create a new builder, which will later be customized.
 
- 
- 
Method Details- 
imageDataSpecify theImageData. This is required if the underlying raster image will be included in any export.- Parameters:
- imageData-
- Returns:
- this builder
 
- 
hierarchySpecify thePathObjectHierarchy. This may be used instead ofimageData(ImageData)if the raster image is not required.- Parameters:
- hierarchy-
- Returns:
- this builder
 
- 
pathObjectsSpecify a collection of objects to export. This may be used instead ofimageData(ImageData)if the raster image is not required.- Parameters:
- pathObjects-
- Returns:
- this builder
 
- 
pathObjectsSpecify an array of objects to export. This may be used instead ofimageData(ImageData)if the raster image is not required.- Parameters:
- pathObjects-
- Returns:
- this builder
 
- 
includeOverlaysSpecify whether overlays should be included. This only has an effect if images are also included, and a viewer is provided.- Parameters:
- doInclude-
- Returns:
- this builder
 
- 
optionsSpecify the overlay options to control display. This will override any previous customizations added to the builder.- Parameters:
- options-
- Returns:
- this builder
 
- 
fillAnnotationsRequest whether annotations are drawn as 'filled' shapes.- Parameters:
- doFill-
- Returns:
- this builder
 
- 
fillDetectionsRequest whether detections are drawn as 'filled' shapes.- Parameters:
- doFill-
- Returns:
- this builder
 
- 
showSelectionRequest whether selected objects are displayed.- Parameters:
- doShow-
- Returns:
- this builder
 
- 
regionSpecify the region (in terms of the full resolution image space) for export. If aRegionRequestis supplied, the downsample factor will be used if none has otherwise been set.- Parameters:
- region-
- Returns:
- this builder
 
- 
downsampleSpecify downsample factor (defined in terms of the full resolution image space).- Parameters:
- downsample-
- Returns:
- this builder
 
- 
widthExport image width.- Parameters:
- width- width (in pixels) of the SVG image.
- Returns:
- this builder
 
- 
heightExport image height.- Parameters:
- height- height (in pixels) of the SVG image.
- Returns:
- this builder
 
- 
sizeExport image size.- Parameters:
- width- width (in pixels) of the SVG image.
- height- height (in pixels) of the SVG image.
- Returns:
- this builder
 
- 
embedImagesSpecify whether the underlying (raster) image should be embedded in any export. This requires that the constructor with aQuPathVieweris called to supply the necessary rendering settings.- Returns:
- this builder
- See Also:
 
- 
linkImagesSpecify whether the underlying (raster) image should be included in any export. This requires that the constructor with aQuPathVieweris called to supply the necessary rendering settings.Only references are written, which means images must be written as separate files (which occurs automatically when using writeSVG(File)).- Returns:
- this builder
- See Also:
 
- 
imagesSpecify if/how raster images should be included in the SVG.- Parameters:
- include-
- Returns:
- this builder
 
- 
writeSVGWrite the SVG image to a file, including any references images if required.- Parameters:
- file- SVG file to which the image should be written
- Throws:
- IOException
 
- 
createDocumentCreate a String representation of the SVG document.- Returns:
- the SVG String
 
 
-