my name is Lorenzo and I am a postdoc researcher in Italy. My job is related to tomography imaging using synchrotron radiation. This is a new field for me and I start to face with Matlab to write some code.
I am completely new with tomography imaging and Matlab shows new challenges for me. My actual problem is to create sinograms from a stacking of parallel image projections. For whose are not in the field, a sinogram is a map detecting the projection on the detector of the position of a feature in the sample, as function of angle between the X-Ray beam and the sample.
What I get from an experiment is a series of 2D radiography at different angles, you can see it as a rectangular "volume" where dimensions are the number of rows and columns in the single projection, respectively, and volume is given from the number of angles. A sinogram is just a transversal cut of this volume. This means reading the volume not from lateral side but from the top, so I will create a new array of images, whose dimensions are the number of columns and projection, and array lenght the number of rows in the projections. To give numbers in this experiment I have 4000 projections with size 2048x1370 pixels, so for my computer skills this is a huge computational problem.
I need your help to perform some operations faster. My code in a first part allocates an array to contain all images, this is a 34 Gb array but I have 130 Gb RAM, so no problem. The code to perform this operation uses a loop of imread:
for i=2:num_proj filename=strcat(path_im,list_proj(i).name); image=imread(filename); imArray(:,:,i)=image; end
This is not the fastest way off course, now it takes 332 seconds to create this array. I have found several solutions to improve this and I will do it.
Second step is to divide for a flat field (image taken without the sample). My code takes the flat and using imdivide divides each image in the array for the flat image:
for i=1:size(imArray, 3); imArray(:,:,i)=imdivide(imArray(:,:,i), flat); end
this step seems to be fast however it is called 4000 times. Do you have suggestion? Is there a better way to perform it?
Now my greatest problem is how to take in the fastest way the horizontal cut in the projection volume? My basic idea to read the volume from the "top". is reported below, it does its job, however it takes long time:
for i=1:size(sinogram, 3) for k=1:size(sinogram, 1) sinogram(k,:,i)=imArray(i,:,k); end end
Can you help me to speed up also this operation? I hope my question is clear, otherwise please ask and I will try to explain it better.