Create a folders with symbolic links to all cast volumes#
In the following script we create a folder containing symbolic links to all casted volumes
Warning
this is the ‘cast volume’ output that must be connected to the Python script ‘volume’ input.
Script#
import os
from tomoscan.esrf.volume.singleframebase import VolumeSingleFrameBase
output_dir = "/path/to/folder" # root folder of the symbolic links
if in_volume is not None:
link_src = in_volume.data_url.file_path()
link_dst = os.path.join(
output_dir,
in_volume.get_identifier().scheme, # optional: if you want to store your data with under output_dir/j2k, hdf5... Can be useful if you have more than one output data type
os.path.basename(link_src),
)
target_is_directory = isinstance(in_volume, VolumeSingleFrameBase)
os.makedirs(os.path.dirname(link_dst), exist_ok=True)
os.symlink(link_src, link_dst, target_is_directory=target_is_directory)