Beispiel #1
0
 def fast_odf(self,s):
     odf = np.zeros(self.odfn)
     Eq=np.zeros((self.sz,self.sz,self.sz))
     #for i in range(self.dn):
     #    Eq[self.q[i][0],self.q[i][1],self.q[i][2]]+=s[i]/s[0]
     Eq[self.q[:,0],self.q[:,1],self.q[:,2]]=s[:]/np.float(s[0])
     #self.Eqs.append(Eq)
     if  self.operator=='laplacian':
         LEq=laplace(Eq)
         sign=-1
     if self.operator=='laplap':
         LEq=laplace(laplace(Eq))
         sign=1
     if  self.operator=='signal':
         LEq=Eq
         sign=1
     #LEs=map_coordinates(LEq,self.Ys.T,order=1)
     #"""
     LEs=np.zeros(self.Ysn)
     strides=np.array(LEq.strides,'i8')
     map_coordinates_trilinear_iso(LEq,self.Ys,
                                   strides,self.Ysn, LEs)
     #LEs=map_coordinates(LEq,self.zoom*self.Ys,order=1)
     LEs=LEs.reshape(self.odfn,self.radiusn)
     LEs=LEs*self.radius
     #LEs=LEs*self.radius*self.zoom
     LEsum=np.sum(LEs,axis=1)
     #This is what the following code is doing
     #for i in xrange(self.odfn):
     #    odf[i]=np.sum(LEsum[self.eqinds[i]])/self.eqinds_len[i]
     #odf2=odf.copy()
     LES=LEsum[self.eqinds_com]
     sum_on_blocks_1d(LES,self.eqinds_len,odf,self.odfn)
     odf=odf/self.eqinds_len
     return self.angular_weighting(sign*odf)
Beispiel #2
0
 def fast_odf(self, s):
     odf = np.zeros(self.odfn)
     Eq = np.zeros((self.sz, self.sz, self.sz))
     #for i in range(self.dn):
     #    Eq[self.q[i][0],self.q[i][1],self.q[i][2]]+=s[i]/s[0]
     Eq[self.q[:, 0], self.q[:, 1], self.q[:, 2]] = s[:] / np.float(s[0])
     #self.Eqs.append(Eq)
     if self.operator == 'laplacian':
         LEq = laplace(Eq)
         sign = -1
     if self.operator == 'laplap':
         LEq = laplace(laplace(Eq))
         sign = 1
     if self.operator == 'signal':
         LEq = Eq
         sign = 1
     #LEs=map_coordinates(LEq,self.Ys.T,order=1)
     #"""
     LEs = np.zeros(self.Ysn)
     strides = np.array(LEq.strides, 'i8')
     map_coordinates_trilinear_iso(LEq, self.Ys, strides, self.Ysn, LEs)
     #LEs=map_coordinates(LEq,self.zoom*self.Ys,order=1)
     LEs = LEs.reshape(self.odfn, self.radiusn)
     LEs = LEs * self.radius
     #LEs=LEs*self.radius*self.zoom
     LEsum = np.sum(LEs, axis=1)
     #This is what the following code is doing
     #for i in xrange(self.odfn):
     #    odf[i]=np.sum(LEsum[self.eqinds[i]])/self.eqinds_len[i]
     #odf2=odf.copy()
     LES = LEsum[self.eqinds_com]
     sum_on_blocks_1d(LES, self.eqinds_len, odf, self.odfn)
     odf = odf / self.eqinds_len
     return self.angular_weighting(sign * odf)
Beispiel #3
0
 def fast_odf(self,s):
     odf = np.zeros(self.odfn)        
     Eq=np.zeros((self.sz,self.sz,self.sz))
     #for i in range(self.dn):            
     #    Eq[self.q[i][0],self.q[i][1],self.q[i][2]]+=s[i]/s[0]
     Eq[self.q[:,0],self.q[:,1],self.q[:,2]]=s[:]/s[0]
         
     if  self.operator=='2laplacian':       
         LEq=self.eit_operator(Eq,2)
         sign=-1
     if  self.operator=='laplacian':
         LEq=laplace(Eq)
         sign=-1
     if self.operator=='laplap':
         LEq=laplace(laplace(Eq))
         sign=1
     if  self.operator=='signal':
         LEq=Eq
         sign=1
                        
     LEs=map_coordinates(LEq,self.Ys,order=1)        
     LEs=LEs.reshape(self.odfn,self.radiusn)
     LEs=LEs*self.radius
     LEsum=np.sum(LEs,axis=1)
     #This is what the following code is doing        
     #for i in xrange(self.odfn):
     #    odf[i]=np.sum(LEsum[self.eqinds[i]])/self.eqinds_len[i]        
     #odf2=odf.copy()
     LES=LEsum[self.eqinds_com]        
     sum_on_blocks_1d(LES,self.eqinds_len,odf,self.odfn)
     odf=odf/self.eqinds_len
     
     
     return sign*odf
Beispiel #4
0
 def fast_odf(self,s):
     odf = np.zeros(self.odfn)        
     Eq=np.zeros((self.sz,self.sz,self.sz))
     #for i in range(self.dn):
     #    Eq[self.q[i][0],self.q[i][1],self.q[i][2]]+=s[i]/s[0]
     Eq[self.q[:,0],self.q[:,1],self.q[:,2]]=s[:]/s[0]
     #self.Eqs.append(Eq)
         
     if  self.operator=='2laplacian':       
         LEq=self.eit_operator(Eq,2)            
         sign=-1
     if  self.operator=='laplacian':
         #ZEq=zoom(Eq,zoom=5,order=self.order,mode=self.mode,cval=0.0,prefilter=True)
         #self.ZEqs.append(ZEq)
         #ZLEq=laplace(ZEq)
         #self.ZLEqs.append(ZLEq)
         #LEq=zoom(ZLEq,zoom=.2,order=self.order,mode=self.mode,cval=0.0,prefilter=True)         
         #LEq=laplace(Eq)
         #if self.zoom>1:
         #    ZEq=zoom(Eq,zoom=self.zoom,order=self.order,mode=self.mode)
         #    LEq=laplace(ZEq)
         #else:
         LEq=laplace(Eq)
         sign=-1
     if self.operator=='laplap':
         LEq=laplace(laplace(Eq))
         sign=1
     if  self.operator=='signal':
         LEq=Eq
         sign=1
     
     LEs=map_coordinates(LEq,self.Ys,order=1)
     #LEs=map_coordinates(LEq,self.zoom*self.Ys,order=1)                
     LEs=LEs.reshape(self.odfn,self.radiusn)
     LEs=LEs*self.radius
     #LEs=LEs*self.radius*self.zoom
     LEsum=np.sum(LEs,axis=1)
     #This is what the following code is doing        
     #for i in xrange(self.odfn):
     #    odf[i]=np.sum(LEsum[self.eqinds[i]])/self.eqinds_len[i]        
     #odf2=odf.copy()
     LES=LEsum[self.eqinds_com]        
     sum_on_blocks_1d(LES,self.eqinds_len,odf,self.odfn)
     odf=odf/self.eqinds_len       
     
     return sign*odf
Beispiel #5
0
    def fast_odf(self, s):
        odf = np.zeros(self.odfn)
        Eq = np.zeros((self.sz, self.sz, self.sz))
        #for i in range(self.dn):
        #    Eq[self.q[i][0],self.q[i][1],self.q[i][2]]+=s[i]/s[0]
        Eq[self.q[:, 0], self.q[:, 1], self.q[:, 2]] = s[:] / s[0]
        #self.Eqs.append(Eq)

        if self.operator == '2laplacian':
            LEq = self.eit_operator(Eq, 2)
            sign = -1
        if self.operator == 'laplacian':
            #ZEq=zoom(Eq,zoom=5,order=self.order,mode=self.mode,cval=0.0,prefilter=True)
            #self.ZEqs.append(ZEq)
            #ZLEq=laplace(ZEq)
            #self.ZLEqs.append(ZLEq)
            #LEq=zoom(ZLEq,zoom=.2,order=self.order,mode=self.mode,cval=0.0,prefilter=True)
            #LEq=laplace(Eq)
            #if self.zoom>1:
            #    ZEq=zoom(Eq,zoom=self.zoom,order=self.order,mode=self.mode)
            #    LEq=laplace(ZEq)
            #else:
            LEq = laplace(Eq)
            sign = -1
        if self.operator == 'laplap':
            LEq = laplace(laplace(Eq))
            sign = 1
        if self.operator == 'signal':
            LEq = Eq
            sign = 1

        LEs = map_coordinates(LEq, self.Ys, order=1)
        #LEs=map_coordinates(LEq,self.zoom*self.Ys,order=1)
        LEs = LEs.reshape(self.odfn, self.radiusn)
        LEs = LEs * self.radius
        #LEs=LEs*self.radius*self.zoom
        LEsum = np.sum(LEs, axis=1)
        #This is what the following code is doing
        #for i in xrange(self.odfn):
        #    odf[i]=np.sum(LEsum[self.eqinds[i]])/self.eqinds_len[i]
        #odf2=odf.copy()
        LES = LEsum[self.eqinds_com]
        sum_on_blocks_1d(LES, self.eqinds_len, odf, self.odfn)
        odf = odf / self.eqinds_len

        return sign * odf