Class SpimDataUtils

java.lang.Object
sc.fiji.snt.io.SpimDataUtils

public class SpimDataUtils extends Object
Utilities for working with AbstractSpimData and BigDataViewer XML descriptors.
Author:
Tiago Ferreira
  • Method Details

    • resolvePathToSource

      public static Object resolvePathToSource(String filePathOrUrl)
      Resolves a file path to either an AbstractSpimData (for .ims and .xml files) or an ImgPlus (fallback).
      Parameters:
      filePathOrUrl - path or URL to the image file
      Returns:
      an AbstractSpimData or ImgPlus
      Throws:
      IllegalArgumentException - if the file cannot be opened
    • patchImsXml

      public static void patchImsXml(String xmlPath, String base) throws IOException
      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 sidecar
      base - 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 via XmlIoSpimDataMinimal.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 dataset
      setupName - 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