Beispiel #1
0
    def onURLReceived(self, urlString):
        """Process DICOM view requests. Example:
    slicer://viewer/?studyUID=2.16.840.1.113669.632.20.121711.10000158860
      &access_token=k0zR6WAPpNbVguQ8gGUHp6
      &dicomweb_endpoint=http%3A%2F%2Fdemo.kheops.online%2Fapi
      &dicomweb_uri_endpoint=%20http%3A%2F%2Fdemo.kheops.online%2Fapi%2Fwado
    """

        url = qt.QUrl(urlString)
        if (url.authority().lower() != "viewer"):
            return
        query = qt.QUrlQuery(url)
        queryMap = {}
        for key, value in query.queryItems(qt.QUrl.FullyDecoded):
            queryMap[key] = qt.QUrl.fromPercentEncoding(value)

        if not "dicomweb_endpoint" in queryMap:
            logging.error("Missing dicomweb_endpoint")
            return
        if not "studyUID" in queryMap:
            logging.error("Missing studyUID")
            return

        accessToken = None
        if "access_token" in queryMap:
            accessToken = queryMap["access_token"]

        slicer.util.selectModule("DICOM")
        slicer.app.processEvents()
        from DICOMLib import DICOMUtils
        DICOMUtils.importFromDICOMWeb(
            dicomWebEndpoint=queryMap["dicomweb_endpoint"],
            studyInstanceUID=queryMap["studyUID"],
            accessToken=accessToken)
Beispiel #2
0
    def onURLReceived(self, urlString):
        """Process DICOM view requests. Example:
        slicer://viewer/?studyUID=2.16.840.1.113669.632.20.121711.10000158860
          &access_token=k0zR6WAPpNbVguQ8gGUHp6
          &dicomweb_endpoint=http%3A%2F%2Fdemo.kheops.online%2Fapi
          &dicomweb_uri_endpoint=%20http%3A%2F%2Fdemo.kheops.online%2Fapi%2Fwado
        """

        url = qt.QUrl(urlString)
        if (url.authority().lower() != "viewer"):
            logging.debug("DICOM module ignores non-viewer URL: " + urlString)
            return
        query = qt.QUrlQuery(url)
        queryMap = {}
        for key, value in query.queryItems(qt.QUrl.FullyDecoded):
            queryMap[key] = qt.QUrl.fromPercentEncoding(value)

        if "dicomweb_endpoint" not in queryMap:
            logging.debug(
                "DICOM module ignores URL without dicomweb_endpoint query parameter: "
                + urlString)
            return
        if "studyUID" not in queryMap:
            logging.debug(
                "DICOM module ignores URL without studyUID query parameter: " +
                urlString)
            return

        logging.info("DICOM module received URL: " + urlString)

        accessToken = None
        if "access_token" in queryMap:
            accessToken = queryMap["access_token"]

        slicer.util.selectModule("DICOM")
        slicer.app.processEvents()
        from DICOMLib import DICOMUtils
        importedSeriesInstanceUIDs = DICOMUtils.importFromDICOMWeb(
            dicomWebEndpoint=queryMap["dicomweb_endpoint"],
            studyInstanceUID=queryMap["studyUID"],
            accessToken=accessToken)

        # Select newly loaded items to make it easier to load them
        self.browserWidget.dicomBrowser.setSelectedItems(
            ctk.ctkDICOMModel.SeriesType, importedSeriesInstanceUIDs)