I am using a program to binarize several images and then adding all the images together using "ImageAdd" to get one image. This image is required for further analysis of the images. The program executes fine but however if I try to re-execute the program without quitting the kernel then it doesnot work and gives error. The following is the program and the error it generates:
PathforData = "E:\\data\\";
SetDirectory[PathforData];
ImageFiles = FileNames["*.jpeg"];
Length[ImageFiles];
Do[Refinedimg[t] =EdgeDetect[
DeleteSmallComponents[
Dilation[
Erosion[Binarize[
Import["E:\\data\\" <> ToString[ImageFiles[[t]]]]], 3], 6]]];
OriginalImg[t] =Import["E:\\data\\" <>
ToString[ImageFiles[[t]]]], {t, 1, Length[ImageFiles], 1}];
This is a prt of the program, but the problem starts from this step. After re-execution it starts to generate error as:
Tag Image in ()[1] is Protected.
Tag Image in ()[2] is Protected.
I have to use Quit[] every time after the program execution is completed to avoid this error. Can anyone suggest any modification or tell me why I get this error? Thanks.
Clear[RefinedImg,OriginalImg]. The left side ofRefinedImg[t] = ...gets evaluated, too, so on the second run, it meansImage[...][t] = .... See also this. – Niki Estner Sep 02 '15 at 06:08