Analysing a few .tiff files

I have a bunch of .tiff files that are pictures of a diffraction pattern evolving with time. Each file is an array 480x640 where each entry in the array is an intensity value.
I want to load the .tiff files automatically into Matlab and obtain the total intensity for each file by adding each entry together until the total is reached. I want these total values to be remembered and at the end the total intensities are recalled and plotted as intensity vs. time.
I know how to load up an individual .tiff file using the imread function. I have spent a lot of time trying to figure out what commands I need but haven’t gotten far.
Does anyone have any thoughts on my problem please? Any help would be greatly appreciated.

댓글 수: 2

Ryan
Ryan 2012년 7월 11일
How are the .tiff files named? Is it something like Image_namestuff_1.tiff, Image_namestuff_2.tiff... etc?
Dominic Lawson
Dominic Lawson 2012년 7월 11일
Yes that's right
To be precise:-
Run20120629.103217 Multiple Image - 00000
Run20120629.103217 Multiple Image - 00001 etc...

댓글을 달려면 로그인하십시오.

 채택된 답변

Steve Eddins
Steve Eddins 2012년 7월 11일

1 개 추천

Are the different time slices stored in different TIFF files? Then try something like this:
d = dir('myfiles*.tiff');
total = zeros(480,640);
for k = 1:length(d)
I = imread(d(k).name);
total = total + double(I);
end
Or are the different time slices all stored in a single TIFF file? Then try something like this:
total = zeros(480,640);
info = imfinfo('myfile.tiff');
num_slices = length(info);
for k = 1:num_slices
I = imread('myfile.tiff','Info',info,'Index',k);
total = total + double(I);
end

댓글 수: 5

Dominic Lawson
Dominic Lawson 2012년 7월 11일
Thanks very much for you're help. Sadly I couldn't get it to work. I'll keep at it though...
Steve Eddins
Steve Eddins 2012년 7월 11일
So ... what happened when you tried it?
I've come back to MATLAB this morning having had time to relax and gather my thoughts. I can load in my data files using your code above. Thanks very much indeed.
I still want each file to be uploaded and each file to have its entire contents added up and the values stored in a separate array or something. This seems to be partially happening just now but I keep getting a value of 255 for the total of each array. I know their totals should be greater than this.
Any thoughts please?
clear all
t = 0;
d = dir('*.tif');
total = zeros(480,640);
for k = 1:length(d)
I = imread(d(k).name);
total = total + double(I);
for i = 1:numel(I)
t = t + I(i);
end
end
disp(t)
Ryan
Ryan 2012년 7월 12일
If you're looking for the sum of all of the pixel values in a particular image use this in your loop:
SumOfPixelValues(k) = sum(sum(I));
Dominic Lawson
Dominic Lawson 2012년 7월 13일
Thank you very much for your help

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2012년 7월 11일

0 개 추천

댓글 수: 3

Dominic Lawson
Dominic Lawson 2012년 7월 12일
Thanks had already looked and tried these example codes but didn't work sadly.
Image Analyst
Image Analyst 2012년 7월 12일
Strange. I'll take a look at the FAQ, find the bug in it, and fix the code there. I don't want non-working code in the FAQ.
Dear Image Analyst,
Here is my code thus far:-
clear all
t = 0;
d = dir('*.tif');
z = [ ];
z = zeros(11,1);
for k = 1:length(d)
I = imread(d(k).name);
for i = 1:numel(I)
z(:,1) = t + I(i)
end
end
I want to have each file loaded in, the array elements all added together, this value stored then move onto the next file. When all files have been read I want an array that has these total values in it.
I've been looking at examples and tried them but haven't been successful so far. Any pointers at all please?

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Image Filtering and Enhancement에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by