# HG changeset patch
# User rv43
# Date 1679424362 0
# Node ID 551d1ea2416d0976900e2efaeaacf1690f8eaded
# Parent 562fc79de827b91b289933dc0ff495cc5cae2a64
planemo upload for repository https://github.com/rolfverberg/galaxytools commit f8c4bdb31c20c468045ad5e6eb255a293244bc6c-dirty
diff -r 562fc79de827 -r 551d1ea2416d tomo_find_center.xml
--- a/tomo_find_center.xml Tue Mar 21 17:59:41 2023 +0000
+++ b/tomo_find_center.xml Tue Mar 21 18:46:02 2023 +0000
@@ -11,16 +11,25 @@
--input_file "$input_file"
--output_file "output.yaml"
--galaxy_flag
- --center_rows $center_rows.low $center_rows.upp
+ #if str($center_rows.type_selector) == "enter_range"
+ --center_rows $center_rows.low $center_rows.upp
+ #end if
-l "$log"
]]>
-
+
+
+
+
+
+
+
+
+
+
+
diff -r 562fc79de827 -r 551d1ea2416d tomo_reconstruct.xml
--- a/tomo_reconstruct.xml Tue Mar 21 17:59:41 2023 +0000
+++ b/tomo_reconstruct.xml Tue Mar 21 18:46:02 2023 +0000
@@ -12,22 +12,40 @@
--center_file "$center_file"
--output_file "output.nex"
--galaxy_flag
- --x_bounds $x_bounds.low $x_bounds.upp
- --y_bounds $y_bounds.low $y_bounds.upp
+ #if str($x_bounds.type_selector) == "enter_range"
+ --x_bounds $x_bounds.low $x_bounds.upp
+ #end if
+ #if str($y_bounds.type_selector) == "enter_range"
+ --y_bounds $y_bounds.low $y_bounds.upp
+ #end if
-l "$log"
]]>
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 562fc79de827 -r 551d1ea2416d workflow/run_tomo.py
--- a/workflow/run_tomo.py Tue Mar 21 17:59:41 2023 +0000
+++ b/workflow/run_tomo.py Tue Mar 21 18:46:02 2023 +0000
@@ -301,14 +301,18 @@
nxentry = nxroot[nxroot.attrs['default']]
if not isinstance(nxentry, NXentry):
raise ValueError(f'Invalid nxentry ({nxentry})')
- if self.galaxy_flag:
- if center_rows is not None:
- center_rows = tuple(center_rows)
- if not is_int_pair(center_rows):
+ if center_rows is not None:
+ if self.galaxy_flag
+ is not is_int_pair(center_rows, ge=-1):
raise ValueError(f'Invalid parameter center_rows ({center_rows})')
- elif center_rows is not None:
- logger.warning(f'Ignoring parameter center_rows ({center_rows})')
- center_rows = None
+ if (center_rows[0] != -1 and center_rows[1] != -1 and
+ center_rows[0] > center_rows[1]):
+ center_rows = (center_rows[1], center_rows[0])
+ else:
+ center_rows = tuple(center_rows)
+ else:
+ logger.warning(f'Ignoring parameter center_rows ({center_rows})')
+ center_rows = None
if self.galaxy_flag:
if center_stack_index is not None and not is_int(center_stack_index, ge=0):
raise ValueError(f'Invalid parameter center_stack_index ({center_stack_index})')
@@ -377,7 +381,7 @@
if center_rows is None or center_rows[0] == -1:
lower_row = 0
else:
- lower_row = min(center_rows)
+ lower_row = center_rows[0]
if not 0 <= lower_row < tomo_fields_shape[2]-1:
raise ValueError(f'Invalid parameter center_rows ({center_rows})')
else:
@@ -388,7 +392,6 @@
logger.debug('Finding center...')
t0 = time()
lower_center_offset = self._find_center_one_plane(
- #np.asarray(nxentry.reduced_data.data.tomo_fields[center_stack_index,:,lower_row,:]),
nxentry.reduced_data.data.tomo_fields[center_stack_index,:,lower_row,:],
lower_row, thetas, eff_pixel_size, cross_sectional_dim, path=path,
num_core=self.num_core)
@@ -403,7 +406,7 @@
if center_rows is None or center_rows[1] == -1:
upper_row = tomo_fields_shape[2]-1
else:
- upper_row = max(center_rows)
+ upper_row = center_rows[1]
if not lower_row < upper_row < tomo_fields_shape[2]:
raise ValueError(f'Invalid parameter center_rows ({center_rows})')
else:
@@ -513,15 +516,31 @@
# Resize the reconstructed tomography data
# reconstructed data order in each stack: row/z,x,y
if self.test_mode:
- x_bounds = self.test_config.get('x_bounds')
- y_bounds = self.test_config.get('y_bounds')
+ x_bounds = tuple(self.test_config.get('x_bounds'))
+ y_bounds = tuple(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=-1,
- lt=tomo_recon_stacks[0].shape[1]):
+ x_max = tomo_recon_stacks[0].shape[1]
+ if x_bounds is None:
+ x_bounds = (0, x_max)
+ elif is_int_pair(x_bounds, ge=-1, le=x_max):
+ x_bounds = tuple(x_bounds)
+ if x_bounds[0] == -1:
+ x_bounds = (0, x_bounds[1])
+ if x_bounds[1] == -1:
+ x_bounds = (x_bounds[0], x_max)
+ if not is_index_range(x_bounds, ge=0, le=x_max):
raise ValueError(f'Invalid parameter x_bounds ({x_bounds})')
- if y_bounds is not None and not is_int_pair(y_bounds, ge=-1,
- lt=tomo_recon_stacks[0].shape[1]):
+ y_max = tomo_recon_stacks[0].shape[1]
+ if y_bounds is None:
+ y_bounds = (0, y_max)
+ elif is_int_pair(y_bounds, ge=-1, le=y_max):
+ y_bounds = tuple(y_bounds)
+ if y_bounds[0] == -1:
+ y_bounds = (0, y_bounds[1])
+ if y_bounds[1] == -1:
+ y_bounds = (y_bounds[0], y_max)
+ if not is_index_range(y_bounds, ge=0, le=y_max):
raise ValueError(f'Invalid parameter y_bounds ({y_bounds})')
z_bounds = None
else:
@@ -989,10 +1008,11 @@
if img_x_bounds is None:
img_x_bounds = (0, first_image.shape[0])
elif is_int_pair(img_x_bounds, ge=-1, le=first_image.shape[0]):
+ img_x_bounds = tuple(img_x_bounds)
if img_x_bounds[0] == -1:
- img_x_bounds[0] = 0
+ img_x_bounds = (0, img_x_bounds[1])
if img_x_bounds[1] == -1:
- img_x_bounds[1] = first_image.shape[0]
+ img_x_bounds = (img_x_bounds[0], first_image.shape[0])
if 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: