Volumes#
Context#
the aim of classes dedicated to volumes is to have a common way of saving and loading volumes through the tomotools suite. From it we intend to simplify volume handling for creating them but also to do some post processing operation on them such as stitching but also ease handling from gui.*
overview#
Volumes contains two main parts:
data: the volume itself. It is expected to be a 3D numpy arraymetadata: metadata associated to the volume such as information regarding the reconstruction parameters…
For now the following volumes exists:
HDF5Volume: save data and metadata to an hdf5 file.
EDFVolume: save data to single frame EDF files and metadata to a text file
JP2KVolume: save data to single frame jp2k files and metadata to a text file
TIFFVolume: save data to single frame tiff files and metadata to a text file
MultiTIFFVolume: save data to a single 3D tiff file and metadata to a text file
Volume API#
[1]:
from tomoscan.esrf import HDF5Volume
from tomoscan.esrf import EDFVolume
from tomoscan.esrf import TIFFVolume, MultiTIFFVolume, has_tifffile
from tomoscan.esrf import JP2KVolume, has_glymur
import numpy
from silx.io.url import DataUrl
from tempfile import TemporaryDirectory
import os
from h5glance import H5Glance
Traceback (most recent call last):
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/IPython/core/interactiveshell.py:3550 in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
Cell In[1], line 1
from tomoscan.esrf import HDF5Volume
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/tomoscan/esrf/__init__.py:3
from .scan.edfscan import EDFTomoScan # noqa F401
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/tomoscan/esrf/scan/edfscan.py:13
import fabio
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/__init__.py:49
_fabioformats.register_default_formats()
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/fabioformats.py:129 in register_default_formats
module = importer("fabio." + module_name)
File ~/.asdf/installs/python/3.9.20/lib/python3.9/importlib/__init__.py:127 in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/jpeg2kimage.py:47
import glymur
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/glymur/__init__.py:16
from .jpeg import JPEG2JP2
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/glymur/jpeg.py:84
match marker:
^
SyntaxError: invalid syntax
create some dataset to test#
[2]:
from tomoscan.esrf.volume.mock import create_volume
data = create_volume(frame_dims=(100, 100), z_size=5)
metadata = {
"reconstruction_params": {
"dataset": {
"location": "toto.hdf5",
"entry": "entry0000",
},
"phase": {
"method": "None",
"padding_type": "edge",
},
},
"processing_option": {
"build_sino": {
"axis_correction": "None",
"enable_halftomo": True,
},
"flatfield": {
"binning": "11",
"do_flat_distortion": False,
},
},
}
Traceback (most recent call last):
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/IPython/core/interactiveshell.py:3550 in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
Cell In[2], line 1
from tomoscan.esrf.volume.mock import create_volume
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/tomoscan/esrf/__init__.py:3
from .scan.edfscan import EDFTomoScan # noqa F401
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/tomoscan/esrf/scan/edfscan.py:13
import fabio
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/__init__.py:49
_fabioformats.register_default_formats()
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/fabioformats.py:129 in register_default_formats
module = importer("fabio." + module_name)
File ~/.asdf/installs/python/3.9.20/lib/python3.9/importlib/__init__.py:127 in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/jpeg2kimage.py:47
import glymur
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/glymur/__init__.py:16
from .jpeg import JPEG2JP2
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/glymur/jpeg.py:84
match marker:
^
SyntaxError: invalid syntax
[3]:
#%pylab
[4]:
# imshow(data[0])
HDF5Volume#
constructor#
Here we will only focus on providing a file_path and a data_path to the constructor. From it it will deduce default data and metadata data_path.
This way allow us to get a identifier that can be reused. But users can also provide directly an url for data and one for the metadata. But this is for advance usage and it will not be detailled here.
[5]:
# users can define the volume will all the information
volume = HDF5Volume(file_path="test_volume.hdf5", data_path="entry0000/reconstruction", data=data, metadata=metadata)
# or define them from properties
volume = HDF5Volume()
volume.file_path = "test_volume.hdf5"
volume.data_path = "entry0000/reconstruction"
volume.data = data # data must be None or 3D numpy array
volume.metadata = metadata # metadata must be None or an instance of dict
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[5], line 2
1 # users can define the volume will all the information
----> 2 volume = HDF5Volume(file_path="test_volume.hdf5", data_path="entry0000/reconstruction", data=data, metadata=metadata)
3 # or define them from properties
4 volume = HDF5Volume()
NameError: name 'HDF5Volume' is not defined
[6]:
# data can be access from the data property
# imshow(volume.data[0])
# metadata from the metadata property.
volume.metadata
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[6], line 4
1 # data can be access from the data property
2 # imshow(volume.data[0])
3 # metadata from the metadata property.
----> 4 volume.metadata
NameError: name 'volume' is not defined
saving#
[7]:
# save the volume
volume.save()
# display the contents of the volume file
H5Glance("test_volume.hdf5")
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[7], line 2
1 # save the volume
----> 2 volume.save()
3 # display the contents of the volume file
5 H5Glance("test_volume.hdf5")
NameError: name 'volume' is not defined
loadding#
once the data is saved on disk then we can retrieve it from the same class
[8]:
volume_loaded = HDF5Volume(file_path="test_volume.hdf5", data_path="entry0000/reconstruction")
volume_loaded.load()
# imshow(volume_loaded.data[0])
print(volume_loaded.metadata)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[8], line 1
----> 1 volume_loaded = HDF5Volume(file_path="test_volume.hdf5", data_path="entry0000/reconstruction")
2 volume_loaded.load()
3 # imshow(volume_loaded.data[0])
NameError: name 'HDF5Volume' is not defined
To avoid heavy memory consumption the data and metadata will not be loaded automatically. In order to purge cache you can also call volume.clear_cache() or set data and metadata to None like:
volume.data = None
volume.metadata = None
Note: if data or metadata is None call to saving function can raise ValueError exception.
identifier#
Each subclass of VolumeBase define what we call an identifier. The goal is that from this identifier a user can retrieve a Volume. An identifier can be save as an instance of Identifier or as it string representation. An identifier looks like:
scheme:tomo_type:data_path@data_file
For now:
scheme can be
hdf5,edf,jp2k,tiffandtiff_3dtomo_type can be
scanorvolume
Note: This is pretty convienient for gui for example or to ‘copy/paste’ a reference to a volume from one application to another.
get identifier#
[9]:
identifier = volume_loaded.get_identifier()
print(identifier, type(identifier))
print(identifier.to_str(), type(identifier.to_str()))
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[9], line 1
----> 1 identifier = volume_loaded.get_identifier()
2 print(identifier, type(identifier))
3 print(identifier.to_str(), type(identifier.to_str()))
NameError: name 'volume_loaded' is not defined
use identifier to retrieve a volume#
[10]:
from tomoscan.factory import Factory
retrieve_volume = Factory.create_tomo_object_from_identifier(identifier=identifier)
assert isinstance(retrieve_volume, HDF5Volume)
retrieve_volume = Factory.create_tomo_object_from_identifier(identifier=identifier.to_str())
assert isinstance(retrieve_volume, HDF5Volume)
Traceback (most recent call last):
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/IPython/core/interactiveshell.py:3550 in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
Cell In[10], line 1
from tomoscan.factory import Factory
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/tomoscan/factory.py:9
from tomoscan.esrf.identifier.jp2kidentifier import JP2KVolumeIdentifier
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/tomoscan/esrf/__init__.py:3
from .scan.edfscan import EDFTomoScan # noqa F401
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/tomoscan/esrf/scan/edfscan.py:13
import fabio
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/__init__.py:49
_fabioformats.register_default_formats()
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/fabioformats.py:129 in register_default_formats
module = importer("fabio." + module_name)
File ~/.asdf/installs/python/3.9.20/lib/python3.9/importlib/__init__.py:127 in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/jpeg2kimage.py:47
import glymur
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/glymur/__init__.py:16
from .jpeg import JPEG2JP2
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/glymur/jpeg.py:84
match marker:
^
SyntaxError: invalid syntax
[11]:
# clean workspace
if os.path.exists("test_volume.hdf5"):
os.remove("test_volume.hdf5")
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[11], line 2
1 # clean workspace
----> 2 if os.path.exists("test_volume.hdf5"):
3 os.remove("test_volume.hdf5")
NameError: name 'os' is not defined
EDFVolume#
constructor#
EDFVolume will store each frame as folder_prefix_index.edf and metadata to folder_prefix_infos.txt.
So the default constructor only require a path to a folder where to save the data.
This folder path will also be the identifier
[12]:
volume = EDFVolume(folder="edf_volume", data=data, metadata=metadata)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[12], line 1
----> 1 volume = EDFVolume(folder="edf_volume", data=data, metadata=metadata)
NameError: name 'EDFVolume' is not defined
or as for the HDF5Volume you can provide data and metadata once the Volume has been defined
[13]:
volume = EDFVolume(folder="edf_volume")
volume.data = data
volume.metadata = metadata
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[13], line 1
----> 1 volume = EDFVolume(folder="edf_volume")
2 volume.data = data
3 volume.metadata = metadata
NameError: name 'EDFVolume' is not defined
access to data and metadata is the same for any instance of VolumeBase, from data and metadata properties
[14]:
# imshow(volume.data[0])
print(volume.metadata)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[14], line 2
1 # imshow(volume.data[0])
----> 2 print(volume.metadata)
NameError: name 'volume' is not defined
saving#
[15]:
# save the volume
volume.save()
# if you want to overwrite existing data you can set the overwrite property
volume.overwrite = True
# display the contents of the folder
print(os.listdir("edf_volume"))
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[15], line 2
1 # save the volume
----> 2 volume.save()
4 # if you want to overwrite existing data you can set the overwrite property
5 volume.overwrite = True
NameError: name 'volume' is not defined
[16]:
# open one file containing a frame
import fabio
file_frame_0 = os.path.join("edf_volume", "edf_volume_000000.edf")
# imshow(fabio.open(file_frame_0).data)
Traceback (most recent call last):
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/IPython/core/interactiveshell.py:3550 in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
Cell In[16], line 2
import fabio
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/__init__.py:49
_fabioformats.register_default_formats()
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/fabioformats.py:129 in register_default_formats
module = importer("fabio." + module_name)
File ~/.asdf/installs/python/3.9.20/lib/python3.9/importlib/__init__.py:127 in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/jpeg2kimage.py:47
import glymur
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/glymur/__init__.py:16
from .jpeg import JPEG2JP2
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/glymur/jpeg.py:84
match marker:
^
SyntaxError: invalid syntax
[17]:
# display contents of the infos.txt file
metadata_file = os.path.join("edf_volume", "edf_volume_infos.txt")
with open(metadata_file, "r") as of:
print("".join(of.readlines()))
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[17], line 2
1 # display contents of the infos.txt file
----> 2 metadata_file = os.path.join("edf_volume", "edf_volume_infos.txt")
3 with open(metadata_file, "r") as of:
4 print("".join(of.readlines()))
NameError: name 'os' is not defined
loading#
[18]:
volume_loaded = EDFVolume(folder="edf_volume")
volume_loaded.load()
#imshow(volume_loaded.data[1])
print(volume_loaded.metadata)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[18], line 1
----> 1 volume_loaded = EDFVolume(folder="edf_volume")
2 volume_loaded.load()
3 #imshow(volume_loaded.data[1])
NameError: name 'EDFVolume' is not defined
identifier#
get_identifier#
[19]:
identifier = volume_loaded.get_identifier()
print(identifier, type(identifier))
print(identifier.to_str(), type(identifier.to_str()))
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[19], line 1
----> 1 identifier = volume_loaded.get_identifier()
2 print(identifier, type(identifier))
3 print(identifier.to_str(), type(identifier.to_str()))
NameError: name 'volume_loaded' is not defined
use identifier to retrieve a volume#
[20]:
from tomoscan.factory import Factory
retrieve_volume = Factory.create_tomo_object_from_identifier(identifier=identifier)
assert isinstance(retrieve_volume, EDFVolume)
retrieve_volume = Factory.create_tomo_object_from_identifier(identifier=identifier.to_str())
assert isinstance(retrieve_volume, EDFVolume)
Traceback (most recent call last):
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/IPython/core/interactiveshell.py:3550 in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
Cell In[20], line 1
from tomoscan.factory import Factory
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/tomoscan/factory.py:9
from tomoscan.esrf.identifier.jp2kidentifier import JP2KVolumeIdentifier
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/tomoscan/esrf/__init__.py:3
from .scan.edfscan import EDFTomoScan # noqa F401
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/tomoscan/esrf/scan/edfscan.py:13
import fabio
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/__init__.py:49
_fabioformats.register_default_formats()
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/fabioformats.py:129 in register_default_formats
module = importer("fabio." + module_name)
File ~/.asdf/installs/python/3.9.20/lib/python3.9/importlib/__init__.py:127 in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/jpeg2kimage.py:47
import glymur
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/glymur/__init__.py:16
from .jpeg import JPEG2JP2
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/glymur/jpeg.py:84
match marker:
^
SyntaxError: invalid syntax
[21]:
# clean
import shutil
if os.path.exists("edf_volume"):
shutil.rmtree("edf_volume")
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[21], line 3
1 # clean
2 import shutil
----> 3 if os.path.exists("edf_volume"):
4 shutil.rmtree("edf_volume")
NameError: name 'os' is not defined
JP2KVolume#
The API of JP2KVolume is the same as EDFVolume. So for tutorial please have a look at this one.
It requires glymur to be install
TIFFVolume#
The API of TIFFVolume is the same as EDFVolume. So for tutorial please have a look at this one.
It requires tifffile to be install
MultiTIFFVolume#
The MultiTIFFVolume requires tifffile to be install
constructor#
[22]:
volume = MultiTIFFVolume(file_path="multitiff_file.tiff", data=data, metadata=metadata)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[22], line 1
----> 1 volume = MultiTIFFVolume(file_path="multitiff_file.tiff", data=data, metadata=metadata)
NameError: name 'MultiTIFFVolume' is not defined
[23]:
# access data and metadata
# imshow(volume.data[0])
print(volume.metadata)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[23], line 3
1 # access data and metadata
2 # imshow(volume.data[0])
----> 3 print(volume.metadata)
NameError: name 'volume' is not defined
saving#
[24]:
from tomoscan.esrf.volume.tiffvolume import has_tifffile
if has_tifffile:
volume.save()
else:
print("tifffile must be installed to use MultiTIFFVolume")
Traceback (most recent call last):
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/IPython/core/interactiveshell.py:3550 in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
Cell In[24], line 1
from tomoscan.esrf.volume.tiffvolume import has_tifffile
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/tomoscan/esrf/__init__.py:3
from .scan.edfscan import EDFTomoScan # noqa F401
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/tomoscan/esrf/scan/edfscan.py:13
import fabio
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/__init__.py:49
_fabioformats.register_default_formats()
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/fabioformats.py:129 in register_default_formats
module = importer("fabio." + module_name)
File ~/.asdf/installs/python/3.9.20/lib/python3.9/importlib/__init__.py:127 in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/jpeg2kimage.py:47
import glymur
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/glymur/__init__.py:16
from .jpeg import JPEG2JP2
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/glymur/jpeg.py:84
match marker:
^
SyntaxError: invalid syntax
loading#
[25]:
if has_tifffile:
volume_loaded = MultiTIFFVolume(file_path="multitiff_file.tiff")
assert volume_loaded.data is None
assert volume_loaded.metadata is None
volume_loaded.load()
# imshow(volume_loaded.data[0])
print(volume_loaded.metadata)
else:
print("tifffile must be installed to use MultiTIFFVolume")
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[25], line 1
----> 1 if has_tifffile:
2 volume_loaded = MultiTIFFVolume(file_path="multitiff_file.tiff")
3 assert volume_loaded.data is None
NameError: name 'has_tifffile' is not defined
identifier#
[26]:
if has_tifffile:
identifier = volume_loaded.get_identifier()
print(identifier, type(identifier))
print(identifier.to_str(), type(identifier.to_str()))
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[26], line 1
----> 1 if has_tifffile:
2 identifier = volume_loaded.get_identifier()
3 print(identifier, type(identifier))
NameError: name 'has_tifffile' is not defined
[27]:
from tomoscan.factory import Factory
if has_tifffile:
retrieve_volume = Factory.create_tomo_object_from_identifier(identifier=identifier)
assert isinstance(retrieve_volume, MultiTIFFVolume)
retrieve_volume = Factory.create_tomo_object_from_identifier(identifier=identifier.to_str())
assert isinstance(retrieve_volume, MultiTIFFVolume)
Traceback (most recent call last):
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/IPython/core/interactiveshell.py:3550 in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
Cell In[27], line 1
from tomoscan.factory import Factory
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/tomoscan/factory.py:9
from tomoscan.esrf.identifier.jp2kidentifier import JP2KVolumeIdentifier
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/tomoscan/esrf/__init__.py:3
from .scan.edfscan import EDFTomoScan # noqa F401
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/tomoscan/esrf/scan/edfscan.py:13
import fabio
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/__init__.py:49
_fabioformats.register_default_formats()
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/fabioformats.py:129 in register_default_formats
module = importer("fabio." + module_name)
File ~/.asdf/installs/python/3.9.20/lib/python3.9/importlib/__init__.py:127 in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/fabio/jpeg2kimage.py:47
import glymur
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/glymur/__init__.py:16
from .jpeg import JPEG2JP2
File ~/checkouts/readthedocs.org/user_builds/tomoscan-esrf/envs/v2.1.6/lib/python3.9/site-packages/glymur/jpeg.py:84
match marker:
^
SyntaxError: invalid syntax
[28]:
# clean
if os.path.exists("multitiff_file.tiff"):
os.remove("multitiff_file.tiff")
if os.path.exists(retrieve_volume.metadata_url.file_path()):
os.remove(retrieve_volume.metadata_url.file_path())
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
Cell In[28], line 2
1 # clean
----> 2 if os.path.exists("multitiff_file.tiff"):
3 os.remove("multitiff_file.tiff")
4 if os.path.exists(retrieve_volume.metadata_url.file_path()):
NameError: name 'os' is not defined