- #1
Larry Gopnik
Gold Member
- 34
- 19
Hi, I hope someone can help me!
I could not find a solution online of which could help me. My problem:
I have imagecubes - they are a "cube" of 10 images of the same place of a photo, one at 400nm, one at 450nm etc etc.
I need to upload these into MATLAB so I can then analyse the intensities at certain places in certain wavelengths. The best way I have thought of doing this is to place it into a 3d matrix of size 1550x1000x10 (where 1550x1000 are the size of each image) (if there is a better way of doing this I would be glad to hear them)
Code:
I'm getting the error:
I've looked online and the people who normally have this error are using tiff files. Where am I going wrong?!
Thank you
EDIT:
I now have a different error.
After contemplation I saw that maybe MatLab thinks the files are .tiff files, therefore I have changed the filetypes and hence the code to:
and I am now getting the error :
Error using Tiff
Too many input arguments.
Error in Build_1 (line 107)
fidr = Tiff('open',filepath,'r','l');
I could not find a solution online of which could help me. My problem:
I have imagecubes - they are a "cube" of 10 images of the same place of a photo, one at 400nm, one at 450nm etc etc.
I need to upload these into MATLAB so I can then analyse the intensities at certain places in certain wavelengths. The best way I have thought of doing this is to place it into a 3d matrix of size 1550x1000x10 (where 1550x1000 are the size of each image) (if there is a better way of doing this I would be glad to hear them)
Code:
Code:
%-----------------------------%
%----IMAGE CUBE------%
%-----------------------------%
sizex = 1550;
sizey = 1000;
imageslice = 10; %amount of slices the image cube is made of
cube=zeros(sizex,sizey,imageslice);
cubedir = 'C:\proc';
ab = [1 2 3 4 5 6 7 8 9 10];
for ij = 1:imageslice
slice = ab(ij);
slice1 = 1;
slice2 = slice-slice1;
slicenumber = int2str(slice2);
filepath=[cubedir, '1_190716.f' slicenumber '.0.0.jpg'];
fidr = imread(filepath,'r','l');
cube{:,:,ij} = fread(fidr,[sizex,sizey],'uint8');
end
I'm getting the error:
Code:
Error using readjpg
Too many input arguments.
Error in imread (line 415)
[X, map] = feval(fmt_s.read, filename, extraArgs{:});
I've looked online and the people who normally have this error are using tiff files. Where am I going wrong?!
Thank you
EDIT:
I now have a different error.
After contemplation I saw that maybe MatLab thinks the files are .tiff files, therefore I have changed the filetypes and hence the code to:
Code:
%code code code
slice = ab(ij);
slice1 = 1;
slice2 = slice-slice1;
slicenumber = int2str(slice2);
filepath=[cubedir, '_190716.f' slicenumber '.0.0.tiff'];
fidr = Tiff('open',filepath,'r','l');
cube(:,:,ij) = fread(fidr,[sizex,sizey],'uint8');
%more code
and I am now getting the error :
Error using Tiff
Too many input arguments.
Error in Build_1 (line 107)
fidr = Tiff('open',filepath,'r','l');
Last edited: