def reset(self):
		"""
		Resets the module to initial state. This method is
					 used mainly when doing previews, when the parameters
					 that control the colocalization are changed and the
					 preview data becomes invalid.
		"""
		Module.reset(self)
		self.colocFilter = vtkbxd.vtkImageColocalizationFilter()
		self.colocFilter.AddObserver('ProgressEvent', lib.messenger.send)
		lib.messenger.connect(self.colocFilter, "ProgressEvent", self.updateProgress)

		self.colocAutoThreshold = vtkbxd.vtkImageAutoThresholdColocalization()
		self.colocAutoThreshold.GetOutput().ReleaseDataFlagOn()
		self.colocAutoThreshold.AddObserver('ProgressEvent', lib.messenger.send)
		lib.messenger.connect(self.colocAutoThreshold, "ProgressEvent", self.updateProgress)
		self.thresholds = []
		self.settingsLst = []
		self.preview = None
		self.n = -1
Example #2
0
	def createItemToolbar(self):
		"""
		Method to create a toolbar for the window that allows use to select processed channel
		"""		 
		n = TaskPanel.createItemToolbar(self)		 
		
		coloc = vtkbxd.vtkImageColocalizationFilter()
		coloc.SetOutputDepth(8)
		i = 0
		for data in self.itemMips:
			coloc.AddInput(data)
			coloc.SetColocalizationLowerThreshold(i, 100)
			coloc.SetColocalizationUpperThreshold(i, 255)
			i = i + 1
		coloc.Update()
		ctf = vtk.vtkColorTransferFunction()
		ctf.AddRGBPoint(0, 0, 0, 0)
		ctf.AddRGBPoint(255, 1, 1, 1)
		maptocolor = vtk.vtkImageMapToColors()
		maptocolor.SetInput(coloc.GetOutput())
		maptocolor.SetLookupTable(ctf)
		maptocolor.SetOutputFormatToRGB()
		maptocolor.Update()
		imagedata = maptocolor.GetOutput()
		bmp = ImageOperations.vtkImageDataToWxImage(imagedata).ConvertToBitmap()
		
		bmp = self.getChannelItemBitmap(bmp, (255, 255, 0))
		toolid = wx.NewId()
		name = "Colocalization"
		self.toolMgr.addChannelItem(name, bmp, toolid, lambda e, x = n, s = self:s.setPreviewedData(e, x))		  
		
		for i, tid in enumerate(self.toolIds):
			self.dataUnit.setOutputChannel(i, 0)
			self.toolMgr.toggleTool(tid, 0)
		
		self.dataUnit.setOutputChannel(len(self.toolIds), 1)
		self.toolIds.append(toolid)
		self.toolMgr.toggleTool(toolid, 1)
		self.restoreFromCache()
Example #3
0
    def reset(self):
        """
		Resets the module to initial state. This method is
					 used mainly when doing previews, when the parameters
					 that control the colocalization are changed and the
					 preview data becomes invalid.
		"""
        Module.reset(self)
        self.colocFilter = vtkbxd.vtkImageColocalizationFilter()
        self.colocFilter.AddObserver('ProgressEvent', lib.messenger.send)
        lib.messenger.connect(self.colocFilter, "ProgressEvent",
                              self.updateProgress)

        self.colocAutoThreshold = vtkbxd.vtkImageAutoThresholdColocalization()
        self.colocAutoThreshold.GetOutput().ReleaseDataFlagOn()
        self.colocAutoThreshold.AddObserver('ProgressEvent',
                                            lib.messenger.send)
        lib.messenger.connect(self.colocAutoThreshold, "ProgressEvent",
                              self.updateProgress)
        self.thresholds = []
        self.settingsLst = []
        self.preview = None
        self.n = -1
Example #4
0
    def __init__(self):
        """
		Initialization
		"""
        self.defaultLower = 128
        self.defaultUpper = 255
        self.colocRange = (0, 255)
        self.numericalAperture = 1.4
        self.listctrl = None
        self.emissionWavelength = 520
        self.oldThresholds = None
        lib.ProcessingFilter.ProcessingFilter.__init__(self, (2, 2),
                                                       requireWholeDataset=1)
        for i in range(1, 3):
            self.setInputChannel(i, i)

        self.colocFilter = vtkbxd.vtkImageColocalizationFilter()
        self.colocFilter.AddObserver('ProgressEvent', lib.messenger.send)
        lib.messenger.connect(self.colocFilter, "ProgressEvent",
                              self.updateProgress)

        self.colocAutoThreshold = vtkbxd.vtkImageAutoThresholdColocalization()
        self.colocAutoThreshold.SetCalculateThreshold(0)
        self.colocAutoThreshold.GetOutput().ReleaseDataFlagOn()
        self.colocAutoThreshold.AddObserver('ProgressEvent',
                                            lib.messenger.send)
        lib.messenger.connect(self.colocAutoThreshold, "ProgressEvent",
                              self.updateProgress)
        self.descs = {
            "LowerThresholdCh1": "Lower Threshold (Ch1)",
            "UpperThresholdCh1": "Upper threshold (Ch1)",
            "LowerThresholdCh2": "Lower Threshold (Ch2)",
            "UpperThresholdCh2": "Upper threshold (Ch2)",
            "PValue": "Calculate P-value",
            "None": "None",
            "Costes": "Costes",
            "Fay": "Fay",
            "Steensel": "van Steensel",
            "Iterations": "Iterations",
            "PSF": "PSF radius (px)",
            "Lambda": u"Ch2 \u03BB (nm)",
            "NA": "Numerical aperture",
            "Palette": "",
            "OneBit": "Use single value for colocalization",
            "ColocValue": "Coloc. value"
        }
        self.resultVariables = {
            "Ch1ThresholdMax": "Ch1 Upper Threshold",
            "Ch2ThresholdMax": "Ch2 Upper Threshold",
            "PearsonImageAbove": "Correlation (voxels > threshold)",
            "PearsonImageBelow": "Correlation (voxels < threshold)",
            "PearsonWholeImage": "Correlation",
            "M1": "M1",
            "M2": "M2",
            "K1": "K1",
            "K2": "K2",
            "DiffStainIntCh1": "Diff.stain ch1/ch2 (intensity)",
            "DiffStainIntCh2": "Diff.stain ch2/ch1 (intensity)",
            "DiffStainVoxelsCh1": "Diff.stain of ch1/ch2 (# of voxels)",
            "DiffStainVoxelsCh2": "Diff.stain of ch2/ch1 (# of voxels)",
            "ThresholdM1": "M1 (colocalized voxels)",
            "ThresholdM2": "M2 (colocalized voxels)",
            "ColocAmount": "# of coloc. voxels",
            "ColocPercent": "% of colocalization",
            "PercentageVolumeCh1": "% of ch1 coloc. (voxels)",
            "PercentageTotalCh1": "% of ch1 coloc. (tot.intensity)",
            "PercentageTotalCh2": "% of ch2 coloc. (tot.intensity)",
            "PercentageVolumeCh2": "% of ch2 coloc. (voxels)",
            "PercentageMaterialCh1": "% of ch1 coloc. (intensity)",
            "PercentageMaterialCh2": "% of ch2 coloc. (intensity)",
            "SumOverThresholdCh1": "Sum of ch1 (over threshold)",
            "SumOverThresholdCh2": "Sum of ch2 (over threshold)",
            "SumCh1": "Sum of ch1 (total)",
            "SumCh2": "Sum of ch2 (total)",
            "NonZeroCh1": "# of non-zero voxels (Ch1)",
            "NonZeroCh2": "# of non-zero voxels (Ch2)",
            "OverThresholdCh2": "# of voxels > threshold (Ch2)",
            "OverThresholdCh1": "# of voxels > threshold (Ch1)",
            "Slope": "Slope",
            "Intercept": "Intercept",
            "PValue": "P-Value",
            "RObserved": "R(obs)",
            "RRandMean": "R(rand) mean",
            "RRandSD": "R(rand) sd",
            "NumIterations": "Iterations",
            "Method": "Method",
            "ColocCount": "Amount of coloc",
            "LowerThresholdCh1": "",
            "UpperThresholdCh1": "",
            "LowerThresholdCh2": "",
            "UpperThresholdCh2": ""
        }
        self.filterDesc = "Analyzes colocalization using manually specified thresholds, or automatically calculated thresholds if preceded by the procedure 'Calculate thresholds for colocalization'. Intended for use with the Batch Processor only, for other colocalization analyses use the Colocalization task.\nInputs: Grayscale images\nOutput: Results (Colocalization map as grayscale image)"
	def __init__(self):
		"""
		Initialization
		"""
		self.defaultLower = 128
		self.defaultUpper = 255
		self.colocRange = (0,255)
		self.numericalAperture = 1.4
		self.listctrl = None
		self.emissionWavelength = 520
		self.oldThresholds = None
		self.resultData = None
		lib.ProcessingFilter.ProcessingFilter.__init__(self, (4,4), requireWholeDataset = 1)
		for i in range(1, 3):
			self.setInputChannel(i, i)

		self.colocFilter = vtkbxd.vtkImageColocalizationFilter()
		self.colocFilter.AddObserver('ProgressEvent', lib.messenger.send)
		lib.messenger.connect(self.colocFilter, "ProgressEvent", self.updateProgress)

		self.colocAutoThreshold = vtkbxd.vtkImageMaskAutoThresholdColocalization()
		self.colocAutoThreshold.SetCalculateThreshold(0)
		self.colocAutoThreshold.GetOutput().ReleaseDataFlagOn()
		self.colocAutoThreshold.AddObserver('ProgressEvent', lib.messenger.send)
		lib.messenger.connect(self.colocAutoThreshold, "ProgressEvent", self.updateProgress)
		self.descs = {"LowerThresholdCh1": "Lower Threshold (Ch1)", "UpperThresholdCh1": "Upper threshold (Ch1)",
		"LowerThresholdCh2": "Lower Threshold (Ch2)", "UpperThresholdCh2": "Upper threshold (Ch2)",
		"PValue":"Calculate P-value","None":"None", "Costes":"Costes", "Fay":"Fay",
		"Steensel":"van Steensel","Iterations":"Iterations","PSF":"PSF radius (px)","Lambda":u"Ch2 \u03BB (nm)",
		"NA":"Numerical aperture", "Palette":"","OneBit":"Use single value for colocalization","ColocValue":"Coloc. value"
		}
		self.resultVariables = {
							"Ch1ThresholdMax":		"Ch1 Upper Threshold",
							"Ch2ThresholdMax":		"Ch2 Upper Threshold",
							"PearsonImageAbove":	"Correlation (voxels > threshold)",
							"PearsonImageBelow":	"Correlation (voxels < threshold)",
							"PearsonWholeImage":	"Correlation",
							"M1":					"M1",
							"M2":					"M2",
							"K1":					"K1",
							"K2":					"K2",
							"DiffStainIntCh1":		"Diff.stain ch1/h2 (intensity)",
							"DiffStainIntCh2":		"Diff.stain ch2/ch1 (intensity)",
							"DiffStainVoxelsCh1":	"Diff.stain of ch1/ch2 (# of voxels)",
							"DiffStainVoxelsCh2":	"Diff.stain of ch2/ch1 (# of voxels)",
							"ThresholdM1":			"M1 (colocalized voxels)",
							"ThresholdM2":			"M2 (colocalized voxels)",
							"ColocAmount":			"# of coloc. voxels",
							"ColocPercent":			"% of colocalization",
							"PercentageVolumeCh1":	"% of ch1 coloc. (voxels)",
							"PercentageTotalCh1":	"% of ch1 coloc. (tot.intensity)",
							"PercentageTotalCh2":	"% of ch2 coloc. (tot.intensity)",
							"PercentageVolumeCh2":	"% of ch2 coloc. (voxels)",
							"PercentageMaterialCh1":"% of ch1 coloc. (intensity)",
							"PercentageMaterialCh2":"% of ch2 coloc. (intensity)",
							"SumOverThresholdCh1":	"Sum of ch1 (over threshold)",
							"SumOverThresholdCh2":	"Sum of ch2 (over threshold)",
							"SumCh1":				"Sum of ch1 (total)",
							"SumCh2":				"Sum of ch2 (total)",
							"NonZeroCh1":			"# of non-zero voxels (Ch1)",
							"NonZeroCh2":			"# of non-zero voxels (Ch2)",
							"OverThresholdCh2":		"# of voxels > threshold (Ch2)",
							"OverThresholdCh1":		"# of voxels > threshold (Ch1)",
							"Slope":				"Slope",
							"Intercept":			"Intercept",
							"PValue":				"P-Value",
							"RObserved":			"R(obs)",
							"RRandMean":			"R(rand) mean",
							"RRandSD":				"R(rand) sd",
							"NumIterations":		"Iterations",
							"Method":				"Method",
							"ColocCount":			"Amount of coloc",
							"LowerThresholdCh1":"",
							"UpperThresholdCh1":"",
							"LowerThresholdCh2":"",
							"UpperThresholdCh2":""
							}
		self.filterDesc = "Analyzes colocalization using manually specified thresholds, or automatically calculated thresholds if preceded by the procedure 'Calculate thresholds for colocalization'. Intended for use with the Batch Processor only, for other colocalization analyses use the Colocalization task.\nInputs: Grayscale images\nOutput: Results (Colocalization map as grayscale image)"