Exemple #1
0
 def getPatientInformation(self):
   if not self.patientInfo:
     masterVolume = ModuleLogicMixin.getReferencedVolumeFromSegmentationNode(self.segmentationNode)
     self.patientInfo =  self.patientInfoTemplate.format(ModuleLogicMixin.getDICOMValue(masterVolume,
                                                                                        DICOMTAGS.PATIENT_NAME),
                                                         ModuleLogicMixin.getDICOMValue(masterVolume,
                                                                                        DICOMTAGS.PATIENT_ID),
                                                          ModuleLogicMixin.getDICOMValue(masterVolume,
                                                                                         DICOMTAGS.PATIENT_BIRTH_DATE))
   return self.patientInfo
 def getPatientInformation(self):
   if not self.patientInfo:
     masterVolume = ModuleLogicMixin.getReferencedVolumeFromSegmentationNode(self.segmentationNode)
     self.patientInfo =  self.patientInfoTemplate.format(ModuleLogicMixin.getDICOMValue(masterVolume,
                                                                                        DICOMTAGS.PATIENT_NAME),
                                                         ModuleLogicMixin.getDICOMValue(masterVolume,
                                                                                        DICOMTAGS.PATIENT_ID),
                                                          ModuleLogicMixin.getDICOMValue(masterVolume,
                                                                                         DICOMTAGS.PATIENT_BIRTH_DATE))
   return self.patientInfo
Exemple #3
0
    def refresh():
      self.segmentEditorWidget.editor.masterVolumeNodeSelectorVisible = \
        self.measurementReportSelector.currentNode() and \
        not ModuleLogicMixin.getReferencedVolumeFromSegmentationNode(self.segmentEditorWidget.segmentationNode)
      masterVolume = self.segmentEditorWidget.masterVolumeNode
      self.importSegmentationCollapsibleButton.enabled = masterVolume is not None
      if not self.importSegmentationCollapsibleButton.collapsed:
        self.importSegmentationCollapsibleButton.collapsed = masterVolume is None

      self.importLabelMapCollapsibleButton.enabled = masterVolume is not None
      if not self.importLabelMapCollapsibleButton.collapsed:
        self.importLabelMapCollapsibleButton.collapsed = masterVolume is None
      if not self.tableNode:
        self.enableReportButtons(False)
        self.updateMeasurementsTable(triggered=True)
    def refresh():
      self.segmentEditorWidget.editor.masterVolumeNodeSelectorVisible = \
        self.measurementReportSelector.currentNode() and \
        not ModuleLogicMixin.getReferencedVolumeFromSegmentationNode(self.segmentEditorWidget.segmentationNode)
      masterVolume = self.segmentEditorWidget.masterVolumeNode
      self.importSegmentationCollapsibleButton.enabled = masterVolume is not None
      if not self.importSegmentationCollapsibleButton.collapsed:
        self.importSegmentationCollapsibleButton.collapsed = masterVolume is None

      self.importLabelMapCollapsibleButton.enabled = masterVolume is not None
      if not self.importLabelMapCollapsibleButton.collapsed:
        self.importLabelMapCollapsibleButton.collapsed = masterVolume is None
      if not self.tableNode:
        self.enableReportButtons(False)
        self.updateMeasurementsTable(triggered=True)
Exemple #5
0
 def onSegmentationSelected(self, node):
   if not node:
     return
   masterVolume = ModuleLogicMixin.getReferencedVolumeFromSegmentationNode(node)
   if masterVolume:
     self.initializeWatchBox(masterVolume)
Exemple #6
0
  def getData(self):
    annotationLogic = slicer.modules.annotations.logic()
    qrLogic = CustomSegmentEditorLogic

    data = ""

    def find_2nd(string, substring):
      return string.find(substring, string.find(substring) + 1)

    widget = self.redWidget

    for w in [self.redWidget, self.greenWidget]:
      ScreenShotHelper.addRuler(w)

    self.setFOV2Largest2DRegion(widget)

    self.greenWidget.sliceLogic().FitSliceToAll()
    fov = self.greenSliceNode.GetFieldOfView()
    masterVolume = ModuleLogicMixin.getReferencedVolumeFromSegmentationNode(self.segmentationNode)
    xNumSlices = masterVolume.GetImageData().GetDimensions() [0]
    xSpacing = masterVolume.GetSpacing()[0]
    size = xNumSlices * xSpacing
    self.greenSliceNode.SetFieldOfView(size, fov[1] * size/fov[0], fov[2])

    tableHelper = vtkMRMLTableNodeHTMLHelper(self.statistics)

    for idx, segment in enumerate(qrLogic.getAllSegments(self.segmentationNode)):
      redAnnotationNode = self.jumpToSegmentAndCreateScreenShot(self.segmentationNode, segment,
                                                                [widget], center=True)
      redSS = annotationLogic.GetHTMLRepresentation(redAnnotationNode, 0)
      redSS = redSS[find_2nd(redSS, "<img src="):redSS.find(">", find_2nd(redSS, "<img src=")) + 1]
      redSS = redSS.replace("width='400'", "width=100%")

      greenAnnotationNode = self.jumpToSegmentAndCreateScreenShot(self.segmentationNode, segment,
                                                                  [self.greenWidget], center=False, crosshair=True)
      greenSS = annotationLogic.GetHTMLRepresentation(greenAnnotationNode, 0)
      greenSS = greenSS[find_2nd(greenSS, "<img src="):greenSS.find(">", find_2nd(greenSS, "<img src=")) + 1]
      greenSS = greenSS.replace("width='400'", "width=100%")

      data += '''
        <div class="print-friendly">
          <h2>{0}</h2>
          <table border=1 width='100%' cellPadding=3 cellSpacing=0>
            <thead>
              <tr>
                <th><b>Terminology</b></th>
                <th><b>Patient Info</b></th>
              </tr>
            </thead>
            <tr>
              <td valign='top' width='50%'>{1}</td>
              <td valign='top' width='50%'>{2}</td>
            </tr>
          </table>
          <br>
          <table border=1 width='100%' cellPadding=3 cellSpacing=0>
            <thead border=1>
              <tr>
                <th colspan="2"><b>Screenshots</b></th>
              </tr>
              <tr>
                <th><b>Axial</b></th>
                <th><b>Coronal</b></th>
              </tr>
            </thead>
            <tr>
              <td>{3}</td>
              <td>{4}</td>
            </tr>
          </table>  
          <br>
          <table border=1 width='100%' cellPadding=3 cellSpacing=0>
            <thead border=1>
              <tr>
                <th><b>Measurements</b></th>
              </tr>
            </thead>
            <tr>
              <td valign='top' width='100%'>{5}</td>
            </tr>
          </table>
        </div>
        '''.format(tableHelper.getNthSegmentName(idx),
                   self.getTerminologyInformation(segment), self.getPatientInformation(),
                   redSS, greenSS,
                   tableHelper.getHeaderAndNthRow(idx))

    for w in [self.redWidget, self.greenWidget]:
      ScreenShotHelper.hideRuler(w)
    # ModuleWidgetMixin.setFOV(sliceLogic, savedFOV)
    return data
  def getData(self):
    annotationLogic = slicer.modules.annotations.logic()
    qrLogic = CustomSegmentEditorLogic

    data = ""

    def find_2nd(string, substring):
      return string.find(substring, string.find(substring) + 1)

    widget = self.redWidget

    for w in [self.redWidget, self.greenWidget]:
      ScreenShotHelper.addRuler(w)

    self.setFOV2Largest2DRegion(widget)

    self.greenWidget.sliceLogic().FitSliceToAll()
    fov = self.greenSliceNode.GetFieldOfView()
    masterVolume = ModuleLogicMixin.getReferencedVolumeFromSegmentationNode(self.segmentationNode)
    xNumSlices = masterVolume.GetImageData().GetDimensions() [0]
    xSpacing = masterVolume.GetSpacing()[0]
    size = xNumSlices * xSpacing
    self.greenSliceNode.SetFieldOfView(size, fov[1] * size/fov[0], fov[2])

    tableHelper = vtkMRMLTableNodeHTMLHelper(self.statistics)

    for idx, segment in enumerate(qrLogic.getAllSegments(self.segmentationNode)):
      redAnnotationNode = self.jumpToSegmentAndCreateScreenShot(self.segmentationNode, segment,
                                                                [widget], center=True)
      redSS = annotationLogic.GetHTMLRepresentation(redAnnotationNode, 0)
      redSS = redSS[find_2nd(redSS, "<img src="):redSS.find(">", find_2nd(redSS, "<img src=")) + 1]
      redSS = redSS.replace("width='400'", "width=100%")

      greenAnnotationNode = self.jumpToSegmentAndCreateScreenShot(self.segmentationNode, segment,
                                                                  [self.greenWidget], center=False, crosshair=True)
      greenSS = annotationLogic.GetHTMLRepresentation(greenAnnotationNode, 0)
      greenSS = greenSS[find_2nd(greenSS, "<img src="):greenSS.find(">", find_2nd(greenSS, "<img src=")) + 1]
      greenSS = greenSS.replace("width='400'", "width=100%")

      data += '''
        <div class="print-friendly">
          <h2>{0}</h2>
          <table border=1 width='100%' cellPadding=3 cellSpacing=0>
            <thead>
              <tr>
                <th><b>Terminology</b></th>
                <th><b>Patient Info</b></th>
              </tr>
            </thead>
            <tr>
              <td valign='top' width='50%'>{1}</td>
              <td valign='top' width='50%'>{2}</td>
            </tr>
          </table>
          <br>
          <table border=1 width='100%' cellPadding=3 cellSpacing=0>
            <thead border=1>
              <tr>
                <th colspan="2"><b>Screenshots</b></th>
              </tr>
              <tr>
                <th><b>Axial</b></th>
                <th><b>Coronal</b></th>
              </tr>
            </thead>
            <tr>
              <td>{3}</td>
              <td>{4}</td>
            </tr>
          </table>
          <br>
          <table border=1 width='100%' cellPadding=3 cellSpacing=0>
            <thead border=1>
              <tr>
                <th><b>Measurements</b></th>
              </tr>
            </thead>
            <tr>
              <td valign='top' width='100%'>{5}</td>
            </tr>
          </table>
        </div>
        '''.format(tableHelper.getNthSegmentName(idx),
                   self.getTerminologyInformation(segment), self.getPatientInformation(),
                   redSS, greenSS,
                   tableHelper.getHeaderAndNthRow(idx))

    for w in [self.redWidget, self.greenWidget]:
      ScreenShotHelper.hideRuler(w)
    # ModuleWidgetMixin.setFOV(sliceLogic, savedFOV)
    return data
 def onSegmentationSelected(self, node):
   if not node:
     return
   masterVolume = ModuleLogicMixin.getReferencedVolumeFromSegmentationNode(node)
   if masterVolume:
     self.initializeWatchBox(masterVolume)