예제 #1
0
 def __init__(self, subDir, pathDir, flChannel=4, isNeg=False):
     self.subDir = subDir
     self.pathDir = pathDir
     self.isNeg = isNeg
     if not self.isNeg:
         negF = '/project/current/project/jagannath/projectfiles/EpiMicroscopy/rawFiles/2014-Oct/2014-10-17/rawImages/negShape.pkl'
         self.negShapeProfile = pickle.load(open(negF))
     self.beadsImg = BeadExpt(self.subDir, self.pathDir)
     self.dicFname = self.beadsImg._getImageName(c=1)
     self.flFname = self.beadsImg._getImageName(
         c=flChannel)  #Fluorescent channel
def getCircles(subDir, maskSource='DIC'):
    expt = BeadExpt(subDir, pathDir)
    imageDir = expt.imageDir
    if maskSource is 'DIC':
        dyeImage = expt._getImageName(1)
    else:
        dyeImage = expt._getImageName(4)
    orig, cimg = expt._openImages(dyeImage)
    circles = expt.findHoughCircles(orig)
    orig, cimg = expt._openImages(expt._getImageName(4), -1)
    return circles, orig, cimg
예제 #3
0
 def __init__(self,subDir,pathDir,flChannel=4,isNeg=False):
     self.subDir = subDir
     self.pathDir = pathDir
     self.isNeg = isNeg
     if not self.isNeg: 
         negF = '/project/current/project/jagannath/projectfiles/EpiMicroscopy/rawFiles/2014-Oct/2014-10-17/rawImages/negShape.pkl'
         self.negShapeProfile = pickle.load(open(negF))
     self.beadsImg = BeadExpt(self.subDir,self.pathDir)
     self.dicFname = self.beadsImg._getImageName(c=1)
     self.flFname = self.beadsImg._getImageName(c=flChannel) #Fluorescent channel
def getCircles(subDir, maskSource="DIC"):
    expt = BeadExpt(subDir, pathDir)
    imageDir = expt.imageDir
    if maskSource is "DIC":
        dyeImage = expt._getImageName(1)
    else:
        dyeImage = expt._getImageName(4)
    orig, cimg = expt._openImages(dyeImage)
    circles = expt.findHoughCircles(orig)
    orig, cimg = expt._openImages(expt._getImageName(4), -1)
    return circles, orig, cimg
예제 #5
0
class BeadsImage:
    def __init__(self, subDir, pathDir, flChannel=4, isNeg=False):
        self.subDir = subDir
        self.pathDir = pathDir
        self.isNeg = isNeg
        if not self.isNeg:
            negF = '/project/current/project/jagannath/projectfiles/EpiMicroscopy/rawFiles/2014-Oct/2014-10-17/rawImages/negShape.pkl'
            self.negShapeProfile = pickle.load(open(negF))
        self.beadsImg = BeadExpt(self.subDir, self.pathDir)
        self.dicFname = self.beadsImg._getImageName(c=1)
        self.flFname = self.beadsImg._getImageName(
            c=flChannel)  #Fluorescent channel

    def subDict(self, adict, negDict):
        tmpDict = dict()
        for k, v in adict.items():
            tmpDict[k] = adict[k] - negDict[k]
        return tmpDict

    def makeHoughCircles(self):
        self.dicFname = self.beadsImg._getImageName(c=1)
        (dic_orig, dic_cimg) = self.beadsImg._openImages(self.dicFname)
        circles = self.beadsImg.findHoughCircles(dic_orig)
        if not circles is None:
            self.beadsImg.overLayHoughCircles_SVG(circles,
                                                  dic_cimg)  #SVG FILE MADE
            overLayFname, overCimg = self.beadsImg.overLayHoughCircles(
                circles, dic_cimg, idx=1, putNbr=True)
            self.beadsImg._saveImage(overLayFname + '.png', overCimg)
        return circles

    def makeAllLinePlots(self, allCircles, minRad=30):
        (fl_orig, fl_cimg) = self.beadsImg._openImages(self.flFname, flag=-1)
        allNormDeviation_dict = collections.defaultdict(list)
        for i, circle in enumerate(allCircles[0]):
            if circle[2] > minRad:
                oneBead = Bead(circle, fl_orig, fl_cimg)
                allNormLineProfiles_dict = oneBead.makeLineProfile()
                meanProfile, stdevProfile = combineVal_dict(
                    allNormLineProfiles_dict)
                (med, factor
                 ), devMedian, normDevMedian = calcDevMed_dict(meanProfile)
                shapeProfile = normDevMedian
                if not self.isNeg:
                    diffShape = self.subDict(shapeProfile,
                                             self.negShapeProfile)
                    reNorm = dict([(k, (v * factor) + med)
                                   for k, v in diffShape.items()])
                    allNormDeviation_dict = appendDict(allNormDeviation_dict,
                                                       reNorm)
                else:
                    allNormDeviation_dict = appendDict(allNormDeviation_dict,
                                                       shapeProfile)

        imageLineProfile, stdevLineProfile = combineVal_dict(
            allNormDeviation_dict)
        return imageLineProfile, stdevLineProfile
예제 #6
0
class BeadsImage:
    def __init__(self,subDir,pathDir,flChannel=4,isNeg=False):
        self.subDir = subDir
        self.pathDir = pathDir
        self.isNeg = isNeg
        if not self.isNeg: 
            negF = '/project/current/project/jagannath/projectfiles/EpiMicroscopy/rawFiles/2014-Oct/2014-10-17/rawImages/negShape.pkl'
            self.negShapeProfile = pickle.load(open(negF))
        self.beadsImg = BeadExpt(self.subDir,self.pathDir)
        self.dicFname = self.beadsImg._getImageName(c=1)
        self.flFname = self.beadsImg._getImageName(c=flChannel) #Fluorescent channel

    def subDict(self,adict,negDict):
        tmpDict = dict()
        for k,v in adict.items():
            tmpDict[k] = adict[k] - negDict[k]
        return tmpDict

    def makeHoughCircles(self):
        self.dicFname = self.beadsImg._getImageName(c=1)
        (dic_orig, dic_cimg) = self.beadsImg._openImages(self.dicFname)
        circles = self.beadsImg.findHoughCircles(dic_orig)
        if not circles is None:
            self.beadsImg.overLayHoughCircles_SVG(circles,dic_cimg)#SVG FILE MADE
            overLayFname, overCimg = self.beadsImg.overLayHoughCircles(circles,dic_cimg,idx=1,putNbr= True)
            self.beadsImg._saveImage(overLayFname+'.png', overCimg)
        return circles 
    
    def makeAllLinePlots(self,allCircles,minRad=30):
        (fl_orig,fl_cimg) = self.beadsImg._openImages(self.flFname,flag=-1)
        allNormDeviation_dict = collections.defaultdict(list) 
        for i,circle in enumerate(allCircles[0]):
            if circle[2]>minRad:
                oneBead = Bead(circle,fl_orig,fl_cimg)
                allNormLineProfiles_dict = oneBead.makeLineProfile()
                meanProfile,stdevProfile = combineVal_dict(allNormLineProfiles_dict)
                (med,factor), devMedian, normDevMedian = calcDevMed_dict(meanProfile)
                shapeProfile = normDevMedian
                if not self.isNeg:
                    diffShape = self.subDict(shapeProfile,self.negShapeProfile)
                    reNorm = dict([(k,(v*factor)+med) for k, v in diffShape.items()])
                    allNormDeviation_dict = appendDict(allNormDeviation_dict,reNorm)
                else:
                    allNormDeviation_dict = appendDict(allNormDeviation_dict,shapeProfile)

        imageLineProfile,stdevLineProfile = combineVal_dict(allNormDeviation_dict)
        return imageLineProfile,stdevLineProfile