Hello,
I was wondering if ZEN Blue has a batch tool for resampling multiple .czi files. Currently , I have been running the "Resample" tool in the processing tab one file at a time.
Thanks!
Batch tool for resampling
-
- Posts: 180
- Joined: Wed May 20, 2020 10:10 am
Re: Batch tool for resampling
Hello Praveen Krishnamoorthy,
you have to write something like
I hope you will be able to modify it to your needs
you have to write something like
Code: Select all
from System.IO import File, Directory, FileInfo
path = r'C:\Users\...\Pictures\MyImages'
files = Directory.GetFiles(path,'*.czi')
for i in range(0,files.Length):
file = files[i]
fileInfo = FileInfo(file)
pathAndFile = path + "\\" + fileInfo.Name
image = Zen.Application.LoadImage(pathAndFile,False)
imageResampled = Zen.Processing.Transformation.Geometric.Resample(image, True, ZenInterpolation.Linear, ZenThirdProcessingDimension.None, 0, 0, 0, 1, 1, 1, False)
pathAndFileResampled = path + "\\" + fileInfo.Name.Substring(0, fileInfo.Name.Length-4) + "Resampled.czi"
imageResampled.Save(pathAndFileResampled)
imageResampled.Close()
image.Close()
Zen.Application.Pause('Number of Files: ' + str(files.Length))