Skip to content

Commit

Permalink
n_vox_x, y and z are now integers. GPU number is at least 1. this refs
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanBilheux committed Feb 16, 2022
1 parent d5a7f19 commit addfcc7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,27 @@ def from_config_to_session_dict(self):
session_dict = self.parent.session_dict
if session_dict.get('crop', None) is None:
image_width = self.parent.image_size['width']
n_vox_x = int(image_width / vox_xy_to_use) * det_x_to_use
n_vox_y = int(image_width / vox_xy_to_use) * det_x_to_use
n_vox_x = int(int(image_width / vox_xy_to_use) * det_x_to_use)
n_vox_y = int(int(image_width / vox_xy_to_use) * det_x_to_use)
n_vox_x_y_value = n_vox_x
else:
crop_width = session_dict['crop']['width']
n_vox_x_y_value = int(crop_width / vox_xy_to_use) * det_x_to_use
n_vox_x_y_value = int(int(crop_width / vox_xy_to_use) * det_x_to_use)
n_vox_x = n_vox_x_y_value
n_vox_y = n_vox_x_y_value
n_vox_x_to_use = n_vox_x
n_vox_y_to_use = n_vox_y

n_vox_z_mode = config['n_vox_z']["mode"]
if n_vox_z_mode == "user":
n_vox_z = config['n_vox_z']['user_value']
n_vox_z = int(config['n_vox_z']['user_value'])
else:
if session_dict.get('crop', None) is None:
image_height = self.parent.image_size['height']
n_vox_z = int(image_height / vox_z_to_use) * det_y_to_use
n_vox_z = int(int(image_height / vox_z_to_use) * det_y_to_use)
else:
crop_height = session_dict['crop']['to slice - from slice']
n_vox_z = int(crop_height / vox_z_to_use) * det_y_to_use
n_vox_z = int(int(crop_height / vox_z_to_use) * det_y_to_use)
n_vox_z_to_use = n_vox_z

write_output_flag = config['write output']
Expand Down
2 changes: 0 additions & 2 deletions src/pyMBIR_UI/pyMBIR_UI.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ class PyMBIRUILauncher(QMainWindow):
# batch mode - last time a file was added to output folder
list_file_found_in_output_folder = None



def __init__(self, parent=None):

super(PyMBIRUILauncher, self).__init__(parent)
Expand Down
17 changes: 6 additions & 11 deletions src/pyMBIR_UI/reconstruction_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from .status_message_config import show_status_message, StatusMessageStatus
from .event_handler import EventHandler
from NeuNorm.normalization import Normalization
from .utilities.file_utilities import make_or_reset_folder
from .utilities.file_utilities import make_or_reset_folder, make_folder
from .venkat_function import MBIR_fromGUI
# from .recon_HFIR_script_batch import recon_HFIR_script_launcher
from .reconstructed_output_handler import ReconstructedOutputHandler
Expand Down Expand Up @@ -138,28 +138,23 @@ def run(self):
dictionary_of_arguments = o_dictionary.get_dictionary()
dictionary_of_arguments['running_mode'] = 'batch'

# for debugging only !!! remove me
#dictionary_of_arguments['n_vox_z'] = 6

base_output_folder = os.path.basename(dictionary_of_arguments['data_path'])
full_output_folder = os.path.join(dictionary_of_arguments['op_path'])

# full_output_folder = os.path.join(dictionary_of_arguments['op_path'], base_output_folder +
# "_pymbir_reconstructed")
# dictionary_of_arguments['op_path'] = full_output_folder
logging.info(f"Final image will be output in {full_output_folder}")
make_or_reset_folder(dictionary_of_arguments['op_path'])
logging.info(f"Reset output folder: {full_output_folder}")
make_folder(dictionary_of_arguments['op_path'])
logging.info(f"Making sure output folder ({full_output_folder}) exists!")

dictionary_of_arguments['temp_op_dir'] = os.path.join(dictionary_of_arguments['op_path'], "temporary_pymbir_reconstructed")
self.tmp_output_folder = os.path.join(dictionary_of_arguments['op_path'], "temporary_pymbir_reconstructed")
dictionary_of_arguments['temp_op_dir'] = self.tmp_output_folder
logging.info(f"-> reset temporary folder: {dictionary_of_arguments['temp_op_dir']}")
make_or_reset_folder(dictionary_of_arguments['temp_op_dir'])

logging.info(f"-> Dictionary of arguments: {dictionary_of_arguments}")

logging.info(f"-> reset temporary folder: {dictionary_of_arguments['temp_op_dir']}")
make_or_reset_folder(dictionary_of_arguments['temp_op_dir'])
self.tmp_output_folder = dictionary_of_arguments['temp_op_dir']

self.parent.ui.reconstruction_launch_pushButton.setEnabled(False)
self.parent.ui.reconstruction_display_latest_output_file_pushButton.setEnabled(True)
self.parent.ui.reconstruction_batch_stop_pushButton.setEnabled(True)
Expand Down
5 changes: 5 additions & 0 deletions src/pyMBIR_UI/utilities/file_utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,8 @@ def make_or_reset_folder(folder_name):
if os.path.exists(folder_name):
shutil.rmtree(folder_name)
os.makedirs(folder_name)


def make_folder(folder_name):
if not os.path.exists(folder_name):
os.makedirs(folder_name)
2 changes: 1 addition & 1 deletion src/pyMBIR_UI/utilities/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def get_number_of_gpu():
return nbr_gpu

except FileNotFoundError:
return 0
return 1

@staticmethod
def full_home_file_name(base_file_name):
Expand Down

0 comments on commit addfcc7

Please sign in to comment.