Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-rijsketic committed Jul 2, 2024
2 parents 40f7d45 + aafba2d commit 83cefc3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion unravel/image_tools/atlas/relabel_nii.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def main():

# Load the NIfTI image
nii = nib.load(args.input)
img = nii.get_fdata(dtye=np.float32)
img = nii.get_fdata(dtype=np.float32)

# Initialize an empty ndarray with the same shape as img and data type uint16
if args.data_type:
Expand Down
6 changes: 3 additions & 3 deletions unravel/image_tools/unique_intensities.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
Usage for printing the number of voxels for each intensity that is present:
---------------------------------------------------------------------------
img_unique -i path/input_img.nii.gz
img_unique -i path/input_img.nii.gz -s
Usage for checking which clusters are present if the min cluster size was 100 voxels:
-------------------------------------------------------------------------------------
Usage for printing unique intensities w/ a min cluster size > 100 voxels:
-------------------------------------------------------------------------
img_unique -i path/input_img.nii.gz -m 100
"""

Expand Down
11 changes: 5 additions & 6 deletions unravel/register/reg.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def parse_args():

# Optional arguments:
parser.add_argument('-f', '--fixed_img', help='reg_inputs/autofl_50um_masked.nii.gz (from ``reg_prep``)', default="reg_inputs/autofl_50um_masked.nii.gz", action=SM)
parser.add_argument('-o', '--output', help='Warped moving image aligned with the fixed image. Default: <moving_img>__warped_moving_img.nii.gz', default=None, action=SM)
parser.add_argument('-mas', '--mask', help="Brain mask for bias correction. Default: reg_inputs/autofl_50um_brain_mask.nii.gz. or pass in None", default="reg_inputs/autofl_50um_brain_mask.nii.gz", action=SM)
parser.add_argument('-ro', '--reg_outputs', help="Name of folder w/ outputs from ``reg`` (e.g., transforms). Default: reg_outputs", default="reg_outputs", action=SM)
parser.add_argument('-tp', '--tform_prefix', help='Prefix of transforms output from ants.registration. Default: ANTsPy_', default="ANTsPy_", action=SM)
Expand All @@ -63,7 +62,7 @@ def parse_args():
parser.add_argument('-ort', '--ort_code', help='3 letter orientation code of fixed image if not set in fixed_img (e.g., RAS)', action=SM)
parser.add_argument('-ia', '--init_align', help='Name of initially aligned image (moving reg input). Default: <moving_img>__initial_alignment_to_fixed_img.nii.gz' , default=None, action=SM)
parser.add_argument('-it', '--init_time', help='Time in seconds allowed for ``reg_affine_initializer`` to run. Default: 30' , default='30', type=str, action=SM)
parser.add_argument('-a', '--atlas', help='path/atlas.nii.gz (Default: /usr/local/unravel/atlases/gubra/gubra_ano_combined_25um.nii.gz)', default='/usr/local/unravel/atlases/gubra/gubra_ano_combined_25um.nii.gz', action=SM)
parser.add_argument('-a', '--atlas', help='path/atlas.nii.gz (outputs <reg_outputs>/<atlas>_in_tissue_space.nii.gz for checking reg; Default: /usr/local/unravel/atlases/gubra/gubra_ano_combined_25um.nii.gz)', default='/usr/local/unravel/atlases/gubra/gubra_ano_combined_25um.nii.gz', action=SM)
parser.add_argument('-v', '--verbose', help='Increase verbosity.', action='store_true', default=False)
parser.epilog = __doc__
return parser.parse_args()
Expand Down Expand Up @@ -148,7 +147,7 @@ def main():
reg_inputs_fixed_img_nii = nib.Nifti1Image(fixed_img, fixed_img_nii.affine.copy(), fixed_img_nii.header)
reg_inputs_fixed_img_nii.set_data_dtype(np.float32)

# Set the orientation of the image (use if not already set correctly in the header; check with ``io_nii``)
# Set the orientation of the image (use if not already set correctly in the header; check with ``io_nii_info``)
if args.ort_code:
reg_inputs_fixed_img_nii = reorient_nii(reg_inputs_fixed_img_nii, args.ort_code, zero_origin=True, apply=False, form_code=1)

Expand Down Expand Up @@ -203,10 +202,10 @@ def main():
print(f'\n Running registration \n')
output_prefix = str(Path(reg_outputs_path, args.tform_prefix))
reg = ants.registration(
fixed=fixed_image, # e.g., fixed autofluo image
moving=transformed_image, # e.g., the initially aligned moving image (e.g., template)
fixed=fixed_image, # e.g., fixed autofluo image
moving=transformed_image, # e.g., the initially aligned moving image (e.g., template)
type_of_transform='SyN', # SyN = symmetric normalization
grad_step=0.1, # Gradient step size
grad_step=0.1, # Gradient step size
syn_metric='CC', # Cross-correlation
syn_sampling=2, # Corresponds to CC radius
reg_iterations=(100, 70, 50, 20), # Convergence criteria
Expand Down

0 comments on commit 83cefc3

Please sign in to comment.