Reading and manipulating a 3D stack of MRC images

  Kiến thức lập trình

The problem I am trying to solve is a three-parter.

I am trying to read a 3D stack of MRC images (not as in: Can DM script read images with the same extension (like *.mrc) from a folder?), apply a function on each image, and output the processed image, preferably in the same order as in the original stack.

Currently, I am reading in the image stack as a file stream and simply displaying it:

file_ID = OpenFileForReading(filename)
file_stream = newStreamFromFileReference(file_ID, 1)
img :=IntegerImage("Imported", 1, 0, size_x, size_y)
ImageReadImageDataFromStream(img, file_stream, 0)

First of all, is this the best way to import a image stack?
Once the stack is imported, how can I apply manipulate each image and output them?

Thanks in advance for your input.