Mercurial > repos > rv43 > tomo
comparison tomo.py @ 35:20829cd7aaef draft
"planemo upload for repository https://github.com/rolfverberg/galaxytools commit 2ddb1147cf5ad2fedfa2d9323c07ff16f8d9c869"
| author | rv43 |
|---|---|
| date | Tue, 19 Apr 2022 17:58:05 +0000 |
| parents | 63de912323e5 |
| children | 7ffde31e1e07 |
comparison
equal
deleted
inserted
replaced
| 34:63de912323e5 | 35:20829cd7aaef |
|---|---|
| 1145 t0 = time() | 1145 t0 = time() |
| 1146 # recon_sinogram = filters.gaussian(recon_sinogram, 3.0) | 1146 # recon_sinogram = filters.gaussian(recon_sinogram, 3.0) |
| 1147 recon_sinogram = spi.gaussian_filter(recon_sinogram, 0.5) | 1147 recon_sinogram = spi.gaussian_filter(recon_sinogram, 0.5) |
| 1148 recon_clean = np.expand_dims(recon_sinogram, axis=0) | 1148 recon_clean = np.expand_dims(recon_sinogram, axis=0) |
| 1149 del recon_sinogram | 1149 del recon_sinogram |
| 1150 logging.info('tomopy.misc.corr.remove_ring start') | |
| 1150 recon_clean = tomopy.misc.corr.remove_ring(recon_clean, rwidth=17, ncore=num_core) | 1151 recon_clean = tomopy.misc.corr.remove_ring(recon_clean, rwidth=17, ncore=num_core) |
| 1152 logging.info('tomopy.misc.corr.remove_ring end') | |
| 1151 logging.debug(f'filtering and removing ring artifact took {time()-t0:.2f} seconds!') | 1153 logging.debug(f'filtering and removing ring artifact took {time()-t0:.2f} seconds!') |
| 1152 return recon_clean | 1154 return recon_clean |
| 1153 | 1155 |
| 1154 def _plotEdgesOnePlane(self, recon_plane, title, path=None, weight=0.001): | 1156 def _plotEdgesOnePlane(self, recon_plane, title, path=None, weight=0.001): |
| 1155 # RV parameters for the denoise, gaussian, and ring removal will be different for different feature sizes | 1157 # RV parameters for the denoise, gaussian, and ring removal will be different for different feature sizes |
| 1181 # need index order column,theta for iradon, so take transpose | 1183 # need index order column,theta for iradon, so take transpose |
| 1182 sinogram_T = sinogram.T | 1184 sinogram_T = sinogram.T |
| 1183 center = sinogram.shape[1]/2 | 1185 center = sinogram.shape[1]/2 |
| 1184 | 1186 |
| 1185 # try automatic center finding routines for initial value | 1187 # try automatic center finding routines for initial value |
| 1188 logging.info('tomopy.find_center_vo start') | |
| 1186 tomo_center = tomopy.find_center_vo(sinogram, ncore=num_core) | 1189 tomo_center = tomopy.find_center_vo(sinogram, ncore=num_core) |
| 1190 logging.info('tomopy.find_center_vo end') | |
| 1187 center_offset_vo = tomo_center-center | 1191 center_offset_vo = tomo_center-center |
| 1188 if self.test_mode: | 1192 if self.test_mode: |
| 1189 logging.info(f'Center at row {row} using Nghia Vo’s method = {center_offset_vo:.2f}') | 1193 logging.info(f'Center at row {row} using Nghia Vo’s method = {center_offset_vo:.2f}') |
| 1190 del sinogram_T | 1194 del sinogram_T |
| 1191 return float(center_offset_vo) | 1195 return float(center_offset_vo) |
| 1537 def findCenters(self, galaxy_param=None, num_core=None): | 1541 def findCenters(self, galaxy_param=None, num_core=None): |
| 1538 """Find rotation axis centers for the tomography stacks. | 1542 """Find rotation axis centers for the tomography stacks. |
| 1539 """ | 1543 """ |
| 1540 if num_core is None: | 1544 if num_core is None: |
| 1541 num_core = self.num_core | 1545 num_core = self.num_core |
| 1542 logging.info(f'num_core = {num_core}') | 1546 # logging.info(f'num_core available = {num_core}') |
| 1547 # if num_core > 24: | |
| 1548 # num_core = 24 | |
| 1549 logging.info(f'num_core used = {num_core}') | |
| 1543 logging.debug('Find centers for tomography stacks') | 1550 logging.debug('Find centers for tomography stacks') |
| 1544 stacks = self.config['stack_info']['stacks'] | 1551 stacks = self.config['stack_info']['stacks'] |
| 1545 available_stacks = [stack['index'] for stack in stacks if stack.get('preprocessed', False)] | 1552 available_stacks = [stack['index'] for stack in stacks if stack.get('preprocessed', False)] |
| 1546 logging.debug('Available stacks: {available_stacks}') | 1553 logging.debug('Available stacks: {available_stacks}') |
| 1547 if self.galaxy_flag: | 1554 if self.galaxy_flag: |
