def loadReferenceImage(self, path = ''):
     ref_grid = Grid()
     #if self.grid.ext_color:
         #self.ref_name = 'ext_'+self.ref_name
     ref_grid.image2Grid(path+self.ref_name, ext_colors=self.grid.ext_color)
     ref_grid.visualize()
     return ref_grid
#ref_name = 'milford1999_21.jpg'
simulation = False;

# generate grid
prob_grid1 = Grid(add='prob_')
prob_grid2 = Grid(add='prob_')
grid1 = Grid()
grid2 = Grid()
#grid = Grid()

if simulation:
    # generate random grid with size m
    grid1.rndGenerator(grid_size=250, savePlots=False, name='rnd_simulation')
else:
    # load Image to grid
    grid1.image2Grid(fname, path='Images\\', mode='yuv', output=False, ext_colors=False)
    grid2.image2Grid(fname, path='Images\\', mode='yuv', output=False, ext_colors=True)
    prob_grid1.image2Grid(fname, path='Images\\', mode='yuv', output=False, ext_colors=False)
    prob_grid2.image2Grid(fname, path='Images\\', mode='yuv', output=False, ext_colors=True)

# save initial state
#init = grid.grid.copy()
# Create CA with reference image
ca = CellularAutomata(prob_grid2, neighbourhood='Moore', rules='Conway', ref_name=ref_name)
#ca2 = CellularAutomata(grid2, neighbourhood='Moore', rules='Probabilistic', ref_name=ref_name)
#ca3 = CellularAutomata(prob_grid1, neighbourhood='Moore', rules='Conway', ref_name=ref_name)
#ca4 = CellularAutomata(prob_grid2, neighbourhood='Moore', rules='Probabilistic', ref_name=ref_name)

print 'intial state: '
ca.grid.visualize()
#ca1.grid.saveImage(path='EMDimages\\')