Skip to content

Commit 205869c

Browse files
authored
Merge pull request #92 from lguerard/devel
Add calibration to the converted file
2 parents 5c8482e + 420eb59 commit 205869c

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/imcflibs/imagej/misc.py

Lines changed: 11 additions & 1 deletion
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):
672+
def run_imarisconvert(file_path, 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,9 @@ def run_imarisconvert(file_path):
680680
----------
681681
file_path : str
682682
Absolute path to the input image file.
683+
pixel_calibration : tuple or list, optional
684+
Sequence of 3 values (x, y, z) representing voxel dimensions to be set during
685+
conversion, by default None.
683686
"""
684687
# in case the given file has the suffix `.ids` (meaning it is part of an
685688
# ICS-1 `.ics`+`.ids` pair), point ImarisConvert to the `.ics` file instead:
@@ -694,6 +697,13 @@ def run_imarisconvert(file_path):
694697
file_path,
695698
file_path.replace(file_extension, ".ims"),
696699
)
700+
if pixel_calibration:
701+
command = command + " --voxelsizex %s --voxelsizey %s --voxelsizez %s" % (
702+
pixel_calibration[0],
703+
pixel_calibration[1],
704+
pixel_calibration[2],
705+
)
706+
697707
log.debug("\n%s" % command)
698708
IJ.log("Converting to Imaris5 .ims...")
699709
result = subprocess.call(command, shell=True, cwd=imaris_path)

0 commit comments

Comments
 (0)