Mercurial > ift6266
changeset 26:47e7202d4f19
Array format handling bug fix for thick.py
author | Xavier Glorot <glorotxa@iro.umontreal.ca> |
---|---|
date | Fri, 29 Jan 2010 14:09:14 -0500 |
parents | 442789c94b27 |
children | 0b9350998dbe |
files | transformations/thick.py |
diffstat | 1 files changed, 6 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/transformations/thick.py Fri Jan 29 11:44:12 2010 -0500 +++ b/transformations/thick.py Fri Jan 29 14:09:14 2010 -0500 @@ -69,15 +69,14 @@ maxi = float(N.max(image)) mini = float(N.min(image)) - if maxi>1.0: - image=image/maxi + imagenorm=image/maxi if self.meth==1: trans=scipy.ndimage.morphology.grey_dilation\ - (image,size=self.__structuring_elements__[self.nb].shape,structure=self.__structuring_elements__[self.nb]) + (imagenorm,size=self.__structuring_elements__[self.nb].shape,structure=self.__structuring_elements__[self.nb]) else: trans=scipy.ndimage.morphology.grey_erosion\ - (image,size=self.__structuring_elements__[self.nb].shape,structure=self.__structuring_elements__[self.nb]) + (imagenorm,size=self.__structuring_elements__[self.nb].shape,structure=self.__structuring_elements__[self.nb]) #------renormalizing maxit = N.max(trans) @@ -92,9 +91,10 @@ if image.shape == (self.__nx__,self.__ny__): return self.transform_1_image(image) if image.ndim == 3: + newimage = copy.copy(image) for i in range(image.shape[0]): - image[i,:,:] = self.transform_1_image(image[i,:,:]) - return N.reshape(newimage,image.shape) + newimage[i,:,:] = self.transform_1_image(image[i,:,:]) + return newimage if image.ndim == 2 and image.shape != (self.__nx__,self.__ny__): newimage = N.reshape(image,(image.shape[0],self.__nx__,self.__ny__)) for i in range(image.shape[0]):