Mercurial > repos > rv43 > chess_tomo
changeset 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 | fbbd82938303 |
| children | 36576bdb2e2e |
| files | run_tomo_reduce tomo_find_center.xml tomo_reconstruct.xml tomo_reduce.xml workflow/run_tomo.py |
| diffstat | 5 files changed, 29 insertions(+), 24 deletions(-) [+] |
line wrap: on
line diff
--- a/run_tomo_reduce Tue Mar 21 16:47:44 2023 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,11 +0,0 @@ -#!/bin/bash - -# From workflow -#python -m workflow run_tomo -i sobhani-3249-A.yaml -o sobhani-3249-A_reduce.nxs -n 48 -s 'only' --reduce_data -#python -m workflow run_tomo -i tenstom_1304r-1_one_stack.yaml -o tenstom_1304r-1_one_stack_reduce.nxs -n 48 -s 'only' --reduce_data -#python -m workflow run_tomo -i tenstom_1304r-1.yaml -o tenstom_1304r-1_reduce.nxs -n 48 -s 'only' --reduce_data - -# As Galaxy tool: -python tomo_reduce.py -i "../../../Tomo/sobhani-3249-A_start.nxs" -o sobhani-3249-A_reduce.nxs --log_level INFO -l tomo.log --galaxy_flag --img_x_bounds -1 -1 -#python tomo_reduce.py -i tenstom_1304r-1_one_stack_start.nxs -o tenstom_1304r-1_one_stack_reduce.nxs --log_level INFO -l tomo.log --galaxy_flag #--img_x_bounds 582 1509 -#python tomo_reduce.py -i tenstom_1304r-1_start.nxs -o tenstom_1304r-1_reduce.nxs --log_level INFO -l tomo.log --galaxy_flag #--img_x_bounds 713 1388
--- a/tomo_find_center.xml Tue Mar 21 16:47:44 2023 +0000 +++ b/tomo_find_center.xml Tue Mar 21 17:40:36 2023 +0000 @@ -17,7 +17,7 @@ </command> <inputs> <param name="input_file" type="data" format="nex" optional="false" label="Reduced tomography data"/> - <section name="center_rows" title="Reconstruction row bounds"> + <section name="center_rows" title="Find center axis planes"> <param name="low" type="integer" value="-1" label="Lower bound"/> <param name="upp" type="integer" value="-1" label="Upper bound"/> </section>
--- a/tomo_reconstruct.xml Tue Mar 21 16:47:44 2023 +0000 +++ b/tomo_reconstruct.xml Tue Mar 21 17:40:36 2023 +0000 @@ -12,12 +12,22 @@ --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 -l "$log" ]]> </command> <inputs> <param name="input_file" type="data" format="nex" optional="false" label="Reduced tomography data"/> <param name="center_file" type="data" format="yaml" optional="false" label="Center axis input file"/> + <section name="x_bounds" title="Boundaries of reconstructed images in x-direction"> + <param name="low" type="integer" value="-1" label="Lower bound"/> + <param name="upp" type="integer" value="-1" label="Upper bound"/> + </section> + <section name="y_bounds" title="Boundaries of reconstructed images in y-direction"> + <param name="low" type="integer" value="-1" label="Lower bound"/> + <param name="upp" type="integer" value="-1" label="Upper bound"/> + </section> </inputs> <outputs> <expand macro="common_outputs"/>
--- a/tomo_reduce.xml Tue Mar 21 16:47:44 2023 +0000 +++ b/tomo_reduce.xml Tue Mar 21 17:40:36 2023 +0000 @@ -11,16 +11,25 @@ --input_file "$input_file" --output_file "output.nex" --galaxy_flag - --img_x_bounds $img_x_bounds.low $img_x_bounds.upp + #if str($img_bounds.type_selector) == "enter_range" + --img_x_bounds $img_bounds.low $img_bounds.upp + #end if -l "$log" ]]> </command> <inputs> <param name="input_file" type="data" optional="false" label="Input file"/> - <section name="img_x_bounds" title="Reduction x bounds"> - <param name="low" type="integer" value="-1" label="Lower bound"/> - <param name="upp" type="integer" value="-1" label="Upper bound"/> - </section> + <conditional name="img_bounds"> + <param name="type_selector" type="select" label="Choose image range for data reduction"> + <option value="full_range" selected="true">Use the full image range</option> + <option value="enter_range">Manually enter the image range</option> + </param> + <when value="full_range"/> + <when value="enter_range"> + <param name="low" type="integer" optional="false" label="Lower image range index in vertical direction"/> + <param name="upp" type="integer" optional="false" label="Upper image range index in vertical direction"/> + </when> + </conditional> </inputs> <outputs> <expand macro="common_outputs"/>
--- 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')
