Hi everyone,
I am following the GATE (Listmode Reconstruction; Without Time of Flight) tutorial for my own data files.
My attenuation image is a metaimage mhd + raw format instead of the .hv format used in the example tutorial. When I upload this type of mhd image format I get an error like this:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[102], line 14
8 proj_meta = PETLMProjMeta(
9 detector_ids = detector_ids, # list of all detected event detector ID pairs
10 info = info,
11 weights_sensitivity=normalization_weights
12 )
13 # Get attenuation map and PSF transform from the associated phantom
---> 14 atten_map = gate.get_aligned_attenuation_map(os.path.join(path, 'mumapIEC.mhd'), object_meta).to(pytomography.device)
15 psf_transform = GaussianFilter(3.) # 3mm gaussian blurring
16 # Create system matrix
File ~/miniconda3/envs/pytomography_env/lib/python3.9/site-packages/pytomography/io/PET/gate.py:27, in get_aligned_attenuation_map(headerfile, object_meta)
14 def get_aligned_attenuation_map(
15 headerfile: str,
16 object_meta: ObjectMeta
17 ) -> torch.tensor:
18 """Returns an aligned attenuation map in units of inverse mm for reconstruction. This assumes that the attenuation map shares the same center point with the reconstruction space.
19
20 Args:
(...)
25 torch.Tensor: Aligned attenuation map
26 """
---> 27 amap = get_attenuation_map_interfile(headerfile).cpu().numpy()
28 # Load metadata
29 with open(headerfile) as f:
File ~/miniconda3/envs/pytomography_env/lib/python3.9/site-packages/pytomography/io/shared/interfile.py:63, in get_attenuation_map_interfile(headerfile)
61 shape = (matrix_size_3, matrix_size_2, matrix_size_1)
62 imagefile = get_header_value(headerdata, 'name of data file', str)
---> 63 amap = np.fromfile(os.path.join(str(Path(headerfile).parent), imagefile), dtype=np.float32)
64 # Flip "Z" ("X" in SIMIND) b/c "first density image located at +X" according to SIMIND manual
65 # Flip "Y" ("Z" in SIMIND) b/c axis convention is opposite for x22,5x (mu-castor format)
66 amap = np.transpose(amap.reshape(shape), (2,1,0))[:,::-1,::-1]
File ~/miniconda3/envs/pytomography_env/lib/python3.9/posixpath.py:90, in join(a, *p)
88 path += sep + b
89 except (TypeError, AttributeError, BytesWarning):
---> 90 genericpath._check_arg_types('join', a, *p)
91 raise
92 return path
File ~/miniconda3/envs/pytomography_env/lib/python3.9/genericpath.py:152, in _check_arg_types(funcname, *args)
150 hasbytes = True
151 else:
--> 152 raise TypeError(f'{funcname}() argument must be str, bytes, or '
153 f'os.PathLike object, not {s.__class__.__name__!r}') from None
154 if hasstr and hasbytes:
155 raise TypeError("Can't mix strings and bytes in path components") from None
TypeError: join() argument must be str, bytes, or os.PathLike object, not 'bool'
From what I understood, I am passing an incorrect argument type, so I was wondering how do I upload then my attenuation image for reconstruction. How do I convert it to a format compatible with pytomography?
I would appreciate any guidance on this subject.
Thank you!
Greetings,
Beatriz