Skip to content

Commit

Permalink
writing the reconstructed files to the right location.
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanBilheux committed Feb 16, 2022
1 parent b0caa9e commit 805b34b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
10 changes: 7 additions & 3 deletions src/pyMBIR_UI/recon_HFIR_script_batch.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,15 @@ def main():
#pg.image(rec_mbir);
#pg.QtGui.QApplication.exec_()
if input_dict["write_op"] == True:
dxchange.write_tiff_stack(rec_mbir, fname=input_dict["op_path"], start=z_start, overwrite=True)
print(f"input_dict['op_path']: {input_dict['op_path']}")
temp_path = os.path.join(input_dict['op_path'], "mbir")
dxchange.write_tiff_stack(rec_mbir, fname=temp_path, start=z_start, overwrite=True)

# when done write stop file in batch mode
#if input_dict["running_mode"] == "batch":
# with open(STOP_FILE_NAME
if input_dict["running_mode"] == "batch":
with open(STOP_FILE_NAME, 'w') as json_file:
json.dump({"stop": True}, json_file)


if __name__ == "__main__":
main()
24 changes: 15 additions & 9 deletions src/pyMBIR_UI/reconstruction_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,18 +141,19 @@ def run(self):
# 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'], base_output_folder +
"_pymbir_reconstructed")
dictionary_of_arguments['op_path'] = full_output_folder
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}")

dictionary_of_arguments['temp_op_dir'] = os.path.join(dictionary_of_arguments['op_path'], "temporary_pymbir_reconstructed")
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']}")
Expand All @@ -167,7 +168,7 @@ def run(self):

logging.info(f"-> Saving config file to be called from command line script")
home_folder = os.path.expanduser("~")
json_file_name = os.path.join(home_folder, "config_batch_mode.json" )
json_file_name = os.path.join(home_folder, "config_batch_mode.json")
with open(json_file_name, 'w') as json_file:
json.dump(dictionary_of_arguments, json_file)

Expand Down Expand Up @@ -296,9 +297,14 @@ def check_output_file(self):
o_event.update_output_plot()

def check_output_3d_volume(self):
output_folder = self.dictionary_of_arguments["op_path"]
print("in check 3D")
base_output_folder = os.path.basename(self.dictionary_of_arguments['data_path'])
output_folder = self.dictionary_of_arguments['op_path']
print(f"output_folder: {output_folder}")
list_tiff_files_in_output_folder = glob.glob(os.path.join(output_folder, "*.tif?"))
print(f"list tiff:{list_tiff_files_in_output_folder}")
number_of_files_in_output_folder = len(list_tiff_files_in_output_folder)
print(f"number of files: {number_of_files_in_output_folder}")
if number_of_files_in_output_folder == 0:
self.parent.ui.tabWidget_3.setTabEnabled(1, False)
return
Expand Down

0 comments on commit 805b34b

Please sign in to comment.