Skip to content

Commit

Permalink
Merge pull request #40 from tomography/win
Browse files Browse the repository at this point in the history
Changes for windows
  • Loading branch information
nikitinvv committed Jun 1, 2023
2 parents 0ff27a0 + 60ef946 commit 50ea2b7
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 33 deletions.
3 changes: 2 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ requirements:
- numexpr
- numpy
- opencv
- opencv-contrib-python
- pywavelets
- tifffile
- tifffile

about:
home: https://github.com/tomography/tomocupy
Expand Down
10 changes: 0 additions & 10 deletions requirements.txt

This file was deleted.

1 change: 0 additions & 1 deletion src/cuda/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ include_directories(${PYTHON_INCLUDE_PATH})
# TODO: Is NumPy required?
#find_package(NumPy REQUIRED)
#include_directories(${NumPy_INCLUDE_DIRS})

# Must tell CMake that SWIG interface files are CXX files

set_source_files_properties(cfunc_fourierrec.i PROPERTIES CPLUSPLUS ON)
Expand Down
2 changes: 1 addition & 1 deletion src/tomocupy/rec.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def __init__(self, args):

# Set ^C, ^Z interrupt to abort and deallocate memory on GPU
signal.signal(signal.SIGINT, utils.signal_handler)
signal.signal(signal.SIGTSTP, utils.signal_handler)
signal.signal(signal.SIGTERM, utils.signal_handler)

# configure sizes and output files
cl_reader = reader.Reader(args)
Expand Down
2 changes: 1 addition & 1 deletion src/tomocupy/rec_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class GPURecSteps():
def __init__(self, args):
# Set ^C interrupt to abort and deallocate memory on GPU
signal.signal(signal.SIGINT, utils.signal_handler)
signal.signal(signal.SIGTSTP, utils.signal_handler)
signal.signal(signal.SIGTERM, utils.signal_handler)

# configure sizes and output files
cl_reader = reader.Reader(args)
Expand Down
17 changes: 11 additions & 6 deletions src/tomocupy/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ def init_output_files_try(self):
self.args.file_name)+'_rec/try_center/'+os.path.basename(self.args.file_name)[:-3]
else:
fnameout = str(self.args.out_path_name)
os.system(f'mkdir -p {fnameout}')
if not os.path.exists(fnameout):
os.makedirs(fnameout)
fnameout += '/recon'
self.fnameout = fnameout
if (self.args.clear_folder=='True'):
Expand All @@ -101,8 +102,9 @@ def init_output_files(self):
self.args.file_name)+'_rec/'+os.path.basename(self.args.file_name)[:-3]+'_rec'
else:
fnameout = str(self.args.out_path_name)
os.system(f'mkdir -p {fnameout}')

if not os.path.exists(fnameout):
os.makedirs(fnameout)

if (self.args.clear_folder=='True'):
log.info('Clearing the output folder')
os.system(f'rm {fnameout}/*')
Expand All @@ -122,8 +124,9 @@ def init_output_files(self):
fnameout += '.h5'
# Assemble virtual dataset
layout = h5py.VirtualLayout(shape=(
self.nzi/2**self.args.binning, self.n, self.n), dtype=self.dtype)
os.system(f'mkdir -p {fnameout[:-3]}_parts')
self.nzi/2**self.args.binning, self.n, self.n), dtype=self.dtype)
if not os.path.exists(f'{fnameout[:-3]}_parts'):
os.makedirs(f'{fnameout[:-3]}_parts')
for k in range(self.nzchunk):
filename = f"{fnameout[:-3]}_parts/p{k:04d}.h5"
vsource = h5py.VirtualSource(
Expand Down Expand Up @@ -181,7 +184,9 @@ def init_output_files(self):
# Assemble virtual dataset
layout = h5py.VirtualLayout(shape=(
self.nproj, self.nzi/2**self.args.binning, self.n), dtype=self.dtype)
os.system(f'mkdir -p {fnameout[:-3]}_parts')
if not os.path.exists(f'{fnameout[:-3]}_parts'):
os.makedirs(f'{fnameout[:-3]}_parts')

for k in range(self.nzchunk):
filename = f"{fnameout[:-3]}_parts/p{k:04d}.h5"
vsource = h5py.VirtualSource(
Expand Down
10 changes: 5 additions & 5 deletions tests/test_steps_try.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@

prefix = 'tomocupy recon_steps --file-name data/test_data.h5 --rotation-axis 782.5 --nsino-per-chunk 4'
cmd_dict = {
f'{prefix} --reconstruction-type try --lamino-angle 1 --reconstruction-algorithm linerec': 14.023,
f'{prefix} --reconstruction-type try_lamino --lamino-angle 1 --reconstruction-algorithm linerec': 37.060,
f'{prefix} --reconstruction-type try --rotate-proj-angle 1 --nsino [0,0.5]': 28.004,
f'{prefix} --reconstruction-type try --lamino-angle 1 --rotate-proj-angle 1 --nsino [0,0.5]': 26.180,
f'{prefix} --reconstruction-type try --binning 1 --rotate-proj-angle 1 --nsino [0,0.5]': 11.103,
f'{prefix} --center-search-width 10 --reconstruction-type try --lamino-angle 1 --reconstruction-algorithm linerec': 14.023,
f'{prefix} --center-search-width 10 --reconstruction-type try_lamino --lamino-angle 1 --reconstruction-algorithm linerec': 37.060,
f'{prefix} --center-search-width 10 --reconstruction-type try --rotate-proj-angle 1 --nsino [0,0.5]': 28.004,
f'{prefix} --center-search-width 10 --reconstruction-type try --lamino-angle 1 --rotate-proj-angle 1 --nsino [0,0.5]': 26.180,
f'{prefix} --center-search-width 10 --reconstruction-type try --binning 1 --rotate-proj-angle 1 --nsino [0,0.5]': 11.103,
}


Expand Down
16 changes: 8 additions & 8 deletions tests/test_try.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

prefix = 'tomocupy recon --file-name data/test_data.h5 --reconstruction-type try --rotation-axis 782.5 --nsino-per-chunk 4'
cmd_dict = {
f'{prefix} ': 13.98,
f'{prefix} --nsino [0,0.5] ': 28.36,
f'{prefix} --reconstruction-algorithm lprec ': 13.82,
f'{prefix} --reconstruction-algorithm linerec ': 14.00,
f'{prefix} --binning 1': 5.47,
f'{prefix} --nsino-per-chunk 2 --file-type double_fov': 7.67,
f'{prefix} --center-search-width 10 ': 13.98,
f'{prefix} --center-search-width 10 --nsino [0,0.5] ': 28.36,
f'{prefix} --center-search-width 10 --reconstruction-algorithm lprec ': 13.82,
f'{prefix} --center-search-width 10 --reconstruction-algorithm linerec ': 14.00,
f'{prefix} --center-search-width 10 --binning 1': 5.47,
f'{prefix} --center-search-width 10 --nsino-per-chunk 2 --file-type double_fov': 7.67,
f'{prefix} --center-search-width 30 --center-search-step 2': 12.70,
f'{prefix} --dezinger 2': 13.98,
f'{prefix} --flat-linear True': 13.98,
f'{prefix} --center-search-width 10 --dezinger 2': 13.98,
f'{prefix} --center-search-width 10 --flat-linear True': 13.98,
}


Expand Down

0 comments on commit 50ea2b7

Please sign in to comment.