Package sc.fiji.snt.io
Class SpimDataUtils
java.lang.Object
sc.fiji.snt.io.SpimDataUtils
Utilities for working with
AbstractSpimData and BigDataViewer XML
descriptors.- Author:
- Tiago Ferreira
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSpimDataUtils.CalibratedSource<T extends net.imglib2.type.numeric.NumericType<T>>Wraps aRandomAccessibleIntervalSourceand overridesSpimDataUtils.CalibratedSource.getVoxelDimensions()to carry the physical unit (e.g. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidpatchImsXml(String xmlPath, String base) Patches an IMS XML sidecar file, replacing all"(name not specified)"placeholders with sequential channel names derived from the base name.static ObjectresolvePathToSource(String filePathOrUrl) Resolves a file path to either anAbstractSpimData(for.imsand.xmlfiles) or anImgPlus(fallback).static voidwriteBdvN5Xml(File xmlFile, String n5DirName, long[][] levelDims, double[] voxelSize, String unit, int nTimepoints, String setupName) Writes a BDV-compatible XML descriptor for an N5 dataset.static voidwriteBdvN5Xml(File xmlFile, String n5DirName, long[][] levelDims, double[] voxelSize, String unit, int nTimepoints, String setupName, int nChannels)
-
Method Details
-
resolvePathToSource
Resolves a file path to either anAbstractSpimData(for.imsand.xmlfiles) or anImgPlus(fallback).- Parameters:
filePathOrUrl- path or URL to the image file- Returns:
- an
AbstractSpimDataorImgPlus - Throws:
IllegalArgumentException- if the file cannot be opened
-
patchImsXml
Patches an IMS XML sidecar file, replacing all"(name not specified)"placeholders with sequential channel names derived from the base name.- Parameters:
xmlPath- path to the XML sidecarbase- base name to use (typically the IMS filename without extension)- Throws:
IOException- if the file cannot be read or written
-
writeBdvN5Xml
public static void writeBdvN5Xml(File xmlFile, String n5DirName, long[][] levelDims, double[] voxelSize, String unit, int nTimepoints, String setupName) throws IOException Writes a BDV-compatible XML descriptor for an N5 dataset. The resulting XML can be opened by BigDataViewer, BigVolumeViewer, or any BDV-based tool viaXmlIoSpimDataMinimal.load().The descriptor references the N5 container using a relative path (assumes the XML sits next to the N5 directory). A single ViewSetup (id 0) is created with the supplied voxel size and calibration unit.
- Parameters:
xmlFile- the XML file to write (will be overwritten if it exists)n5DirName- name of the N5 container directory (relative to the XML file's parent; e.g.,"dataset_unmixed")levelDims- per-level dimensions:levelDims[level] = {x, y, z}voxelSize- physical voxel size at level 0:{sx, sy, sz}unit- calibration unit (e.g.,"um","pixel")nTimepoints- number of timepoints in the datasetsetupName- display name for the single ViewSetup (e.g.,"unmixed")- Throws:
IOException- if the file cannot be written
-
writeBdvN5Xml
public static void writeBdvN5Xml(File xmlFile, String n5DirName, long[][] levelDims, double[] voxelSize, String unit, int nTimepoints, String setupName, int nChannels) throws IOException - Throws:
IOException
-