Skip to content

Commit

Permalink
fixed offset convention. this refs #50
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanBilheux committed Feb 16, 2022
1 parent 4f9c9dd commit bde6a79
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ 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(int(image_width / vox_xy_to_use) * det_x_to_use) - 1
n_vox_y = int(int(image_width / vox_xy_to_use) * det_x_to_use) - 1
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(int(crop_width / vox_xy_to_use) * det_x_to_use) - 1
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
Expand All @@ -74,10 +74,10 @@ def from_config_to_session_dict(self):
else:
if session_dict.get('crop', None) is None:
image_height = self.parent.image_size['height']
n_vox_z = int(int(image_height / vox_z_to_use) * det_y_to_use) - 1
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(int(crop_height / vox_z_to_use) * det_y_to_use) - 1
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
10 changes: 10 additions & 0 deletions src/pyMBIR_UI/reconstruction_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,12 @@ def initialization(self):
ReconstructionLauncher.initialization(self)
self.parent.list_file_found_in_output_folder = None

@staticmethod
def _fix_n_vox(dictionary_of_arguments):
dictionary_of_arguments["n_vox_x"] = dictionary_of_arguments["n_vox_x"] - 1
dictionary_of_arguments["n_vox_y"] = dictionary_of_arguments["n_vox_y"] - 1
dictionary_of_arguments["n_vox_z"] = dictionary_of_arguments["n_vox_z"] - 1

def run(self):
logging.info("Running reconstruction in Batch mode")
logging.info(f"-> algorithm selected: {self.reconstruction_algorithm_selected}")
Expand All @@ -149,6 +155,10 @@ def run(self):
logging.info(f"-> reset temporary folder: {dictionary_of_arguments['temp_op_dir']}")
make_or_reset_folder(dictionary_of_arguments['temp_op_dir'])

# fix n_vox_x, n_vox_y and n_vox_z to follow pymbir convention
# n_vox_x, y and z have a start index of 1 in the UI, 0 in the algorithm
ReconstructionBatchLauncher._fix_n_vox(dictionary_of_arguments)

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

self.parent.ui.reconstruction_launch_pushButton.setEnabled(False)
Expand Down
16 changes: 14 additions & 2 deletions src/pyMBIR_UI/ui/advanced_settings.ui
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@
<item>
<widget class="QLabel" name="n_vox_x_n_vox_y_fixed_value">
<property name="text">
<string>0</string>
<string>1</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -661,6 +661,9 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10000</number>
</property>
Expand Down Expand Up @@ -705,6 +708,9 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10000</number>
</property>
Expand Down Expand Up @@ -738,6 +744,9 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10000</number>
</property>
Expand Down Expand Up @@ -789,7 +798,7 @@
<item>
<widget class="QLabel" name="n_vox_z_fixed_value">
<property name="text">
<string>0</string>
<string>1</string>
</property>
</widget>
</item>
Expand Down Expand Up @@ -832,6 +841,9 @@
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>10000</number>
</property>
Expand Down

0 comments on commit bde6a79

Please sign in to comment.