diff workflow/run_tomo.py @ 24:0891477bcb16 draft

planemo upload for repository https://github.com/rolfverberg/galaxytools commit f8c4bdb31c20c468045ad5e6eb255a293244bc6c-dirty
author rv43
date Tue, 21 Mar 2023 17:40:36 +0000
parents c7a1d5d1471c
children 7d9cf7592ad1
line wrap: on
line diff
--- a/workflow/run_tomo.py	Tue Mar 21 16:47:44 2023 +0000
+++ b/workflow/run_tomo.py	Tue Mar 21 17:40:36 2023 +0000
@@ -517,10 +517,10 @@
             y_bounds = self.test_config.get('y_bounds')
             z_bounds = None
         elif self.galaxy_flag:
-            if x_bounds is not None and not is_int_pair(x_bounds, ge=0,
+            if x_bounds is not None and not is_int_pair(x_bounds, ge=-1,
                     lt=tomo_recon_stacks[0].shape[1]):
                 raise ValueError(f'Invalid parameter x_bounds ({x_bounds})')
-            if y_bounds is not None and not is_int_pair(y_bounds, ge=0,
+            if y_bounds is not None and not is_int_pair(y_bounds, ge=-1,
                     lt=tomo_recon_stacks[0].shape[1]):
                 raise ValueError(f'Invalid parameter y_bounds ({y_bounds})')
             z_bounds = None
@@ -887,11 +887,6 @@
 
         # Select image bounds
         title = f'tomography image at theta={round(theta, 2)+0}'
-        if img_x_bounds is not None:
-            if is_int_pair(img_x_bounds) and img_x_bounds[0] == -1 and img_x_bounds[1] == -1:
-                img_x_bounds = None
-            elif not is_index_range(img_x_bounds, ge=0, le=first_image.shape[0]):
-                raise ValueError(f'Invalid parameter img_x_bounds ({img_x_bounds})')
         if nxentry.instrument.source.attrs['station'] in ('id1a3', 'id3a'):
             pixel_size = nxentry.instrument.detector.x_pixel_size
             # Try to get a fit from the bright field
@@ -993,6 +988,8 @@
             if self.galaxy_flag:
                 if img_x_bounds is None:
                     img_x_bounds = (0, first_image.shape[0])
+                elif not is_index_range(img_x_bounds, ge=0, le=first_image.shape[0]):
+                    raise ValueError(f'Invalid parameter img_x_bounds ({img_x_bounds})')
             else:
                 quick_imshow(first_image, title=title)
                 print('Select vertical data reduction range from first tomography image')