def Execute(self): SlicerVMTKAdvancedPageSkeleton.Execute(self) inVolume = self._parentClass._inVolumeSelector.GetSelected() outVolume = self._parentClass._outVolumeSelector.GetSelected() if not inVolume or not outVolume or not self.CheckForVmtkLibrary(): slicer.Application.ErrorMessage( "No input volume or no output volume found. Aborting VED..\n") return else: sigmaMin = float(self._sigmaMin.GetWidget().GetValue()) sigmaMax = float(self._sigmaMax.GetWidget().GetValue()) numberOfSigmaSteps = int(self._numberOfSigmaSteps.GetValue()) numberOfIterations = int(self._numberOfIterations.GetValue()) numberOfDiffusionSubIterations = int( self._numberOfDiffusionSubIterations.GetValue()) alpha = float(self._alpha.GetWidget().GetValue()) beta = float(self._beta.GetWidget().GetValue()) gamma = float(self._gamma.GetWidget().GetValue()) c = float(self._c.GetWidget().GetValue()) timestep = float(self._timestep.GetWidget().GetValue()) epsilon = float(self._epsilon.GetWidget().GetValue()) wstrength = float(self._wstrength.GetWidget().GetValue()) sensitivity = float(self._sensitivity.GetWidget().GetValue()) outVolumeImage = self._parentClass._logic.ApplyVED( inVolume.GetImageData(), sigmaMin, sigmaMax, numberOfSigmaSteps, alpha, beta, gamma, c, timestep, epsilon, wstrength, sensitivity, numberOfIterations, numberOfDiffusionSubIterations) matrix = slicer.vtkMatrix4x4() inVolume.GetIJKToRASMatrix(matrix) outVolume.SetAndObserveImageData(outVolumeImage) outVolume.SetIJKToRASMatrix(matrix) displayNode = inVolume.GetDisplayNode() if displayNode != None: newDisplayNode = displayNode.NewInstance() newDisplayNode.Copy(displayNode) slicer.MRMLScene.AddNodeNoNotify(newDisplayNode) outVolume.SetAndObserveDisplayNodeID(newDisplayNode.GetID()) newDisplayNode.AutoWindowLevelOff() newDisplayNode.AutoWindowLevelOn() # renew auto windowlevel appLogic = slicer.ApplicationLogic selectionNode = appLogic.GetSelectionNode() if inVolume.GetLabelMap(): outVolume.SetLabelMap(1) selectionNode.SetReferenceActiveLabelVolumeID( outVolume.GetID()) else: selectionNode.SetReferenceActiveVolumeID(outVolume.GetID()) appLogic.PropagateVolumeSelection()
def Execute(self): SlicerVMTKAdvancedPageSkeleton.Execute(self) inVolume = self._parentClass._inVolumeSelector.GetSelected() outVolume = self._parentClass._outVolumeSelector.GetSelected() if not inVolume or not outVolume or not self.CheckForVmtkLibrary(): slicer.Application.ErrorMessage("No input volume or no output volume found. Aborting Frangi..\n") return else: sigmaMin = float(self._sigmaMin.GetWidget().GetValue()) sigmaMax = float(self._sigmaMax.GetWidget().GetValue()) numberOfSigmaSteps = int(self._numberOfSigmaSteps.GetValue()) alpha = float(self._alpha.GetWidget().GetValue()) beta = float(self._beta.GetWidget().GetValue()) gamma = float(self._gamma.GetWidget().GetValue()) imageData = slicer.vtkImageData() imageData.DeepCopy(inVolume.GetImageData()) imageData.Update() if (self._sigmaUnit.GetWidget().GetWidget(0).GetSelectedState()==1): self._parentClass.debug("use mm!") imageData.SetSpacing(inVolume.GetSpacing()[0], inVolume.GetSpacing()[1], inVolume.GetSpacing()[2]) outVolumeImage = self._parentClass._logic.ApplyFrangiVesselness(imageData,sigmaMin,sigmaMax,numberOfSigmaSteps,alpha,beta,gamma) outVolumeImage.SetSpacing(1,1,1) matrix = slicer.vtkMatrix4x4() inVolume.GetIJKToRASMatrix(matrix) outVolume.SetAndObserveImageData(outVolumeImage) outVolume.SetIJKToRASMatrix(matrix) displayNode = inVolume.GetDisplayNode() if displayNode != None: newDisplayNode = displayNode.NewInstance() newDisplayNode.Copy(displayNode) slicer.MRMLScene.AddNodeNoNotify(newDisplayNode); outVolume.SetAndObserveDisplayNodeID(newDisplayNode.GetID()) newDisplayNode.AutoWindowLevelOff() newDisplayNode.AutoWindowLevelOn() # renew auto windowlevel appLogic = slicer.ApplicationLogic selectionNode = appLogic.GetSelectionNode() if inVolume.GetLabelMap(): outVolume.SetLabelMap(1) selectionNode.SetReferenceActiveLabelVolumeID(outVolume.GetID()) else: selectionNode.SetReferenceActiveVolumeID(outVolume.GetID()) appLogic.PropagateVolumeSelection()