Skip to content

get_fastccd_images() does not work with roi given as input #73

@tankonst

Description

@tankonst

When roi coordinates are passed to
get_fastccd_images(h, (bgnd8, bgnd2, bgnd1), flat=ff, tag='fccd_image', roi = (0, 0, 50, 50))
the function returns an AttributeError.

AttributeError Traceback (most recent call last)
in

/opt/conda_envs/analysis-2019-3.0-ml/lib/python3.7/site-packages/csxtools/utils.py in get_fastccd_images(light_header, dark_headers, flat, gain, tag, roi)
92
93 tt = ttime.time()
---> 94 b = get_images_to_3D(bgnd_events, dtype=np.uint16)
95 logger.info("Image conversion took %.3f seconds",
96 ttime.time() - tt)

/opt/conda_envs/analysis-2019-3.0-ml/lib/python3.7/site-packages/csxtools/utils.py in get_images_to_3D(images, dtype)
173
174 """
--> 175 im = np.vstack([np.asarray(im, dtype=dtype) for im in images])
176 return im
177

/opt/conda_envs/analysis-2019-3.0-ml/lib/python3.7/site-packages/csxtools/utils.py in (.0)
173
174 """
--> 175 im = np.vstack([np.asarray(im, dtype=dtype) for im in images])
176 return im
177

/opt/conda_envs/analysis-2019-3.0-ml/lib/python3.7/site-packages/slicerator/init.py in (.0)
472
473 def iter(self):
--> 474 return (self._get(i) for i in range(len(self)))
475
476 def getitem(self, i):

/opt/conda_envs/analysis-2019-3.0-ml/lib/python3.7/site-packages/slicerator/init.py in _get(self, key)
459 # We need to copy here: else any _proc_func that acts inplace would
460 # change the ancestor value.
--> 461 return self._proc_func(*(copy(a[key]) for a in self._ancestors))
462
463 def repr(self):

/opt/conda_envs/analysis-2019-3.0-ml/lib/python3.7/site-packages/slicerator/init.py in proc_func(*x)
683 if all_pipe:
684 def proc_func(x):
--> 685 return func(
(x + args), **kwargs)
686
687 return Pipeline(proc_func, *ancestors)

/opt/conda_envs/analysis-2019-3.0-ml/lib/python3.7/site-packages/csxtools/utils.py in _crop_images(image, roi)
207 @pipeline
208 def _crop_images(image, roi):
--> 209 return _crop(image, roi)
210
211

/opt/conda_envs/analysis-2019-3.0-ml/lib/python3.7/site-packages/csxtools/utils.py in _crop(image, roi)
214 # Assuming ROI is specified in the "rotated" (correct) orientation
215 roi = [image_shape[-2]-roi[3], roi[0], image_shape[-1]-roi[1], roi[2]]
--> 216 return image.T[roi[1]:roi[3], roi[0]:roi[2]].T
217
218

AttributeError: 'ImageStack' object has no attribute 'T'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions