Skip to content

Commit 6155edd

Browse files
committed
Add option to save IMS file in a specified location
1 parent 205869c commit 6155edd

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/imcflibs/imagej/misc.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@ def locate_latest_imaris(paths_to_check=None):
669669
return imaris_paths[-1]
670670

671671

672-
def run_imarisconvert(file_path, pixel_calibration=None):
672+
def run_imarisconvert(file_path, output_folder=None, pixel_calibration=None):
673673
"""Convert a given file to Imaris format using ImarisConvert.
674674
675675
Convert the input image file to Imaris format (Imaris5) using the
@@ -680,6 +680,8 @@ def run_imarisconvert(file_path, pixel_calibration=None):
680680
----------
681681
file_path : str
682682
Absolute path to the input image file.
683+
output_folder : str, optional
684+
Folder where the newly created IMS file will be saved, by default None.
683685
pixel_calibration : tuple or list, optional
684686
Sequence of 3 values (x, y, z) representing voxel dimensions to be set during
685687
conversion, by default None.
@@ -693,9 +695,12 @@ def run_imarisconvert(file_path, pixel_calibration=None):
693695

694696
imaris_path = locate_latest_imaris()
695697

698+
if not output_folder:
699+
output_folder = os.getcwd()
700+
696701
command = 'ImarisConvert.exe -i "%s" -of Imaris5 -o "%s"' % (
697702
file_path,
698-
file_path.replace(file_extension, ".ims"),
703+
os.path.join(output_folder, file_path.replace(file_extension, ".ims")),
699704
)
700705
if pixel_calibration:
701706
command = command + " --voxelsizex %s --voxelsizey %s --voxelsizez %s" % (

0 commit comments

Comments
 (0)