# HG changeset patch # User rv43 # Date 1679503586 0 # Node ID 50923144fb56d13e4fa3e6d712a6e2253b62ab7b # Parent 98eee43a8c8cb573e9d91f1750e8e8d7a58f5f43 planemo upload for repository https://github.com/rolfverberg/galaxytools commit f8c4bdb31c20c468045ad5e6eb255a293244bc6c diff -r 98eee43a8c8c -r 50923144fb56 __pycache__/fit.cpython-39.pyc Binary file __pycache__/fit.cpython-39.pyc has changed diff -r 98eee43a8c8c -r 50923144fb56 __pycache__/general.cpython-39.pyc Binary file __pycache__/general.cpython-39.pyc has changed diff -r 98eee43a8c8c -r 50923144fb56 run_link_to_galaxy --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run_link_to_galaxy Wed Mar 22 16:46:26 2023 +0000 @@ -0,0 +1,5 @@ +#!/bin/bash + +python -m workflow link_to_galaxy -i sobhani-3249-A_start.nxs -g 'https://galaxy-dev.classe.cornell.edu' -a 'bd404baf78eef76657277f33021d408f' +python -m workflow link_to_galaxy -i tenstom_1304r-1_start.nxs -g 'https://galaxy-dev.classe.cornell.edu' -a 'bd404baf78eef76657277f33021d408f' +python -m workflow link_to_galaxy -i tenstom_1304r-1_one_stack_start.nxs -g 'https://galaxy-dev.classe.cornell.edu' -a 'bd404baf78eef76657277f33021d408f' diff -r 98eee43a8c8c -r 50923144fb56 run_tomo_combine --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run_tomo_combine Wed Mar 22 16:46:26 2023 +0000 @@ -0,0 +1,9 @@ +#!/bin/bash + +# From workflow +#python -m workflow run_tomo -i sobhani-3249-A_recon.nxs -o sobhani-3249-A_recon_combined.nxs -n 48 -s 'only' --combine_data +#python -m workflow run_tomo -i tenstom_1304r-1_one_stack_recon.nxs -o tenstom_1304r-1_one_stack_recon_combined.nxs -n 48 -s 'only' --combine_data +#python -m workflow run_tomo -i tenstom_1304r-1_recon.nxs -o tenstom_1304r-1_recon_combined.nxs -n 48 -s 'only' --combine_data + +# As Galaxy tool: +python tomo_combine.py -i tenstom_1304r-1_recon.nxs -o tenstom_1304r-1_recon_combined.nxs --log_level INFO -l tomo.log --galaxy_flag diff -r 98eee43a8c8c -r 50923144fb56 run_tomo_find_center --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run_tomo_find_center Wed Mar 22 16:46:26 2023 +0000 @@ -0,0 +1,11 @@ +#!/bin/bash + +# From workflow +#python -m workflow run_tomo -i sobhani-3249-A_reduce.nxs -o sobhani-3249-A_centers.yaml -n 48 -s 'only' --find_center +#python -m workflow run_tomo -i tenstom_1304r-1_one_stack_reduce.nxs -o tenstom_1304r-1_one_stack_centers.yaml -n 48 -s 'only' --find_center +#python -m workflow run_tomo -i tenstom_1304r-1_reduce.nxs -o tenstom_1304r-1_centers.yaml -n 48 -s 'only' --find_center + +# As Galaxy tool: +#python tomo_find_center.py -i sobhani-3249-A_reduce.nxs -o sobhani-3249-A_centers.yaml --log_level INFO -l tomo.log --galaxy_flag --center_rows 50 270 +#python tomo_find_center.py -i tenstom_1304r-1_one_stack_reduce.nxs -o tenstom_1304r-1_one_stack_centers.yaml --log_level INFO -l tomo.log --galaxy_flag --center_rows 75 850 +python tomo_find_center.py -i tenstom_1304r-1_reduce.nxs -o tenstom_1304r-1_centers.yaml --log_level INFO -l tomo.log --galaxy_flag diff -r 98eee43a8c8c -r 50923144fb56 run_tomo_reconstruct --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run_tomo_reconstruct Wed Mar 22 16:46:26 2023 +0000 @@ -0,0 +1,11 @@ +#!/bin/bash + +# From workflow +#python -m workflow run_tomo -i sobhani-3249-A_reduce.nxs -c sobhani-3249-A_centers.yaml -o sobhani-3249-A_recon.nxs -n 48 -s 'only' --reconstruct_data +#python -m workflow run_tomo -i tenstom_1304r-1_one_stack_reduce.nxs -c tenstom_1304r-1_one_stack_centers.yaml -o tenstom_1304r-1_one_stack_recon.nxs -n 48 -s 'only' --reconstruct_data +#python -m workflow run_tomo -i tenstom_1304r-1_reduce.nxs -c tenstom_1304r-1_centers.yaml -o tenstom_1304r-1_recon.nxs -n 48 -s 'only' --reconstruct_data + +# As Galaxy tool: +#python tomo_reconstruct.py -i sobhani-3249-A_reduce.nxs -c sobhani-3249-A_centers.yaml -o sobhani-3249-A_recon.nxs --log_level INFO -l tomo.log --galaxy_flag --x_bounds 650 1050 --y_bounds 270 1430 +#python tomo_reconstruct.py -i tenstom_1304r-1_one_stack_reduce.nxs -c tenstom_1304r-1_one_stack_centers.yaml -o tenstom_1304r-1_one_stack_recon.nxs --log_level INFO -l tomo.log --galaxy_flag --x_bounds 629 1450 --y_bounds 606 1468 +python tomo_reconstruct.py -i tenstom_1304r-1_reduce.nxs -c tenstom_1304r-1_centers.yaml -o tenstom_1304r-1_recon.nxs --log_level INFO -l tomo.log --galaxy_flag --x_bounds 629 1450 --y_bounds 606 1468 diff -r 98eee43a8c8c -r 50923144fb56 run_tomo_reduce --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/run_tomo_reduce Wed Mar 22 16:46:26 2023 +0000 @@ -0,0 +1,11 @@ +#!/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 sobhani-3249-A_start.nxs -o sobhani-3249-A_reduce.nxs --log_level INFO -l tomo.log --galaxy_flag --img_x_bounds 620 950 +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 diff -r 98eee43a8c8c -r 50923144fb56 tomo_combine.xml --- a/tomo_combine.xml Wed Mar 22 12:56:22 2023 +0000 +++ b/tomo_combine.xml Wed Mar 22 16:46:26 2023 +0000 @@ -1,43 +1,56 @@ - + Combine reconstructed tomography stacks tomo_macros.xml - + + + - -
- - -
-
- - -
-
- - -
+ + + + + + + + + + + + + + + + + + + + + + +
- - - + + - + + Find the center axis for a tomography reconstruction tomo_macros.xml diff -r 98eee43a8c8c -r 50923144fb56 tomo_macros.xml --- a/tomo_macros.xml Wed Mar 22 12:56:22 2023 +0000 +++ b/tomo_macros.xml Wed Mar 22 16:46:26 2023 +0000 @@ -10,19 +10,13 @@ -@misc{github_files, +@misc{chess_tomography, author = {Verberg, Rolf}, - year = {2022}, + year = {2023}, title = {Tomo Reconstruction}, } - diff -r 98eee43a8c8c -r 50923144fb56 tomo_reconstruct.xml --- a/tomo_reconstruct.xml Wed Mar 22 12:56:22 2023 +0000 +++ b/tomo_reconstruct.xml Wed Mar 22 16:46:26 2023 +0000 @@ -1,4 +1,4 @@ - + Perform a tomography reconstruction tomo_macros.xml @@ -49,7 +49,7 @@ - + diff -r 98eee43a8c8c -r 50923144fb56 tomo_reduce.xml --- a/tomo_reduce.xml Wed Mar 22 12:56:22 2023 +0000 +++ b/tomo_reduce.xml Wed Mar 22 16:46:26 2023 +0000 @@ -1,4 +1,4 @@ - + Reduce tomography images tomo_macros.xml @@ -19,15 +19,24 @@ - - - - + + + + - - - - + + + + + + + + + + + + + diff -r 98eee43a8c8c -r 50923144fb56 workflow/__pycache__/__version__.cpython-39.pyc Binary file workflow/__pycache__/__version__.cpython-39.pyc has changed diff -r 98eee43a8c8c -r 50923144fb56 workflow/__pycache__/models.cpython-39.pyc Binary file workflow/__pycache__/models.cpython-39.pyc has changed diff -r 98eee43a8c8c -r 50923144fb56 workflow/__pycache__/run_tomo.cpython-39.pyc Binary file workflow/__pycache__/run_tomo.cpython-39.pyc has changed diff -r 98eee43a8c8c -r 50923144fb56 workflow/run_tomo.py --- a/workflow/run_tomo.py Wed Mar 22 12:56:22 2023 +0000 +++ b/workflow/run_tomo.py Wed Mar 22 16:46:26 2023 +0000 @@ -15,7 +15,7 @@ from multiprocessing import cpu_count from nexusformat.nexus import * -from os import mkdir +from os import mkdir, environ from os import path as os_path try: from skimage.transform import iradon @@ -99,7 +99,7 @@ self.num_core = num_core def __enter__(self): - self.num_core_org = ne.set_num_threads(self.num_core) + self.num_core_org = ne.set_num_threads(min(self.num_core, ne.MAX_THREADS)) def __exit__(self, exc_type, exc_value, traceback): ne.set_num_threads(self.num_core_org) @@ -773,7 +773,7 @@ # Take median if tdf_stack.ndim == 2: - tdf = tdf_stack + tdf = tdf_stack.astype('float64') elif tdf_stack.ndim == 3: tdf = np.median(tdf_stack, axis=0) del tdf_stack @@ -841,7 +841,7 @@ We don’t typically account for them but potentially could. """ if tbf_stack.ndim == 2: - tbf = tbf_stack + tbf = tbf_stack.astype('float64') elif tbf_stack.ndim == 3: tbf = np.median(tbf_stack, axis=0) del tbf_stack @@ -856,7 +856,7 @@ # Set any non-positive values to one # (avoid negative bright field values for spikes in dark field) - tbf[tbf < 1] = 1 + tbf[tbf < 1.0] = 1.0 # Plot bright field if self.galaxy_flag: @@ -1069,23 +1069,29 @@ """ # Get full bright field tbf = np.asarray(reduced_data.data.bright_field) - tbf_shape = tbf.shape + img_shape = tbf.shape # Get image bounds - img_x_bounds = tuple(reduced_data.get('img_x_bounds', (0, tbf_shape[0]))) - img_y_bounds = tuple(reduced_data.get('img_y_bounds', (0, tbf_shape[1]))) + img_x_bounds = tuple(reduced_data.get('img_x_bounds', (0, img_shape[0]))) + img_y_bounds = tuple(reduced_data.get('img_y_bounds', (0, img_shape[1]))) + if img_x_bounds == (0, img_shape[0]) and img_y_bounds == (0, img_shape[1]): + resize_flag = False + else: + resize_flag = True # Get resized dark field -# if 'dark_field' in data: -# tbf = np.asarray(reduced_data.data.dark_field[ -# img_x_bounds[0]:img_x_bounds[1],img_y_bounds[0]:img_y_bounds[1]]) -# else: -# logger.warning('Dark field unavailable') -# tdf = None - tdf = None + if 'dark_field' in reduced_data.data: + if resize_flag: + tdf = np.asarray(reduced_data.data.dark_field[ + img_x_bounds[0]:img_x_bounds[1],img_y_bounds[0]:img_y_bounds[1]]) + else: + tdf = np.asarray(reduced_data.data.dark_field) + else: + logger.warning('Dark field unavailable') + tdf = None # Resize bright field - if img_x_bounds != (0, tbf.shape[0]) or img_y_bounds != (0, tbf.shape[1]): + if resize_flag: tbf = tbf[img_x_bounds[0]:img_x_bounds[1],img_y_bounds[0]:img_y_bounds[1]] # Get the tomography images @@ -1145,13 +1151,15 @@ else: path = self.output_folder for i, tomo_stack in enumerate(tomo_stacks): - # Resize the tomography images - # Right now the range is the same for each set in the image stack. - if img_x_bounds != (0, tbf.shape[0]) or img_y_bounds != (0, tbf.shape[1]): + # Resize the tomography images as needed + # Right now the range is the same for each set in the image stack + if resize_flag: t0 = time() tomo_stack = tomo_stack[:,img_x_bounds[0]:img_x_bounds[1], img_y_bounds[0]:img_y_bounds[1]].astype('float64') logger.debug(f'Resizing tomography images took {time()-t0:.2f} seconds') + else: + tomo_stack = tomo_stack.astype('float64') # Subtract dark field if tdf is not None: