diff --git a/src/imcflibs/imagej/misc.py b/src/imcflibs/imagej/misc.py index dcf66f8..f6a8ac3 100644 --- a/src/imcflibs/imagej/misc.py +++ b/src/imcflibs/imagej/misc.py @@ -669,7 +669,7 @@ def locate_latest_imaris(paths_to_check=None): return imaris_paths[-1] -def run_imarisconvert(file_path, pixel_calibration=None): +def run_imarisconvert(file_path, output_folder=None, pixel_calibration=None): """Convert a given file to Imaris format using ImarisConvert. Convert the input image file to Imaris format (Imaris5) using the @@ -680,6 +680,8 @@ def run_imarisconvert(file_path, pixel_calibration=None): ---------- file_path : str Absolute path to the input image file. + output_folder : str, optional + Folder where the newly created IMS file will be saved, by default None. pixel_calibration : tuple or list, optional Sequence of 3 values (x, y, z) representing voxel dimensions to be set during conversion, by default None. @@ -693,9 +695,12 @@ def run_imarisconvert(file_path, pixel_calibration=None): imaris_path = locate_latest_imaris() + if not output_folder: + output_folder = os.getcwd() + command = 'ImarisConvert.exe -i "%s" -of Imaris5 -o "%s"' % ( file_path, - file_path.replace(file_extension, ".ims"), + os.path.join(output_folder, file_path.replace(file_extension, ".ims")), ) if pixel_calibration: command = command + " --voxelsizex %s --voxelsizey %s --voxelsizez %s" % (