예제 #1
0
    def  __init__(self,data,order=['x','y','z'],phantomdim=[20,10],phantomvolume=9500,dose=75,dosecaltime='000000',remdose=0,remdosecaltime='000000'):


        print order
        self.xind = order.index('x')
        self.yind = order.index('y')
        self.zind = order.index('z')
        
        axes = [self.xind,self.yind,self.zind]
        print data
        pixelsize,array,info = niq.loaddata(data)

        print info
        
        self.pixel_size = pixelsize
        print "pixelsize: ", pixelsize

        self.phantomvolume = float(phantomvolume)
        self.dose = float(dose)
        self.dosecaltime = str(dosecaltime)
        self.remdose = float(remdose)
        self.remdosecaltime = str(remdosecaltime)

        
        self.rows = info.info["0028","0010"].value
        self.cols = info.info["0028","0011"].value

        self.vendor = info.info["0008","0070"].value
        
        if self.vendor == 'Philips Medical Systems':
            self.suvfactor = info.info["7053","1009"].value
        else:
            self.suvfactor = 1.0

        self.weight = info.info["0010","1030"].value

        print "Acquisition date",info.info["0008","0022"].value #Date
        acqtime = info.info["0008","0032"].value.split('.')[0] #Acq. Time and we remove the microseconds

        
        
        print "Acquisition time:  ", acqtime
        print "Activity calibrated: %s at %s "%(self.dose,self.dosecaltime)
        print "Remainder activity: %s at %s "%(self.remdose,self.remdosecaltime)

        self.fmt = '%H%M%S'
        self.fmt2 = '%H%M'

        

        t1 = datetime.strptime(acqtime, self.fmt) #acquisition time dcmhdr
        t2 = datetime.strptime(self.dosecaltime, self.fmt) #act. cal time
        t3 = datetime.strptime(self.remdosecaltime, self.fmt)#remaining activity cal time

        # Activity concentration at acquisitiontime:


        deltat0 = float((t1 - t2).seconds/60.) #minutes
        deltatr = float((t2 - t3).seconds/60.) #minutes


        self.currconc = niqlib.calc_act_con(self.phantomvolume,self.dose,deltat0,self.remdose,deltatr)

        print "Net activity at acquisition : %s "%self.currconc
예제 #2
0
    def  __init__(self,data,order=['x','y','z'],phantomdim=[20,10],phantomvolume=9500,dose=75,dosecaltime='000000',remdose=0,remdosecaltime='000000'):


        print order
        self.xind = order.index('x')
        self.yind = order.index('y')
        self.zind = order.index('z')
        
        axes = [self.xind,self.yind,self.zind]
        print data
        pixelsize,array,info = niq.loaddata(data)

        print info
        
        self.pixel_size = pixelsize
        print "pixelsize: ", pixelsize

        self.phantomvolume = float(phantomvolume)
        self.dose = float(dose)
        self.dosecaltime = str(dosecaltime)
        self.remdose = float(remdose)
        self.remdosecaltime = str(remdosecaltime)

        
        self.rows = info.info["0028","0010"].value
        self.cols = info.info["0028","0011"].value

        self.vendor = info.info["0008","0070"].value
        
        if self.vendor == 'Philips Medical Systems':
            self.suvfactor = info.info["7053","1009"].value
        else:
            self.suvfactor = 1.0

        self.weight = info.info["0010","1030"].value

        print "Acquisition date",info.info["0008","0022"].value #Date
        acqtime = info.info["0008","0032"].value.split('.')[0] #Acq. Time and we remove the microseconds

        
        
        print "Acquisition time:  ", acqtime
        print "Activity calibrated: %s at %s "%(self.dose,self.dosecaltime)
        print "Remainder activity: %s at %s "%(self.remdose,self.remdosecaltime)

        self.fmt = '%H%M%S'
        self.fmt2 = '%H%M'

        

        t1 = datetime.strptime(acqtime, self.fmt) #acquisition time dcmhdr
        t2 = datetime.strptime(self.dosecaltime, self.fmt) #act. cal time
        t3 = datetime.strptime(self.remdosecaltime, self.fmt)#remaining activity cal time

        # Activity concentration at acquisitiontime:


        deltat0 = float((t1 - t2).seconds/60.) #minutes
        deltatr = float((t2 - t3).seconds/60.) #minutes


        self.currconc = niqlib.calc_act_con(self.phantomvolume,self.dose,deltat0,self.remdose,deltatr)

        print "Net activity at acquisition : %s "%self.currconc
        


#float(indata.info["0028","0030"].value[0])

        self.bgradius = 4

        



        self.data = np.array(array)

        print type(self.data)
        print type(self.data[0])

        tmpshape  = np.shape(self.data)

        print tmpshape
        
        self.ddimz = tmpshape[self.zind]
        self.ddimy = tmpshape[self.yind]
        self.ddimx = tmpshape[self.xind]

        self.maxdata = self.data.max()
        self.volume = np.zeros(np.shape(data))

#        self.mode = mode
        self.z = self.z_init()


        self.thrdata = copy.deepcopy(self.data)

        lowind = (self.thrdata < np.max(self.thrdata[self.z,:,:])*0.2)
        self.thrdata[lowind] = 0.0
        highind = (self.thrdata >= np.max(self.thrdata[self.z,:,:])*0.2)
        self.thrdata[highind] = 10

        self.bgdata = copy.deepcopy(self.data)

        self.roughcom = ndimage.measurements.center_of_mass(self.data[self.z,:,:])

        print "rough com location:", self.roughcom

        self.cor = self.roughcom
        self.bgspheres = {}

        self.set_bg_spheres()