Can anyone help me?

Can anyone help me with this? I get this error
??? Error using ==> imread at 414 File "C:\Matlab\Colon\15min\4x\M1-E1-I800-G-1.tif" does not exist. Error in ==> dokimi2 at 45 imG=imread(FileNameG,'TIFF');
This is my code:
DirName='C:\Matlab';
if true
Verbose=1;
Organ={'Colon'};
Mag={'4x';'10x'};
TimePoints={'15min'; '30min'; '1hr'; '3hr'; '6hr'; '24hr' };
M=[5;5;5;5;5;4];
S=[8;8;8;8;8;8];
end
if true
fid=fopen('results.csv','w');
fprintf(fid,'Organ;Time Point;Mag;Mouse Number;Site;GFP_Total_G;GFP_Total_R;Cy3_Total;Tissue_Pixels\r');
end;
if true
hf=figure;
ss=get( 0, 'ScreenSize' );
set(hf,'Position',[100 ss(4)-550 1000 450]);
end;
if true
load corectimage;
for o=1:length(Organ)
disp(sprintf('%s',Organ{o}));
for t=1:length(TimePoints)
disp(sprintf('%s',TimePoints{t}));
for m=1:length(Mag)
disp(sprintf('%s',Mag{m}));
for p=1:M(t)
disp(sprintf(' %d',p));
for q=1:S(t)
end
if true
if strcmp(Organ,'Colon')
FileNameG=sprintf('%s\\%s\\%s\\%s\\M%d-E1-I800-G-%d.tif',DirName,Organ{o},TimePoints{t}, Mag{m}, p, q);
imG=imread(FileNameG,'TIFF');
FileNameC=sprintf('%s\\%s\\%s\\%s\\M%d-E1-I800-C-%d.tif',DirName,Organ{o},TimePoints{t}, Mag{m}, p, q);
imC=imread(FileNameC,'TIFF');
else
FileNameG=sprintf('%s\\%s\\%s\\M%d-E1-I800-G-%d.tif',DirName,Organ{o},TimePoints{t}, Mag{m}, p, q);
imG=imread(FileNameG,'TIFF');
FileNameC=sprintf('%s\\%s\\%s\\M%d-E1-I800-C-%d.tif',DirName,Organ{o},TimePoints{t}, Mag{m}, p, q);
imC=imread(FileNameC,'TIFF');
end
end;
% Correct the image intensity (only for Mag=4x)
if true
if strcmp(Mag,'4x')
imG=double(imG);
imC=double(imC);
load(sprintf('%s\\corectimage.mat',DirName));
imG(:,:,1)=imG(:,:,1).*imXG;
imG(:,:,2)=imG(:,:,2).*imXG;
imG(:,:,3)=imG(:,:,3).*imXG;
imC(:,:,1)=imC(:,:,1).*imXC;
imC(:,:,2)=imC(:,:,2).*imXC;
imC(:,:,3)=imC(:,:,3).*imXC;
imG=uint8(imG);
imC=uint8(imC);
end;
end
if true
if Verbose
disp('Creating Histograms ...');
[NG,XG]=imhist(imG(:,:,2),256);
[NC,XC]=imhist(imC(:,:,2),256);
end;
end
if true
if Verbose
disp('Correcting and Thresholding ...');
end;
if true
imG2=(medfilt2(double(imG(:,:,2)).*imXG,[10 10]));
ff=0.9;
% Dont have to correct for 10x
if strcmp(Mag{o},'10x')
imG2=(medfilt2(double(imG(:,:,2)),[10 10]));
ff=0.3;
end;
imG2=imG2-min(min(imG2));
imG2=imG2./max(max(imG2));
se = strel('disk',5);
L=(mean2(imG2)-ff*std2(imG2));
BW=im2bw(imG2,L);
imT=imclose(BW,se);
end
if true
if Verbose
disp('Calulating and displaying ...');
end;
Tissue_Pixels=sum(sum(imT));
GFP_Total_G = sum(sum(imG(:,:,2)));
GFP_Total_R = sum(sum(imG(:,:,1)));
GFP_PerTissue_G = GFP_Total_G/sum(sum(double(imT)));
GFP_PerTissue_R = GFP_Total_R/sum(sum(double(imT)));
Cy3_Total = sum(sum(imC(:,:,2)));
Cy3_PerTissue = Cy3_Total/sum(sum(double(imT)));
end
if true
if Verbose
subplot(2,2,1);
imshow([imG imC]);
title('GFP and Cy3 Normalized Fluorescence Images');
subplot(2,2,2);
plot(XG,NG,'r');
hold on;
plot(XC,NC,'g');
hold off;
axis tight;
title('Histograms of GFP (green) and Cy3 (Red) images');
subplot(2,2,3);
imagesc([imG2 imT]);colormap(gray);
title('Total Fluorescence and Total Tissue Mask');
ha6 = subplot(2,2,4);
cla(ha6);
text(0,1,strcat('GFP File: ',FileNameG));
text(0,0.85,strcat('Cy3 File: ',FileNameC));
text(0,0.65,sprintf('Total GFP Fluorescence: %d (G) %d (R)',GFP_Total_G, GFP_Total_R))
text(0,0.50,sprintf('Total Cy3 Fluorescence: %d',Cy3_Total))
text(0,0.30,sprintf('Tissue Pixels: %d',Tissue_Pixels))
text(0,0.15,sprintf('Normalized GFP Fluorescence: %0.5f (G) %0.5f (R)',GFP_PerTissue_G, GFP_PerTissue_R))
text(0,0,sprintf('Normalized Cy3 Fluorescence: %0.5f',Cy3_PerTissue))
axis off
if (~((p==M(t))&&(q==S(t))))
pause;
end;
else
fprintf(fid,'%s;%s;%s;%d;%d;%d;%d;%d;%d\r',Organ{o},TimePoints{t},Mag{m},p,q,GFP_Total_G,GFP_Total_R,Cy3_Total,Tissue_Pixels);
end;
end; end; end; end; end;
end
if true
if (~Verbose)
fclose(fid);
end;
end

2 Comments

Matt J
Matt J on 10 Oct 2013
Please use the
toolbar button to highlight and format your code readably. Thanks.
Did you check whether the file
C:\Matlab\Colon\15min\4x\M1-E1-I800-G-1.tif
exists or not?

Sign in to comment.

Answers (0)

Asked:

on 10 Oct 2013

Commented:

on 10 Oct 2013

Community Treasure Hunt

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

Start Hunting!