From 056a9ac132d35e069053f69a3f27c6cd3b33da81 Mon Sep 17 00:00:00 2001
From: Slicer Bot
Date: Tue, 21 Jun 2022 11:37:17 +0000
Subject: [PATCH 01/15] ENH: Update Slicer.crt CA bundle
This commit updates Slicer.crt certificate bundle with [make-ca.sh][1] script using the
content of [certdata][2] associated with mozilla/gecko-dev@549b3f9615dc6b2841a906af72d8f7e78e050034,
It was auto-generated by the [update-slicer-certificate-bundle][3] GitHub action workflow.
[1]: https://github.com/Slicer/Slicer/blob/0f29c7c9a73e844cb2b1c74fad9bde9321c43d07/Base/QTCore/Resources/Certs/make-ca.sh
[2]: https://github.com/mozilla/gecko-dev/blob/549b3f9615dc6b2841a906af72d8f7e78e050034/security/nss/lib/ckfw/builtins/certdata.txt?raw=true
[3]: https://github.com/Slicer/Slicer/blob/0f29c7c9a73e844cb2b1c74fad9bde9321c43d07/.github/workflows/update-slicer-certificate-bundle.yml
---
Base/QTCore/Resources/Certs/Slicer.crt | 2463 ++++++++++++++----------
1 file changed, 1450 insertions(+), 1013 deletions(-)
diff --git a/Base/QTCore/Resources/Certs/Slicer.crt b/Base/QTCore/Resources/Certs/Slicer.crt
index 8abb3fb2eea..a2593235872 100644
--- a/Base/QTCore/Resources/Certs/Slicer.crt
+++ b/Base/QTCore/Resources/Certs/Slicer.crt
@@ -1,87 +1,3 @@
-Certificate:
- Data:
- Version: 3 (0x2)
- Serial Number: 6643877497813316402 (0x5c33cb622c5fb332)
- Signature Algorithm: sha256WithRSAEncryption
- Issuer: CN = Atos TrustedRoot 2011, O = Atos, C = DE
- Validity
- Not Before: Jul 7 14:58:30 2011 GMT
- Not After : Dec 31 23:59:59 2030 GMT
- Subject: CN = Atos TrustedRoot 2011, O = Atos, C = DE
- Subject Public Key Info:
- Public Key Algorithm: rsaEncryption
- RSA Public-Key: (2048 bit)
- Modulus:
- 00:95:85:3b:97:6f:2a:3b:2e:3b:cf:a6:f3:29:35:
- be:cf:18:ac:3e:aa:d9:f8:4d:a0:3e:1a:47:b9:bc:
- 9a:df:f2:fe:cc:3e:47:e8:7a:96:c2:24:8e:35:f4:
- a9:0c:fc:82:fd:6d:c1:72:62:27:bd:ea:6b:eb:e7:
- 8a:cc:54:3e:90:50:cf:80:d4:95:fb:e8:b5:82:d4:
- 14:c5:b6:a9:55:25:57:db:b1:50:f6:b0:60:64:59:
- 7a:69:cf:03:b7:6f:0d:be:ca:3e:6f:74:72:ea:aa:
- 30:2a:73:62:be:49:91:61:c8:11:fe:0e:03:2a:f7:
- 6a:20:dc:02:15:0d:5e:15:6a:fc:e3:82:c1:b5:c5:
- 9d:64:09:6c:a3:59:98:07:27:c7:1b:96:2b:61:74:
- 71:6c:43:f1:f7:35:89:10:e0:9e:ec:55:a1:37:22:
- a2:87:04:05:2c:47:7d:b4:1c:b9:62:29:66:28:ca:
- b7:e1:93:f5:a4:94:03:99:b9:70:85:b5:e6:48:ea:
- 8d:50:fc:d9:de:cc:6f:07:0e:dd:0b:72:9d:80:30:
- 16:07:95:3f:28:0e:fd:c5:75:4f:53:d6:74:9a:b4:
- 24:2e:8e:02:91:cf:76:c5:9b:1e:55:74:9c:78:21:
- b1:f0:2d:f1:0b:9f:c2:d5:96:18:1f:f0:54:22:7a:
- 8c:07
- Exponent: 65537 (0x10001)
- X509v3 extensions:
- X509v3 Subject Key Identifier:
- A7:A5:06:B1:2C:A6:09:60:EE:D1:97:E9:70:AE:BC:3B:19:6C:DB:21
- X509v3 Basic Constraints: critical
- CA:TRUE
- X509v3 Authority Key Identifier:
- keyid:A7:A5:06:B1:2C:A6:09:60:EE:D1:97:E9:70:AE:BC:3B:19:6C:DB:21
-
- X509v3 Certificate Policies:
- Policy: 1.3.6.1.4.1.6189.3.4.1.1
-
- X509v3 Key Usage: critical
- Digital Signature, Certificate Sign, CRL Sign
- Signature Algorithm: sha256WithRSAEncryption
- 26:77:34:db:94:48:86:2a:41:9d:2c:3e:06:90:60:c4:8c:ac:
- 0b:54:b8:1f:b9:7b:d3:07:39:e4:fa:3e:7b:b2:3d:4e:ed:9f:
- 23:bd:97:f3:6b:5c:ef:ee:fd:40:a6:df:a1:93:a1:0a:86:ac:
- ef:20:d0:79:01:bd:78:f7:19:d8:24:31:34:04:01:a6:ba:15:
- 9a:c3:27:dc:d8:4f:0f:cc:18:63:ff:99:0f:0e:91:6b:75:16:
- e1:21:fc:d8:26:c7:47:b7:a6:cf:58:72:71:7e:ba:e1:4d:95:
- 47:3b:c9:af:6d:a1:b4:c1:ec:89:f6:b4:0f:38:b5:e2:64:dc:
- 25:cf:a6:db:eb:9a:5c:99:a1:c5:08:de:fd:e6:da:d5:d6:5a:
- 45:0c:c4:b7:c2:b5:14:ef:b4:11:ff:0e:15:b5:f5:f5:db:c6:
- bd:eb:5a:a7:f0:56:22:a9:3c:65:54:c6:15:a8:bd:86:9e:cd:
- 83:96:68:7a:71:81:89:e1:0b:e1:ea:11:1b:68:08:cc:69:9e:
- ec:9e:41:9e:44:32:26:7a:e2:87:0a:71:3d:eb:e4:5a:a4:d2:
- db:c5:cd:c6:de:60:7f:b9:f3:4f:44:92:ef:2a:b7:18:3e:a7:
- 19:d9:0b:7d:b1:37:41:42:b0:ba:60:1d:f2:fe:09:11:b0:f0:
- 87:7b:a7:9d
-SHA1 Fingerprint=2B:B1:F5:3E:55:0C:1D:C5:F1:D4:E6:B7:6A:46:4B:55:06:02:AC:21
------BEGIN CERTIFICATE-----
-MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UE
-AwwVQXRvcyBUcnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQG
-EwJERTAeFw0xMTA3MDcxNDU4MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMM
-FUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsGA1UECgwEQXRvczELMAkGA1UEBhMC
-REUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCVhTuXbyo7LjvPpvMp
-Nb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr54rM
-VD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+
-SZFhyBH+DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ
-4J7sVaE3IqKHBAUsR320HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0L
-cp2AMBYHlT8oDv3FdU9T1nSatCQujgKRz3bFmx5VdJx4IbHwLfELn8LVlhgf8FQi
-eowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7Rl+lwrrw7GWzbITAPBgNV
-HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZbNshMBgG
-A1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3
-DQEBCwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8j
-vZfza1zv7v1Apt+hk6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kP
-DpFrdRbhIfzYJsdHt6bPWHJxfrrhTZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pc
-maHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a961qn8FYiqTxlVMYVqL2Gns2D
-lmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G3mB/ufNPRJLv
-KrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
------END CERTIFICATE-----
Certificate:
Data:
Version: 3 (0x2)
@@ -831,96 +747,6 @@ r/OSmbaz5mEP0oUA51Aa5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1
/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tKG48BtieVU+i2iW1bvGjUI+iLUaJW+fCm
gKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP82Z+
-----END CERTIFICATE-----
-Certificate:
- Data:
- Version: 3 (0x2)
- Serial Number: 1 (0x1)
- Signature Algorithm: sha1WithRSAEncryption
- Issuer: C = GB, ST = Greater Manchester, L = Salford, O = Comodo CA Limited, CN = AAA Certificate Services
- Validity
- Not Before: Jan 1 00:00:00 2004 GMT
- Not After : Dec 31 23:59:59 2028 GMT
- Subject: C = GB, ST = Greater Manchester, L = Salford, O = Comodo CA Limited, CN = AAA Certificate Services
- Subject Public Key Info:
- Public Key Algorithm: rsaEncryption
- RSA Public-Key: (2048 bit)
- Modulus:
- 00:be:40:9d:f4:6e:e1:ea:76:87:1c:4d:45:44:8e:
- be:46:c8:83:06:9d:c1:2a:fe:18:1f:8e:e4:02:fa:
- f3:ab:5d:50:8a:16:31:0b:9a:06:d0:c5:70:22:cd:
- 49:2d:54:63:cc:b6:6e:68:46:0b:53:ea:cb:4c:24:
- c0:bc:72:4e:ea:f1:15:ae:f4:54:9a:12:0a:c3:7a:
- b2:33:60:e2:da:89:55:f3:22:58:f3:de:dc:cf:ef:
- 83:86:a2:8c:94:4f:9f:68:f2:98:90:46:84:27:c7:
- 76:bf:e3:cc:35:2c:8b:5e:07:64:65:82:c0:48:b0:
- a8:91:f9:61:9f:76:20:50:a8:91:c7:66:b5:eb:78:
- 62:03:56:f0:8a:1a:13:ea:31:a3:1e:a0:99:fd:38:
- f6:f6:27:32:58:6f:07:f5:6b:b8:fb:14:2b:af:b7:
- aa:cc:d6:63:5f:73:8c:da:05:99:a8:38:a8:cb:17:
- 78:36:51:ac:e9:9e:f4:78:3a:8d:cf:0f:d9:42:e2:
- 98:0c:ab:2f:9f:0e:01:de:ef:9f:99:49:f1:2d:df:
- ac:74:4d:1b:98:b5:47:c5:e5:29:d1:f9:90:18:c7:
- 62:9c:be:83:c7:26:7b:3e:8a:25:c7:c0:dd:9d:e6:
- 35:68:10:20:9d:8f:d8:de:d2:c3:84:9c:0d:5e:e8:
- 2f:c9
- Exponent: 65537 (0x10001)
- X509v3 extensions:
- X509v3 Subject Key Identifier:
- A0:11:0A:23:3E:96:F1:07:EC:E2:AF:29:EF:82:A5:7F:D0:30:A4:B4
- X509v3 Key Usage: critical
- Certificate Sign, CRL Sign
- X509v3 Basic Constraints: critical
- CA:TRUE
- X509v3 CRL Distribution Points:
-
- Full Name:
- URI:http://crl.comodoca.com/AAACertificateServices.crl
-
- Full Name:
- URI:http://crl.comodo.net/AAACertificateServices.crl
-
- Signature Algorithm: sha1WithRSAEncryption
- 08:56:fc:02:f0:9b:e8:ff:a4:fa:d6:7b:c6:44:80:ce:4f:c4:
- c5:f6:00:58:cc:a6:b6:bc:14:49:68:04:76:e8:e6:ee:5d:ec:
- 02:0f:60:d6:8d:50:18:4f:26:4e:01:e3:e6:b0:a5:ee:bf:bc:
- 74:54:41:bf:fd:fc:12:b8:c7:4f:5a:f4:89:60:05:7f:60:b7:
- 05:4a:f3:f6:f1:c2:bf:c4:b9:74:86:b6:2d:7d:6b:cc:d2:f3:
- 46:dd:2f:c6:e0:6a:c3:c3:34:03:2c:7d:96:dd:5a:c2:0e:a7:
- 0a:99:c1:05:8b:ab:0c:2f:f3:5c:3a:cf:6c:37:55:09:87:de:
- 53:40:6c:58:ef:fc:b6:ab:65:6e:04:f6:1b:dc:3c:e0:5a:15:
- c6:9e:d9:f1:59:48:30:21:65:03:6c:ec:e9:21:73:ec:9b:03:
- a1:e0:37:ad:a0:15:18:8f:fa:ba:02:ce:a7:2c:a9:10:13:2c:
- d4:e5:08:26:ab:22:97:60:f8:90:5e:74:d4:a2:9a:53:bd:f2:
- a9:68:e0:a2:6e:c2:d7:6c:b1:a3:0f:9e:bf:eb:68:e7:56:f2:
- ae:f2:e3:2b:38:3a:09:81:b5:6b:85:d7:be:2d:ed:3f:1a:b7:
- b2:63:e2:f5:62:2c:82:d4:6a:00:41:50:f1:39:83:9f:95:e9:
- 36:96:98:6e
-SHA1 Fingerprint=D1:EB:23:A4:6D:17:D6:8F:D9:25:64:C2:F1:F1:60:17:64:D8:E3:49
------BEGIN CERTIFICATE-----
-MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEb
-MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow
-GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmlj
-YXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVowezEL
-MAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE
-BwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNVBAMM
-GEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP
-ADCCAQoCggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQua
-BtDFcCLNSS1UY8y2bmhGC1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe
-3M/vg4aijJRPn2jymJBGhCfHdr/jzDUsi14HZGWCwEiwqJH5YZ92IFCokcdmtet4
-YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszWY19zjNoFmag4qMsXeDZR
-rOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjHYpy+g8cm
-ez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQU
-oBEKIz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
-MAMBAf8wewYDVR0fBHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20v
-QUFBQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29t
-b2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2VzLmNybDANBgkqhkiG9w0BAQUF
-AAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm7l3sAg9g1o1Q
-GE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
-Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2
-G9w84FoVxp7Z8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsi
-l2D4kF501KKaU73yqWjgom7C12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3
-smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
------END CERTIFICATE-----
Certificate:
Data:
Version: 3 (0x2)
@@ -1047,73 +873,163 @@ NVOFBkpdn627G190
Certificate:
Data:
Version: 3 (0x2)
- Serial Number:
- 01:fd:6d:30:fc:a3:ca:51:a8:1b:bc:64:0e:35:03:2d
- Signature Algorithm: sha384WithRSAEncryption
- Issuer: C = US, ST = New Jersey, L = Jersey City, O = The USERTRUST Network, CN = USERTrust RSA Certification Authority
+ Serial Number: 1 (0x1)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C = GB, ST = Greater Manchester, L = Salford, O = Comodo CA Limited, CN = AAA Certificate Services
Validity
- Not Before: Feb 1 00:00:00 2010 GMT
- Not After : Jan 18 23:59:59 2038 GMT
- Subject: C = US, ST = New Jersey, L = Jersey City, O = The USERTRUST Network, CN = USERTrust RSA Certification Authority
+ Not Before: Jan 1 00:00:00 2004 GMT
+ Not After : Dec 31 23:59:59 2028 GMT
+ Subject: C = GB, ST = Greater Manchester, L = Salford, O = Comodo CA Limited, CN = AAA Certificate Services
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
- RSA Public-Key: (4096 bit)
+ RSA Public-Key: (2048 bit)
Modulus:
- 00:80:12:65:17:36:0e:c3:db:08:b3:d0:ac:57:0d:
- 76:ed:cd:27:d3:4c:ad:50:83:61:e2:aa:20:4d:09:
- 2d:64:09:dc:ce:89:9f:cc:3d:a9:ec:f6:cf:c1:dc:
- f1:d3:b1:d6:7b:37:28:11:2b:47:da:39:c6:bc:3a:
- 19:b4:5f:a6:bd:7d:9d:a3:63:42:b6:76:f2:a9:3b:
- 2b:91:f8:e2:6f:d0:ec:16:20:90:09:3e:e2:e8:74:
- c9:18:b4:91:d4:62:64:db:7f:a3:06:f1:88:18:6a:
- 90:22:3c:bc:fe:13:f0:87:14:7b:f6:e4:1f:8e:d4:
- e4:51:c6:11:67:46:08:51:cb:86:14:54:3f:bc:33:
- fe:7e:6c:9c:ff:16:9d:18:bd:51:8e:35:a6:a7:66:
- c8:72:67:db:21:66:b1:d4:9b:78:03:c0:50:3a:e8:
- cc:f0:dc:bc:9e:4c:fe:af:05:96:35:1f:57:5a:b7:
- ff:ce:f9:3d:b7:2c:b6:f6:54:dd:c8:e7:12:3a:4d:
- ae:4c:8a:b7:5c:9a:b4:b7:20:3d:ca:7f:22:34:ae:
- 7e:3b:68:66:01:44:e7:01:4e:46:53:9b:33:60:f7:
- 94:be:53:37:90:73:43:f3:32:c3:53:ef:db:aa:fe:
- 74:4e:69:c7:6b:8c:60:93:de:c4:c7:0c:df:e1:32:
- ae:cc:93:3b:51:78:95:67:8b:ee:3d:56:fe:0c:d0:
- 69:0f:1b:0f:f3:25:26:6b:33:6d:f7:6e:47:fa:73:
- 43:e5:7e:0e:a5:66:b1:29:7c:32:84:63:55:89:c4:
- 0d:c1:93:54:30:19:13:ac:d3:7d:37:a7:eb:5d:3a:
- 6c:35:5c:db:41:d7:12:da:a9:49:0b:df:d8:80:8a:
- 09:93:62:8e:b5:66:cf:25:88:cd:84:b8:b1:3f:a4:
- 39:0f:d9:02:9e:eb:12:4c:95:7c:f3:6b:05:a9:5e:
- 16:83:cc:b8:67:e2:e8:13:9d:cc:5b:82:d3:4c:b3:
- ed:5b:ff:de:e5:73:ac:23:3b:2d:00:bf:35:55:74:
- 09:49:d8:49:58:1a:7f:92:36:e6:51:92:0e:f3:26:
- 7d:1c:4d:17:bc:c9:ec:43:26:d0:bf:41:5f:40:a9:
- 44:44:f4:99:e7:57:87:9e:50:1f:57:54:a8:3e:fd:
- 74:63:2f:b1:50:65:09:e6:58:42:2e:43:1a:4c:b4:
- f0:25:47:59:fa:04:1e:93:d4:26:46:4a:50:81:b2:
- de:be:78:b7:fc:67:15:e1:c9:57:84:1e:0f:63:d6:
- e9:62:ba:d6:5f:55:2e:ea:5c:c6:28:08:04:25:39:
- b8:0e:2b:a9:f2:4c:97:1c:07:3f:0d:52:f5:ed:ef:
- 2f:82:0f
+ 00:be:40:9d:f4:6e:e1:ea:76:87:1c:4d:45:44:8e:
+ be:46:c8:83:06:9d:c1:2a:fe:18:1f:8e:e4:02:fa:
+ f3:ab:5d:50:8a:16:31:0b:9a:06:d0:c5:70:22:cd:
+ 49:2d:54:63:cc:b6:6e:68:46:0b:53:ea:cb:4c:24:
+ c0:bc:72:4e:ea:f1:15:ae:f4:54:9a:12:0a:c3:7a:
+ b2:33:60:e2:da:89:55:f3:22:58:f3:de:dc:cf:ef:
+ 83:86:a2:8c:94:4f:9f:68:f2:98:90:46:84:27:c7:
+ 76:bf:e3:cc:35:2c:8b:5e:07:64:65:82:c0:48:b0:
+ a8:91:f9:61:9f:76:20:50:a8:91:c7:66:b5:eb:78:
+ 62:03:56:f0:8a:1a:13:ea:31:a3:1e:a0:99:fd:38:
+ f6:f6:27:32:58:6f:07:f5:6b:b8:fb:14:2b:af:b7:
+ aa:cc:d6:63:5f:73:8c:da:05:99:a8:38:a8:cb:17:
+ 78:36:51:ac:e9:9e:f4:78:3a:8d:cf:0f:d9:42:e2:
+ 98:0c:ab:2f:9f:0e:01:de:ef:9f:99:49:f1:2d:df:
+ ac:74:4d:1b:98:b5:47:c5:e5:29:d1:f9:90:18:c7:
+ 62:9c:be:83:c7:26:7b:3e:8a:25:c7:c0:dd:9d:e6:
+ 35:68:10:20:9d:8f:d8:de:d2:c3:84:9c:0d:5e:e8:
+ 2f:c9
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Subject Key Identifier:
- 53:79:BF:5A:AA:2B:4A:CF:54:80:E1:D8:9B:C0:9D:F2:B2:03:66:CB
+ A0:11:0A:23:3E:96:F1:07:EC:E2:AF:29:EF:82:A5:7F:D0:30:A4:B4
X509v3 Key Usage: critical
Certificate Sign, CRL Sign
X509v3 Basic Constraints: critical
CA:TRUE
- Signature Algorithm: sha384WithRSAEncryption
- 5c:d4:7c:0d:cf:f7:01:7d:41:99:65:0c:73:c5:52:9f:cb:f8:
- cf:99:06:7f:1b:da:43:15:9f:9e:02:55:57:96:14:f1:52:3c:
- 27:87:94:28:ed:1f:3a:01:37:a2:76:fc:53:50:c0:84:9b:c6:
- 6b:4e:ba:8c:21:4f:a2:8e:55:62:91:f3:69:15:d8:bc:88:e3:
- c4:aa:0b:fd:ef:a8:e9:4b:55:2a:06:20:6d:55:78:29:19:ee:
- 5f:30:5c:4b:24:11:55:ff:24:9a:6e:5e:2a:2b:ee:0b:4d:9f:
- 7f:f7:01:38:94:14:95:43:07:09:fb:60:a9:ee:1c:ab:12:8c:
- a0:9a:5e:a7:98:6a:59:6d:8b:3f:08:fb:c8:d1:45:af:18:15:
- 64:90:12:0f:73:28:2e:c5:e2:24:4e:fc:58:ec:f0:f4:45:fe:
- 22:b3:eb:2f:8e:d2:d9:45:61:05:c1:97:6f:a8:76:72:8f:8b:
- 8c:36:af:bf:0d:05:ce:71:8d:e6:a6:6f:1f:6c:a6:71:62:c5:
+ X509v3 CRL Distribution Points:
+
+ Full Name:
+ URI:http://crl.comodoca.com/AAACertificateServices.crl
+
+ Full Name:
+ URI:http://crl.comodo.net/AAACertificateServices.crl
+
+ Signature Algorithm: sha1WithRSAEncryption
+ 08:56:fc:02:f0:9b:e8:ff:a4:fa:d6:7b:c6:44:80:ce:4f:c4:
+ c5:f6:00:58:cc:a6:b6:bc:14:49:68:04:76:e8:e6:ee:5d:ec:
+ 02:0f:60:d6:8d:50:18:4f:26:4e:01:e3:e6:b0:a5:ee:bf:bc:
+ 74:54:41:bf:fd:fc:12:b8:c7:4f:5a:f4:89:60:05:7f:60:b7:
+ 05:4a:f3:f6:f1:c2:bf:c4:b9:74:86:b6:2d:7d:6b:cc:d2:f3:
+ 46:dd:2f:c6:e0:6a:c3:c3:34:03:2c:7d:96:dd:5a:c2:0e:a7:
+ 0a:99:c1:05:8b:ab:0c:2f:f3:5c:3a:cf:6c:37:55:09:87:de:
+ 53:40:6c:58:ef:fc:b6:ab:65:6e:04:f6:1b:dc:3c:e0:5a:15:
+ c6:9e:d9:f1:59:48:30:21:65:03:6c:ec:e9:21:73:ec:9b:03:
+ a1:e0:37:ad:a0:15:18:8f:fa:ba:02:ce:a7:2c:a9:10:13:2c:
+ d4:e5:08:26:ab:22:97:60:f8:90:5e:74:d4:a2:9a:53:bd:f2:
+ a9:68:e0:a2:6e:c2:d7:6c:b1:a3:0f:9e:bf:eb:68:e7:56:f2:
+ ae:f2:e3:2b:38:3a:09:81:b5:6b:85:d7:be:2d:ed:3f:1a:b7:
+ b2:63:e2:f5:62:2c:82:d4:6a:00:41:50:f1:39:83:9f:95:e9:
+ 36:96:98:6e
+SHA1 Fingerprint=D1:EB:23:A4:6D:17:D6:8F:D9:25:64:C2:F1:F1:60:17:64:D8:E3:49
+-----BEGIN CERTIFICATE-----
+MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEb
+MBkGA1UECAwSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRow
+GAYDVQQKDBFDb21vZG8gQ0EgTGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmlj
+YXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAwMFoXDTI4MTIzMTIzNTk1OVowezEL
+MAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UE
+BwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNVBAMM
+GEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEP
+ADCCAQoCggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQua
+BtDFcCLNSS1UY8y2bmhGC1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe
+3M/vg4aijJRPn2jymJBGhCfHdr/jzDUsi14HZGWCwEiwqJH5YZ92IFCokcdmtet4
+YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszWY19zjNoFmag4qMsXeDZR
+rOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjHYpy+g8cm
+ez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQU
+oBEKIz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
+MAMBAf8wewYDVR0fBHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20v
+QUFBQ2VydGlmaWNhdGVTZXJ2aWNlcy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29t
+b2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2VzLmNybDANBgkqhkiG9w0BAQUF
+AAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm7l3sAg9g1o1Q
+GE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
+Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2
+G9w84FoVxp7Z8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsi
+l2D4kF501KKaU73yqWjgom7C12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3
+smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
+-----END CERTIFICATE-----
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number:
+ 01:fd:6d:30:fc:a3:ca:51:a8:1b:bc:64:0e:35:03:2d
+ Signature Algorithm: sha384WithRSAEncryption
+ Issuer: C = US, ST = New Jersey, L = Jersey City, O = The USERTRUST Network, CN = USERTrust RSA Certification Authority
+ Validity
+ Not Before: Feb 1 00:00:00 2010 GMT
+ Not After : Jan 18 23:59:59 2038 GMT
+ Subject: C = US, ST = New Jersey, L = Jersey City, O = The USERTRUST Network, CN = USERTrust RSA Certification Authority
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public-Key: (4096 bit)
+ Modulus:
+ 00:80:12:65:17:36:0e:c3:db:08:b3:d0:ac:57:0d:
+ 76:ed:cd:27:d3:4c:ad:50:83:61:e2:aa:20:4d:09:
+ 2d:64:09:dc:ce:89:9f:cc:3d:a9:ec:f6:cf:c1:dc:
+ f1:d3:b1:d6:7b:37:28:11:2b:47:da:39:c6:bc:3a:
+ 19:b4:5f:a6:bd:7d:9d:a3:63:42:b6:76:f2:a9:3b:
+ 2b:91:f8:e2:6f:d0:ec:16:20:90:09:3e:e2:e8:74:
+ c9:18:b4:91:d4:62:64:db:7f:a3:06:f1:88:18:6a:
+ 90:22:3c:bc:fe:13:f0:87:14:7b:f6:e4:1f:8e:d4:
+ e4:51:c6:11:67:46:08:51:cb:86:14:54:3f:bc:33:
+ fe:7e:6c:9c:ff:16:9d:18:bd:51:8e:35:a6:a7:66:
+ c8:72:67:db:21:66:b1:d4:9b:78:03:c0:50:3a:e8:
+ cc:f0:dc:bc:9e:4c:fe:af:05:96:35:1f:57:5a:b7:
+ ff:ce:f9:3d:b7:2c:b6:f6:54:dd:c8:e7:12:3a:4d:
+ ae:4c:8a:b7:5c:9a:b4:b7:20:3d:ca:7f:22:34:ae:
+ 7e:3b:68:66:01:44:e7:01:4e:46:53:9b:33:60:f7:
+ 94:be:53:37:90:73:43:f3:32:c3:53:ef:db:aa:fe:
+ 74:4e:69:c7:6b:8c:60:93:de:c4:c7:0c:df:e1:32:
+ ae:cc:93:3b:51:78:95:67:8b:ee:3d:56:fe:0c:d0:
+ 69:0f:1b:0f:f3:25:26:6b:33:6d:f7:6e:47:fa:73:
+ 43:e5:7e:0e:a5:66:b1:29:7c:32:84:63:55:89:c4:
+ 0d:c1:93:54:30:19:13:ac:d3:7d:37:a7:eb:5d:3a:
+ 6c:35:5c:db:41:d7:12:da:a9:49:0b:df:d8:80:8a:
+ 09:93:62:8e:b5:66:cf:25:88:cd:84:b8:b1:3f:a4:
+ 39:0f:d9:02:9e:eb:12:4c:95:7c:f3:6b:05:a9:5e:
+ 16:83:cc:b8:67:e2:e8:13:9d:cc:5b:82:d3:4c:b3:
+ ed:5b:ff:de:e5:73:ac:23:3b:2d:00:bf:35:55:74:
+ 09:49:d8:49:58:1a:7f:92:36:e6:51:92:0e:f3:26:
+ 7d:1c:4d:17:bc:c9:ec:43:26:d0:bf:41:5f:40:a9:
+ 44:44:f4:99:e7:57:87:9e:50:1f:57:54:a8:3e:fd:
+ 74:63:2f:b1:50:65:09:e6:58:42:2e:43:1a:4c:b4:
+ f0:25:47:59:fa:04:1e:93:d4:26:46:4a:50:81:b2:
+ de:be:78:b7:fc:67:15:e1:c9:57:84:1e:0f:63:d6:
+ e9:62:ba:d6:5f:55:2e:ea:5c:c6:28:08:04:25:39:
+ b8:0e:2b:a9:f2:4c:97:1c:07:3f:0d:52:f5:ed:ef:
+ 2f:82:0f
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Subject Key Identifier:
+ 53:79:BF:5A:AA:2B:4A:CF:54:80:E1:D8:9B:C0:9D:F2:B2:03:66:CB
+ X509v3 Key Usage: critical
+ Certificate Sign, CRL Sign
+ X509v3 Basic Constraints: critical
+ CA:TRUE
+ Signature Algorithm: sha384WithRSAEncryption
+ 5c:d4:7c:0d:cf:f7:01:7d:41:99:65:0c:73:c5:52:9f:cb:f8:
+ cf:99:06:7f:1b:da:43:15:9f:9e:02:55:57:96:14:f1:52:3c:
+ 27:87:94:28:ed:1f:3a:01:37:a2:76:fc:53:50:c0:84:9b:c6:
+ 6b:4e:ba:8c:21:4f:a2:8e:55:62:91:f3:69:15:d8:bc:88:e3:
+ c4:aa:0b:fd:ef:a8:e9:4b:55:2a:06:20:6d:55:78:29:19:ee:
+ 5f:30:5c:4b:24:11:55:ff:24:9a:6e:5e:2a:2b:ee:0b:4d:9f:
+ 7f:f7:01:38:94:14:95:43:07:09:fb:60:a9:ee:1c:ab:12:8c:
+ a0:9a:5e:a7:98:6a:59:6d:8b:3f:08:fb:c8:d1:45:af:18:15:
+ 64:90:12:0f:73:28:2e:c5:e2:24:4e:fc:58:ec:f0:f4:45:fe:
+ 22:b3:eb:2f:8e:d2:d9:45:61:05:c1:97:6f:a8:76:72:8f:8b:
+ 8c:36:af:bf:0d:05:ce:71:8d:e6:a6:6f:1f:6c:a6:71:62:c5:
d8:d0:83:72:0c:f1:67:11:89:0c:9c:13:4c:72:34:df:bc:d5:
71:df:aa:71:dd:e1:b9:6c:8c:3c:12:5d:65:da:bd:57:12:b6:
43:6b:ff:e5:de:4d:66:11:51:cf:99:ae:ec:17:b6:e8:71:91:
@@ -1774,6 +1690,129 @@ BBYEFLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVC
R98crlOZF7ZvHH3hvxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nX
hTcGtXsI/esni0qU+eH6p44mCOh8kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
-----END CERTIFICATE-----
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 407555286 (0x184accd6)
+ Signature Algorithm: sha256WithRSAEncryption
+ Issuer: C = CN, O = China Financial Certification Authority, CN = CFCA EV ROOT
+ Validity
+ Not Before: Aug 8 03:07:01 2012 GMT
+ Not After : Dec 31 03:07:01 2029 GMT
+ Subject: C = CN, O = China Financial Certification Authority, CN = CFCA EV ROOT
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public-Key: (4096 bit)
+ Modulus:
+ 00:d7:5d:6b:cd:10:3f:1f:05:59:d5:05:4d:37:b1:
+ 0e:ec:98:2b:8e:15:1d:fa:93:4b:17:82:21:71:10:
+ 52:d7:51:64:70:16:c2:55:69:4d:8e:15:6d:9f:bf:
+ 0c:1b:c2:e0:a3:67:d6:0c:ac:cf:22:ae:af:77:54:
+ 2a:4b:4c:8a:53:52:7a:c3:ee:2e:de:b3:71:25:c1:
+ e9:5d:3d:ee:a1:2f:a3:f7:2a:3c:c9:23:1d:6a:ab:
+ 1d:a1:a7:f1:f3:ec:a0:d5:44:cf:15:cf:72:2f:1d:
+ 63:97:e8:99:f9:fd:93:a4:54:80:4c:52:d4:52:ab:
+ 2e:49:df:90:cd:b8:5f:be:3f:de:a1:ca:4d:20:d4:
+ 25:e8:84:29:53:b7:b1:88:1f:ff:fa:da:90:9f:0a:
+ a9:2d:41:3f:b1:f1:18:29:ee:16:59:2c:34:49:1a:
+ a8:06:d7:a8:88:d2:03:72:7a:32:e2:ea:68:4d:6e:
+ 2c:96:65:7b:ca:59:fa:f2:e2:dd:ee:30:2c:fb:cc:
+ 46:ac:c4:63:eb:6f:7f:36:2b:34:73:12:94:7f:df:
+ cc:26:9e:f1:72:5d:50:65:59:8f:69:b3:87:5e:32:
+ 6f:c3:18:8a:b5:95:8f:b0:7a:37:de:5a:45:3b:c7:
+ 36:e1:ef:67:d1:39:d3:97:5b:73:62:19:48:2d:87:
+ 1c:06:fb:74:98:20:49:73:f0:05:d2:1b:b1:a0:a3:
+ b7:1b:70:d3:88:69:b9:5a:d6:38:f4:62:dc:25:8b:
+ 78:bf:f8:e8:7e:b8:5c:c9:95:4f:5f:a7:2d:b9:20:
+ 6b:cf:6b:dd:f5:0d:f4:82:b7:f4:b2:66:2e:10:28:
+ f6:97:5a:7b:96:16:8f:01:19:2d:6c:6e:7f:39:58:
+ 06:64:83:01:83:83:c3:4d:92:dd:32:c6:87:a4:37:
+ e9:16:ce:aa:2d:68:af:0a:81:65:3a:70:c1:9b:ad:
+ 4d:6d:54:ca:2a:2d:4b:85:1b:b3:80:e6:70:45:0d:
+ 6b:5e:35:f0:7f:3b:b8:9c:e4:04:70:89:12:25:93:
+ da:0a:99:22:60:6a:63:60:4e:76:06:98:4e:bd:83:
+ ad:1d:58:8a:25:85:d2:c7:65:1e:2d:8e:c6:df:b6:
+ c6:e1:7f:8a:04:21:15:29:74:f0:3e:9c:90:9d:0c:
+ 2e:f1:8a:3e:5a:aa:0c:09:1e:c7:d5:3c:a3:ed:97:
+ c3:1e:34:fa:38:f9:08:0e:e3:c0:5d:2b:83:d1:56:
+ 6a:c9:b6:a8:54:53:2e:78:32:67:3d:82:7f:74:d0:
+ fb:e1:b6:05:60:b9:70:db:8e:0b:f9:13:58:6f:71:
+ 60:10:52:10:b9:c1:41:09:ef:72:1f:67:31:78:ff:
+ 96:05:8d
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Authority Key Identifier:
+ keyid:E3:FE:2D:FD:28:D0:0B:B5:BA:B6:A2:C4:BF:06:AA:05:8C:93:FB:2F
+
+ X509v3 Basic Constraints: critical
+ CA:TRUE
+ X509v3 Key Usage: critical
+ Certificate Sign, CRL Sign
+ X509v3 Subject Key Identifier:
+ E3:FE:2D:FD:28:D0:0B:B5:BA:B6:A2:C4:BF:06:AA:05:8C:93:FB:2F
+ Signature Algorithm: sha256WithRSAEncryption
+ 25:c6:ba:6b:eb:87:cb:de:82:39:96:3d:f0:44:a7:6b:84:73:
+ 03:de:9d:2b:4f:ba:20:7f:bc:78:b2:cf:97:b0:1b:9c:f3:d7:
+ 79:2e:f5:48:b6:d2:fb:17:88:e6:d3:7a:3f:ed:53:13:d0:e2:
+ 2f:6a:79:cb:00:23:28:e6:1e:37:57:35:89:84:c2:76:4f:34:
+ 36:ad:67:c3:ce:41:06:88:c5:f7:ee:d8:1a:b8:d6:0b:7f:50:
+ ff:93:aa:17:4b:8c:ec:ed:52:60:b2:a4:06:ea:4e:eb:f4:6b:
+ 19:fd:eb:f5:1a:e0:25:2a:9a:dc:c7:41:36:f7:c8:74:05:84:
+ 39:95:39:d6:0b:3b:a4:27:fa:08:d8:5c:1e:f8:04:60:52:11:
+ 28:28:03:ff:ef:53:66:00:a5:4a:34:16:66:7c:fd:09:a4:ae:
+ 9e:67:1a:6f:41:0b:6b:06:13:9b:8f:86:71:05:b4:2f:8d:89:
+ 66:33:29:76:54:9a:11:f8:27:fa:b2:3f:91:e0:ce:0d:1b:f3:
+ 30:1a:ad:bf:22:5d:1b:d3:bf:25:05:4d:e1:92:1a:7f:99:9f:
+ 3c:44:93:ca:d4:40:49:6c:80:87:d7:04:3a:c3:32:52:35:0e:
+ 56:f8:a5:dd:7d:c4:8b:0d:11:1f:53:cb:1e:b2:17:b6:68:77:
+ 5a:e0:d4:cb:c8:07:ae:f5:3a:2e:8e:37:b7:d0:01:4b:43:29:
+ 77:8c:39:97:8f:82:5a:f8:51:e5:89:a0:18:e7:68:7f:5d:0a:
+ 2e:fb:a3:47:0e:3d:a6:23:7a:c6:01:c7:8f:c8:5e:bf:6d:80:
+ 56:be:8a:24:ba:33:ea:9f:e1:32:11:9e:f1:d2:4f:80:f6:1b:
+ 40:af:38:9e:11:50:79:73:12:12:cd:e6:6c:9d:2c:88:72:3c:
+ 30:81:06:91:22:ea:59:ad:da:19:2e:22:c2:8d:b9:8c:87:e0:
+ 66:bc:73:23:5f:21:64:63:80:48:f5:a0:3c:18:3d:94:c8:48:
+ 41:1d:40:ba:5e:fe:fe:56:39:a1:c8:cf:5e:9e:19:64:46:10:
+ da:17:91:b7:05:80:ac:8b:99:92:7d:e7:a2:d8:07:0b:36:27:
+ e7:48:79:60:8a:c3:d7:13:5c:f8:72:40:df:4a:cb:cf:99:00:
+ 0a:00:0b:11:95:da:56:45:03:88:0a:9f:67:d0:d5:79:b1:a8:
+ 8d:40:6d:0d:c2:7a:40:fa:f3:5f:64:47:92:cb:53:b9:bb:59:
+ ce:4f:fd:d0:15:53:01:d8:df:eb:d9:e6:76:ef:d0:23:bb:3b:
+ a9:79:b3:d5:02:29:cd:89:a3:96:0f:4a:35:e7:4e:42:c0:75:
+ cd:07:cf:e6:2c:eb:7b:2e
+SHA1 Fingerprint=E2:B8:29:4B:55:84:AB:6B:58:C2:90:46:6C:AC:3F:B8:39:8F:84:83
+-----BEGIN CERTIFICATE-----
+MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJD
+TjEwMC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9y
+aXR5MRUwEwYDVQQDDAxDRkNBIEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkx
+MjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEwMC4GA1UECgwnQ2hpbmEgRmluYW5j
+aWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNBIEVWIFJP
+T1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnVBU03
+sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpL
+TIpTUnrD7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5
+/ZOkVIBMUtRSqy5J35DNuF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp
+7hZZLDRJGqgG16iI0gNyejLi6mhNbiyWZXvKWfry4t3uMCz7zEasxGPrb382KzRz
+EpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7xzbh72fROdOXW3NiGUgt
+hxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9fpy25IGvP
+a931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqot
+aK8KgWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNg
+TnYGmE69g60dWIolhdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfV
+PKPtl8MeNPo4+QgO48BdK4PRVmrJtqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hv
+cWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAfBgNVHSMEGDAWgBTj/i39KNAL
+tbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAd
+BgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
+ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObT
+ej/tUxPQ4i9qecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdL
+jOztUmCypAbqTuv0axn96/Ua4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBS
+ESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sGE5uPhnEFtC+NiWYzKXZUmhH4J/qy
+P5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfXBDrDMlI1Dlb4pd19
+xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjnaH9d
+Ci77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN
+5mydLIhyPDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe
+/v5WOaHIz16eGWRGENoXkbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+Z
+AAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3CekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ
+5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
+-----END CERTIFICATE-----
Certificate:
Data:
Version: 3 (0x2)
@@ -1900,129 +1939,6 @@ ohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y
4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8VCLAAVBpQ570su9t+Oza
8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
-----END CERTIFICATE-----
-Certificate:
- Data:
- Version: 3 (0x2)
- Serial Number: 407555286 (0x184accd6)
- Signature Algorithm: sha256WithRSAEncryption
- Issuer: C = CN, O = China Financial Certification Authority, CN = CFCA EV ROOT
- Validity
- Not Before: Aug 8 03:07:01 2012 GMT
- Not After : Dec 31 03:07:01 2029 GMT
- Subject: C = CN, O = China Financial Certification Authority, CN = CFCA EV ROOT
- Subject Public Key Info:
- Public Key Algorithm: rsaEncryption
- RSA Public-Key: (4096 bit)
- Modulus:
- 00:d7:5d:6b:cd:10:3f:1f:05:59:d5:05:4d:37:b1:
- 0e:ec:98:2b:8e:15:1d:fa:93:4b:17:82:21:71:10:
- 52:d7:51:64:70:16:c2:55:69:4d:8e:15:6d:9f:bf:
- 0c:1b:c2:e0:a3:67:d6:0c:ac:cf:22:ae:af:77:54:
- 2a:4b:4c:8a:53:52:7a:c3:ee:2e:de:b3:71:25:c1:
- e9:5d:3d:ee:a1:2f:a3:f7:2a:3c:c9:23:1d:6a:ab:
- 1d:a1:a7:f1:f3:ec:a0:d5:44:cf:15:cf:72:2f:1d:
- 63:97:e8:99:f9:fd:93:a4:54:80:4c:52:d4:52:ab:
- 2e:49:df:90:cd:b8:5f:be:3f:de:a1:ca:4d:20:d4:
- 25:e8:84:29:53:b7:b1:88:1f:ff:fa:da:90:9f:0a:
- a9:2d:41:3f:b1:f1:18:29:ee:16:59:2c:34:49:1a:
- a8:06:d7:a8:88:d2:03:72:7a:32:e2:ea:68:4d:6e:
- 2c:96:65:7b:ca:59:fa:f2:e2:dd:ee:30:2c:fb:cc:
- 46:ac:c4:63:eb:6f:7f:36:2b:34:73:12:94:7f:df:
- cc:26:9e:f1:72:5d:50:65:59:8f:69:b3:87:5e:32:
- 6f:c3:18:8a:b5:95:8f:b0:7a:37:de:5a:45:3b:c7:
- 36:e1:ef:67:d1:39:d3:97:5b:73:62:19:48:2d:87:
- 1c:06:fb:74:98:20:49:73:f0:05:d2:1b:b1:a0:a3:
- b7:1b:70:d3:88:69:b9:5a:d6:38:f4:62:dc:25:8b:
- 78:bf:f8:e8:7e:b8:5c:c9:95:4f:5f:a7:2d:b9:20:
- 6b:cf:6b:dd:f5:0d:f4:82:b7:f4:b2:66:2e:10:28:
- f6:97:5a:7b:96:16:8f:01:19:2d:6c:6e:7f:39:58:
- 06:64:83:01:83:83:c3:4d:92:dd:32:c6:87:a4:37:
- e9:16:ce:aa:2d:68:af:0a:81:65:3a:70:c1:9b:ad:
- 4d:6d:54:ca:2a:2d:4b:85:1b:b3:80:e6:70:45:0d:
- 6b:5e:35:f0:7f:3b:b8:9c:e4:04:70:89:12:25:93:
- da:0a:99:22:60:6a:63:60:4e:76:06:98:4e:bd:83:
- ad:1d:58:8a:25:85:d2:c7:65:1e:2d:8e:c6:df:b6:
- c6:e1:7f:8a:04:21:15:29:74:f0:3e:9c:90:9d:0c:
- 2e:f1:8a:3e:5a:aa:0c:09:1e:c7:d5:3c:a3:ed:97:
- c3:1e:34:fa:38:f9:08:0e:e3:c0:5d:2b:83:d1:56:
- 6a:c9:b6:a8:54:53:2e:78:32:67:3d:82:7f:74:d0:
- fb:e1:b6:05:60:b9:70:db:8e:0b:f9:13:58:6f:71:
- 60:10:52:10:b9:c1:41:09:ef:72:1f:67:31:78:ff:
- 96:05:8d
- Exponent: 65537 (0x10001)
- X509v3 extensions:
- X509v3 Authority Key Identifier:
- keyid:E3:FE:2D:FD:28:D0:0B:B5:BA:B6:A2:C4:BF:06:AA:05:8C:93:FB:2F
-
- X509v3 Basic Constraints: critical
- CA:TRUE
- X509v3 Key Usage: critical
- Certificate Sign, CRL Sign
- X509v3 Subject Key Identifier:
- E3:FE:2D:FD:28:D0:0B:B5:BA:B6:A2:C4:BF:06:AA:05:8C:93:FB:2F
- Signature Algorithm: sha256WithRSAEncryption
- 25:c6:ba:6b:eb:87:cb:de:82:39:96:3d:f0:44:a7:6b:84:73:
- 03:de:9d:2b:4f:ba:20:7f:bc:78:b2:cf:97:b0:1b:9c:f3:d7:
- 79:2e:f5:48:b6:d2:fb:17:88:e6:d3:7a:3f:ed:53:13:d0:e2:
- 2f:6a:79:cb:00:23:28:e6:1e:37:57:35:89:84:c2:76:4f:34:
- 36:ad:67:c3:ce:41:06:88:c5:f7:ee:d8:1a:b8:d6:0b:7f:50:
- ff:93:aa:17:4b:8c:ec:ed:52:60:b2:a4:06:ea:4e:eb:f4:6b:
- 19:fd:eb:f5:1a:e0:25:2a:9a:dc:c7:41:36:f7:c8:74:05:84:
- 39:95:39:d6:0b:3b:a4:27:fa:08:d8:5c:1e:f8:04:60:52:11:
- 28:28:03:ff:ef:53:66:00:a5:4a:34:16:66:7c:fd:09:a4:ae:
- 9e:67:1a:6f:41:0b:6b:06:13:9b:8f:86:71:05:b4:2f:8d:89:
- 66:33:29:76:54:9a:11:f8:27:fa:b2:3f:91:e0:ce:0d:1b:f3:
- 30:1a:ad:bf:22:5d:1b:d3:bf:25:05:4d:e1:92:1a:7f:99:9f:
- 3c:44:93:ca:d4:40:49:6c:80:87:d7:04:3a:c3:32:52:35:0e:
- 56:f8:a5:dd:7d:c4:8b:0d:11:1f:53:cb:1e:b2:17:b6:68:77:
- 5a:e0:d4:cb:c8:07:ae:f5:3a:2e:8e:37:b7:d0:01:4b:43:29:
- 77:8c:39:97:8f:82:5a:f8:51:e5:89:a0:18:e7:68:7f:5d:0a:
- 2e:fb:a3:47:0e:3d:a6:23:7a:c6:01:c7:8f:c8:5e:bf:6d:80:
- 56:be:8a:24:ba:33:ea:9f:e1:32:11:9e:f1:d2:4f:80:f6:1b:
- 40:af:38:9e:11:50:79:73:12:12:cd:e6:6c:9d:2c:88:72:3c:
- 30:81:06:91:22:ea:59:ad:da:19:2e:22:c2:8d:b9:8c:87:e0:
- 66:bc:73:23:5f:21:64:63:80:48:f5:a0:3c:18:3d:94:c8:48:
- 41:1d:40:ba:5e:fe:fe:56:39:a1:c8:cf:5e:9e:19:64:46:10:
- da:17:91:b7:05:80:ac:8b:99:92:7d:e7:a2:d8:07:0b:36:27:
- e7:48:79:60:8a:c3:d7:13:5c:f8:72:40:df:4a:cb:cf:99:00:
- 0a:00:0b:11:95:da:56:45:03:88:0a:9f:67:d0:d5:79:b1:a8:
- 8d:40:6d:0d:c2:7a:40:fa:f3:5f:64:47:92:cb:53:b9:bb:59:
- ce:4f:fd:d0:15:53:01:d8:df:eb:d9:e6:76:ef:d0:23:bb:3b:
- a9:79:b3:d5:02:29:cd:89:a3:96:0f:4a:35:e7:4e:42:c0:75:
- cd:07:cf:e6:2c:eb:7b:2e
-SHA1 Fingerprint=E2:B8:29:4B:55:84:AB:6B:58:C2:90:46:6C:AC:3F:B8:39:8F:84:83
------BEGIN CERTIFICATE-----
-MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJD
-TjEwMC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9y
-aXR5MRUwEwYDVQQDDAxDRkNBIEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkx
-MjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEwMC4GA1UECgwnQ2hpbmEgRmluYW5j
-aWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNBIEVWIFJP
-T1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnVBU03
-sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpL
-TIpTUnrD7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5
-/ZOkVIBMUtRSqy5J35DNuF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp
-7hZZLDRJGqgG16iI0gNyejLi6mhNbiyWZXvKWfry4t3uMCz7zEasxGPrb382KzRz
-EpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7xzbh72fROdOXW3NiGUgt
-hxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9fpy25IGvP
-a931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqot
-aK8KgWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNg
-TnYGmE69g60dWIolhdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfV
-PKPtl8MeNPo4+QgO48BdK4PRVmrJtqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hv
-cWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAfBgNVHSMEGDAWgBTj/i39KNAL
-tbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAd
-BgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
-ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObT
-ej/tUxPQ4i9qecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdL
-jOztUmCypAbqTuv0axn96/Ua4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBS
-ESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sGE5uPhnEFtC+NiWYzKXZUmhH4J/qy
-P5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfXBDrDMlI1Dlb4pd19
-xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjnaH9d
-Ci77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN
-5mydLIhyPDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe
-/v5WOaHIz16eGWRGENoXkbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+Z
-AAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3CekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ
-5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
------END CERTIFICATE-----
Certificate:
Data:
Version: 3 (0x2)
@@ -2898,35 +2814,134 @@ Certificate:
d6:c7:d3:e0:fb:09:60:6c
SHA1 Fingerprint=5A:8C:EF:45:D7:A6:98:59:76:7A:8C:8B:44:96:B5:78:CF:47:4B:1A
-----BEGIN CERTIFICATE-----
-MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwF
-ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6
-b24gUm9vdCBDQSAyMB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTEL
-MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv
-b3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK2Wny2cSkxK
-gXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4kHbZ
-W0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg
-1dKmSYXpN+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K
-8nu+NQWpEjTj82R0Yiw9AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r
-2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvdfLC6HM783k81ds8P+HgfajZRRidhW+me
-z/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAExkv8LV/SasrlX6avvDXbR
-8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSSbtqDT6Zj
-mUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz
-7Mt0Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6
-+XUyo05f7O0oYtlNc/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI
-0u1ufm8/0i2BWSlmy5A5lREedCf+3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMB
-Af8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSwDPBMMPQFWAJI/TPlUq9LhONm
-UjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oAA7CXDpO8Wqj2
-LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
-+gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kS
-k5Nrp+gvU5LEYFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl
-7uxMMne0nxrpS10gxdr9HIcWxkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygm
-btmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQgj9sAq+uEjonljYE1x2igGOpm/Hl
-urR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbWaQbLU8uz/mtBzUF+
-fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoVYh63
-n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE
-76KlXIx3KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H
-9jVlpNMKVv/1F2Rs76giJUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT
-4PsJYGw=
+MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwF
+ADA5MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6
+b24gUm9vdCBDQSAyMB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTEL
+MAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJv
+b3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK2Wny2cSkxK
+gXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4kHbZ
+W0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg
+1dKmSYXpN+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K
+8nu+NQWpEjTj82R0Yiw9AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r
+2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvdfLC6HM783k81ds8P+HgfajZRRidhW+me
+z/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAExkv8LV/SasrlX6avvDXbR
+8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSSbtqDT6Zj
+mUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz
+7Mt0Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6
++XUyo05f7O0oYtlNc/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI
+0u1ufm8/0i2BWSlmy5A5lREedCf+3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMB
+Af8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSwDPBMMPQFWAJI/TPlUq9LhONm
+UjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oAA7CXDpO8Wqj2
+LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
++gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kS
+k5Nrp+gvU5LEYFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl
+7uxMMne0nxrpS10gxdr9HIcWxkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygm
+btmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQgj9sAq+uEjonljYE1x2igGOpm/Hl
+urR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbWaQbLU8uz/mtBzUF+
+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoVYh63
+n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE
+76KlXIx3KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H
+9jVlpNMKVv/1F2Rs76giJUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT
+4PsJYGw=
+-----END CERTIFICATE-----
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number:
+ 06:6c:9f:d5:74:97:36:66:3f:3b:0b:9a:d9:e8:9e:76:03:f2:4a
+ Signature Algorithm: ecdsa-with-SHA256
+ Issuer: C = US, O = Amazon, CN = Amazon Root CA 3
+ Validity
+ Not Before: May 26 00:00:00 2015 GMT
+ Not After : May 26 00:00:00 2040 GMT
+ Subject: C = US, O = Amazon, CN = Amazon Root CA 3
+ Subject Public Key Info:
+ Public Key Algorithm: id-ecPublicKey
+ Public-Key: (256 bit)
+ pub:
+ 04:29:97:a7:c6:41:7f:c0:0d:9b:e8:01:1b:56:c6:
+ f2:52:a5:ba:2d:b2:12:e8:d2:2e:d7:fa:c9:c5:d8:
+ aa:6d:1f:73:81:3b:3b:98:6b:39:7c:33:a5:c5:4e:
+ 86:8e:80:17:68:62:45:57:7d:44:58:1d:b3:37:e5:
+ 67:08:eb:66:de
+ ASN1 OID: prime256v1
+ NIST CURVE: P-256
+ X509v3 extensions:
+ X509v3 Basic Constraints: critical
+ CA:TRUE
+ X509v3 Key Usage: critical
+ Digital Signature, Certificate Sign, CRL Sign
+ X509v3 Subject Key Identifier:
+ AB:B6:DB:D7:06:9E:37:AC:30:86:07:91:70:C7:9C:C4:19:B1:78:C0
+ Signature Algorithm: ecdsa-with-SHA256
+ 30:46:02:21:00:e0:85:92:a3:17:b7:8d:f9:2b:06:a5:93:ac:
+ 1a:98:68:61:72:fa:e1:a1:d0:fb:1c:78:60:a6:43:99:c5:b8:
+ c4:02:21:00:9c:02:ef:f1:94:9c:b3:96:f9:eb:c6:2a:f8:b6:
+ 2c:fe:3a:90:14:16:d7:8c:63:24:48:1c:df:30:7d:d5:68:3b
+SHA1 Fingerprint=0D:44:DD:8C:3C:8C:1A:1A:58:75:64:81:E9:0F:2E:2A:FF:B3:D2:6E
+-----BEGIN CERTIFICATE-----
+MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5
+MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g
+Um9vdCBDQSAzMB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkG
+A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3Qg
+Q0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZBf8ANm+gBG1bG8lKl
+ui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjrZt6j
+QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSr
+ttvXBp43rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkr
+BqWTrBqYaGFy+uGh0PsceGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteM
+YyRIHN8wfdVoOw==
+-----END CERTIFICATE-----
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number:
+ 06:6c:9f:d7:c1:bb:10:4c:29:43:e5:71:7b:7b:2c:c8:1a:c1:0e
+ Signature Algorithm: ecdsa-with-SHA384
+ Issuer: C = US, O = Amazon, CN = Amazon Root CA 4
+ Validity
+ Not Before: May 26 00:00:00 2015 GMT
+ Not After : May 26 00:00:00 2040 GMT
+ Subject: C = US, O = Amazon, CN = Amazon Root CA 4
+ Subject Public Key Info:
+ Public Key Algorithm: id-ecPublicKey
+ Public-Key: (384 bit)
+ pub:
+ 04:d2:ab:8a:37:4f:a3:53:0d:fe:c1:8a:7b:4b:a8:
+ 7b:46:4b:63:b0:62:f6:2d:1b:db:08:71:21:d2:00:
+ e8:63:bd:9a:27:fb:f0:39:6e:5d:ea:3d:a5:c9:81:
+ aa:a3:5b:20:98:45:5d:16:db:fd:e8:10:6d:e3:9c:
+ e0:e3:bd:5f:84:62:f3:70:64:33:a0:cb:24:2f:70:
+ ba:88:a1:2a:a0:75:f8:81:ae:62:06:c4:81:db:39:
+ 6e:29:b0:1e:fa:2e:5c
+ ASN1 OID: secp384r1
+ NIST CURVE: P-384
+ X509v3 extensions:
+ X509v3 Basic Constraints: critical
+ CA:TRUE
+ X509v3 Key Usage: critical
+ Digital Signature, Certificate Sign, CRL Sign
+ X509v3 Subject Key Identifier:
+ D3:EC:C7:3A:65:6E:CC:E1:DA:76:9A:56:FB:9C:F3:86:6D:57:E5:81
+ Signature Algorithm: ecdsa-with-SHA384
+ 30:65:02:30:3a:8b:21:f1:bd:7e:11:ad:d0:ef:58:96:2f:d6:
+ eb:9d:7e:90:8d:2b:cf:66:55:c3:2c:e3:28:a9:70:0a:47:0e:
+ f0:37:59:12:ff:2d:99:94:28:4e:2a:4f:35:4d:33:5a:02:31:
+ 00:ea:75:00:4e:3b:c4:3a:94:12:91:c9:58:46:9d:21:13:72:
+ a7:88:9c:8a:e4:4c:4a:db:96:d4:ac:8b:6b:6b:49:12:53:33:
+ ad:d7:e4:be:24:fc:b5:0a:76:d4:a5:bc:10
+SHA1 Fingerprint=F6:10:84:07:D6:F8:BB:67:98:0C:C2:E2:44:C2:EB:AE:1C:EF:63:BE
+-----BEGIN CERTIFICATE-----
+MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5
+MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g
+Um9vdCBDQSA0MB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkG
+A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3Qg
+Q0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN/sGKe0uoe0ZLY7Bi
+9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri83Bk
+M6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB
+/zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WB
+MAoGCCqGSM49BAMDA2gAMGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlw
+CkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1AE47xDqUEpHJWEadIRNyp4iciuRMStuW
+1KyLa2tJElMzrdfkviT8tQp21KW8EA==
-----END CERTIFICATE-----
Certificate:
Data:
@@ -3065,105 +3080,6 @@ Wy10QJLZYxkNc91pvGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeT
mJlglFwjz1onl14LBQaTNx47aTbrqZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK
4SVhM7JZG+Ju1zdXtg2pEto=
-----END CERTIFICATE-----
-Certificate:
- Data:
- Version: 3 (0x2)
- Serial Number:
- 06:6c:9f:d5:74:97:36:66:3f:3b:0b:9a:d9:e8:9e:76:03:f2:4a
- Signature Algorithm: ecdsa-with-SHA256
- Issuer: C = US, O = Amazon, CN = Amazon Root CA 3
- Validity
- Not Before: May 26 00:00:00 2015 GMT
- Not After : May 26 00:00:00 2040 GMT
- Subject: C = US, O = Amazon, CN = Amazon Root CA 3
- Subject Public Key Info:
- Public Key Algorithm: id-ecPublicKey
- Public-Key: (256 bit)
- pub:
- 04:29:97:a7:c6:41:7f:c0:0d:9b:e8:01:1b:56:c6:
- f2:52:a5:ba:2d:b2:12:e8:d2:2e:d7:fa:c9:c5:d8:
- aa:6d:1f:73:81:3b:3b:98:6b:39:7c:33:a5:c5:4e:
- 86:8e:80:17:68:62:45:57:7d:44:58:1d:b3:37:e5:
- 67:08:eb:66:de
- ASN1 OID: prime256v1
- NIST CURVE: P-256
- X509v3 extensions:
- X509v3 Basic Constraints: critical
- CA:TRUE
- X509v3 Key Usage: critical
- Digital Signature, Certificate Sign, CRL Sign
- X509v3 Subject Key Identifier:
- AB:B6:DB:D7:06:9E:37:AC:30:86:07:91:70:C7:9C:C4:19:B1:78:C0
- Signature Algorithm: ecdsa-with-SHA256
- 30:46:02:21:00:e0:85:92:a3:17:b7:8d:f9:2b:06:a5:93:ac:
- 1a:98:68:61:72:fa:e1:a1:d0:fb:1c:78:60:a6:43:99:c5:b8:
- c4:02:21:00:9c:02:ef:f1:94:9c:b3:96:f9:eb:c6:2a:f8:b6:
- 2c:fe:3a:90:14:16:d7:8c:63:24:48:1c:df:30:7d:d5:68:3b
-SHA1 Fingerprint=0D:44:DD:8C:3C:8C:1A:1A:58:75:64:81:E9:0F:2E:2A:FF:B3:D2:6E
------BEGIN CERTIFICATE-----
-MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5
-MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g
-Um9vdCBDQSAzMB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkG
-A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3Qg
-Q0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZBf8ANm+gBG1bG8lKl
-ui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjrZt6j
-QjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSr
-ttvXBp43rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkr
-BqWTrBqYaGFy+uGh0PsceGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteM
-YyRIHN8wfdVoOw==
------END CERTIFICATE-----
-Certificate:
- Data:
- Version: 3 (0x2)
- Serial Number:
- 06:6c:9f:d7:c1:bb:10:4c:29:43:e5:71:7b:7b:2c:c8:1a:c1:0e
- Signature Algorithm: ecdsa-with-SHA384
- Issuer: C = US, O = Amazon, CN = Amazon Root CA 4
- Validity
- Not Before: May 26 00:00:00 2015 GMT
- Not After : May 26 00:00:00 2040 GMT
- Subject: C = US, O = Amazon, CN = Amazon Root CA 4
- Subject Public Key Info:
- Public Key Algorithm: id-ecPublicKey
- Public-Key: (384 bit)
- pub:
- 04:d2:ab:8a:37:4f:a3:53:0d:fe:c1:8a:7b:4b:a8:
- 7b:46:4b:63:b0:62:f6:2d:1b:db:08:71:21:d2:00:
- e8:63:bd:9a:27:fb:f0:39:6e:5d:ea:3d:a5:c9:81:
- aa:a3:5b:20:98:45:5d:16:db:fd:e8:10:6d:e3:9c:
- e0:e3:bd:5f:84:62:f3:70:64:33:a0:cb:24:2f:70:
- ba:88:a1:2a:a0:75:f8:81:ae:62:06:c4:81:db:39:
- 6e:29:b0:1e:fa:2e:5c
- ASN1 OID: secp384r1
- NIST CURVE: P-384
- X509v3 extensions:
- X509v3 Basic Constraints: critical
- CA:TRUE
- X509v3 Key Usage: critical
- Digital Signature, Certificate Sign, CRL Sign
- X509v3 Subject Key Identifier:
- D3:EC:C7:3A:65:6E:CC:E1:DA:76:9A:56:FB:9C:F3:86:6D:57:E5:81
- Signature Algorithm: ecdsa-with-SHA384
- 30:65:02:30:3a:8b:21:f1:bd:7e:11:ad:d0:ef:58:96:2f:d6:
- eb:9d:7e:90:8d:2b:cf:66:55:c3:2c:e3:28:a9:70:0a:47:0e:
- f0:37:59:12:ff:2d:99:94:28:4e:2a:4f:35:4d:33:5a:02:31:
- 00:ea:75:00:4e:3b:c4:3a:94:12:91:c9:58:46:9d:21:13:72:
- a7:88:9c:8a:e4:4c:4a:db:96:d4:ac:8b:6b:6b:49:12:53:33:
- ad:d7:e4:be:24:fc:b5:0a:76:d4:a5:bc:10
-SHA1 Fingerprint=F6:10:84:07:D6:F8:BB:67:98:0C:C2:E2:44:C2:EB:AE:1C:EF:63:BE
------BEGIN CERTIFICATE-----
-MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5
-MQswCQYDVQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24g
-Um9vdCBDQSA0MB4XDTE1MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkG
-A1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZMBcGA1UEAxMQQW1hem9uIFJvb3Qg
-Q0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN/sGKe0uoe0ZLY7Bi
-9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri83Bk
-M6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB
-/zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WB
-MAoGCCqGSM49BAMDA2gAMGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlw
-CkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1AE47xDqUEpHJWEadIRNyp4iciuRMStuW
-1KyLa2tJElMzrdfkviT8tQp21KW8EA==
------END CERTIFICATE-----
Certificate:
Data:
Version: 3 (0x2)
@@ -3844,86 +3760,9 @@ BAAiA2IABEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI
7Z4INcgn64mMU1jrYor+8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPg
CemB+vNH06NjMGEwHQYDVR0OBBYEFILRhXMw5zUE044CkvvlpNHEIejNMA8GA1Ud
EwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTTjgKS++Wk0cQh6M0wDgYD
-VR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCWe+0F+S8T
-kdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+
-gA0z5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl
------END CERTIFICATE-----
-Certificate:
- Data:
- Version: 3 (0x2)
- Serial Number: 0 (0x0)
- Signature Algorithm: sha1WithRSAEncryption
- Issuer: C = JP, O = SECOM Trust.net, OU = Security Communication RootCA1
- Validity
- Not Before: Sep 30 04:20:49 2003 GMT
- Not After : Sep 30 04:20:49 2023 GMT
- Subject: C = JP, O = SECOM Trust.net, OU = Security Communication RootCA1
- Subject Public Key Info:
- Public Key Algorithm: rsaEncryption
- RSA Public-Key: (2048 bit)
- Modulus:
- 00:b3:b3:fe:7f:d3:6d:b1:ef:16:7c:57:a5:0c:6d:
- 76:8a:2f:4b:bf:64:fb:4c:ee:8a:f0:f3:29:7c:f5:
- ff:ee:2a:e0:e9:e9:ba:5b:64:22:9a:9a:6f:2c:3a:
- 26:69:51:05:99:26:dc:d5:1c:6a:71:c6:9a:7d:1e:
- 9d:dd:7c:6c:c6:8c:67:67:4a:3e:f8:71:b0:19:27:
- a9:09:0c:a6:95:bf:4b:8c:0c:fa:55:98:3b:d8:e8:
- 22:a1:4b:71:38:79:ac:97:92:69:b3:89:7e:ea:21:
- 68:06:98:14:96:87:d2:61:36:bc:6d:27:56:9e:57:
- ee:c0:c0:56:fd:32:cf:a4:d9:8e:c2:23:d7:8d:a8:
- f3:d8:25:ac:97:e4:70:38:f4:b6:3a:b4:9d:3b:97:
- 26:43:a3:a1:bc:49:59:72:4c:23:30:87:01:58:f6:
- 4e:be:1c:68:56:66:af:cd:41:5d:c8:b3:4d:2a:55:
- 46:ab:1f:da:1e:e2:40:3d:db:cd:7d:b9:92:80:9c:
- 37:dd:0c:96:64:9d:dc:22:f7:64:8b:df:61:de:15:
- 94:52:15:a0:7d:52:c9:4b:a8:21:c9:c6:b1:ed:cb:
- c3:95:60:d1:0f:f0:ab:70:f8:df:cb:4d:7e:ec:d6:
- fa:ab:d9:bd:7f:54:f2:a5:e9:79:fa:d9:d6:76:24:
- 28:73
- Exponent: 65537 (0x10001)
- X509v3 extensions:
- X509v3 Subject Key Identifier:
- A0:73:49:99:68:DC:85:5B:65:E3:9B:28:2F:57:9F:BD:33:BC:07:48
- X509v3 Key Usage:
- Certificate Sign, CRL Sign
- X509v3 Basic Constraints: critical
- CA:TRUE
- Signature Algorithm: sha1WithRSAEncryption
- 68:40:a9:a8:bb:e4:4f:5d:79:b3:05:b5:17:b3:60:13:eb:c6:
- 92:5d:e0:d1:d3:6a:fe:fb:be:9b:6d:bf:c7:05:6d:59:20:c4:
- 1c:f0:b7:da:84:58:02:63:fa:48:16:ef:4f:a5:0b:f7:4a:98:
- f2:3f:9e:1b:ad:47:6b:63:ce:08:47:eb:52:3f:78:9c:af:4d:
- ae:f8:d5:4f:cf:9a:98:2a:10:41:39:52:c4:dd:d9:9b:0e:ef:
- 93:01:ae:b2:2e:ca:68:42:24:42:6c:b0:b3:3a:3e:cd:e9:da:
- 48:c4:15:cb:e9:f9:07:0f:92:50:49:8a:dd:31:97:5f:c9:e9:
- 37:aa:3b:59:65:97:94:32:c9:b3:9f:3e:3a:62:58:c5:49:ad:
- 62:0e:71:a5:32:aa:2f:c6:89:76:43:40:13:13:67:3d:a2:54:
- 25:10:cb:f1:3a:f2:d9:fa:db:49:56:bb:a6:fe:a7:41:35:c3:
- e0:88:61:c9:88:c7:df:36:10:22:98:59:ea:b0:4a:fb:56:16:
- 73:6e:ac:4d:f7:22:a1:4f:ad:1d:7a:2d:45:27:e5:30:c1:5e:
- f2:da:13:cb:25:42:51:95:47:03:8c:6c:21:cc:74:42:ed:53:
- ff:33:8b:8f:0f:57:01:16:2f:cf:a6:ee:c9:70:22:14:bd:fd:
- be:6c:0b:03
-SHA1 Fingerprint=36:B1:2B:49:F9:81:9E:D7:4C:9E:BC:38:0F:C6:56:8F:5D:AC:B2:F7
------BEGIN CERTIFICATE-----
-MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEY
-MBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21t
-dW5pY2F0aW9uIFJvb3RDQTEwHhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5
-WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYD
-VQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEwggEiMA0GCSqGSIb3
-DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw8yl8
-9f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJ
-DKaVv0uMDPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9
-Ms+k2Y7CI9eNqPPYJayX5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/N
-QV3Is00qVUarH9oe4kA92819uZKAnDfdDJZkndwi92SL32HeFZRSFaB9UslLqCHJ
-xrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2JChzAgMBAAGjPzA9MB0G
-A1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYwDwYDVR0T
-AQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vG
-kl3g0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfr
-Uj94nK9NrvjVT8+amCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5
-Bw+SUEmK3TGXX8npN6o7WWWXlDLJs58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJU
-JRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ6rBK+1YWc26sTfcioU+tHXot
-RSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAiFL39vmwLAw==
+VR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCWe+0F+S8T
+kdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+
+gA0z5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl
-----END CERTIFICATE-----
Certificate:
Data:
@@ -4050,6 +3889,83 @@ w/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1hlMYegouCRw2n5H9gooi
S9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX9hwJ1C07
mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w==
-----END CERTIFICATE-----
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 0 (0x0)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C = JP, O = SECOM Trust.net, OU = Security Communication RootCA1
+ Validity
+ Not Before: Sep 30 04:20:49 2003 GMT
+ Not After : Sep 30 04:20:49 2023 GMT
+ Subject: C = JP, O = SECOM Trust.net, OU = Security Communication RootCA1
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public-Key: (2048 bit)
+ Modulus:
+ 00:b3:b3:fe:7f:d3:6d:b1:ef:16:7c:57:a5:0c:6d:
+ 76:8a:2f:4b:bf:64:fb:4c:ee:8a:f0:f3:29:7c:f5:
+ ff:ee:2a:e0:e9:e9:ba:5b:64:22:9a:9a:6f:2c:3a:
+ 26:69:51:05:99:26:dc:d5:1c:6a:71:c6:9a:7d:1e:
+ 9d:dd:7c:6c:c6:8c:67:67:4a:3e:f8:71:b0:19:27:
+ a9:09:0c:a6:95:bf:4b:8c:0c:fa:55:98:3b:d8:e8:
+ 22:a1:4b:71:38:79:ac:97:92:69:b3:89:7e:ea:21:
+ 68:06:98:14:96:87:d2:61:36:bc:6d:27:56:9e:57:
+ ee:c0:c0:56:fd:32:cf:a4:d9:8e:c2:23:d7:8d:a8:
+ f3:d8:25:ac:97:e4:70:38:f4:b6:3a:b4:9d:3b:97:
+ 26:43:a3:a1:bc:49:59:72:4c:23:30:87:01:58:f6:
+ 4e:be:1c:68:56:66:af:cd:41:5d:c8:b3:4d:2a:55:
+ 46:ab:1f:da:1e:e2:40:3d:db:cd:7d:b9:92:80:9c:
+ 37:dd:0c:96:64:9d:dc:22:f7:64:8b:df:61:de:15:
+ 94:52:15:a0:7d:52:c9:4b:a8:21:c9:c6:b1:ed:cb:
+ c3:95:60:d1:0f:f0:ab:70:f8:df:cb:4d:7e:ec:d6:
+ fa:ab:d9:bd:7f:54:f2:a5:e9:79:fa:d9:d6:76:24:
+ 28:73
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Subject Key Identifier:
+ A0:73:49:99:68:DC:85:5B:65:E3:9B:28:2F:57:9F:BD:33:BC:07:48
+ X509v3 Key Usage:
+ Certificate Sign, CRL Sign
+ X509v3 Basic Constraints: critical
+ CA:TRUE
+ Signature Algorithm: sha1WithRSAEncryption
+ 68:40:a9:a8:bb:e4:4f:5d:79:b3:05:b5:17:b3:60:13:eb:c6:
+ 92:5d:e0:d1:d3:6a:fe:fb:be:9b:6d:bf:c7:05:6d:59:20:c4:
+ 1c:f0:b7:da:84:58:02:63:fa:48:16:ef:4f:a5:0b:f7:4a:98:
+ f2:3f:9e:1b:ad:47:6b:63:ce:08:47:eb:52:3f:78:9c:af:4d:
+ ae:f8:d5:4f:cf:9a:98:2a:10:41:39:52:c4:dd:d9:9b:0e:ef:
+ 93:01:ae:b2:2e:ca:68:42:24:42:6c:b0:b3:3a:3e:cd:e9:da:
+ 48:c4:15:cb:e9:f9:07:0f:92:50:49:8a:dd:31:97:5f:c9:e9:
+ 37:aa:3b:59:65:97:94:32:c9:b3:9f:3e:3a:62:58:c5:49:ad:
+ 62:0e:71:a5:32:aa:2f:c6:89:76:43:40:13:13:67:3d:a2:54:
+ 25:10:cb:f1:3a:f2:d9:fa:db:49:56:bb:a6:fe:a7:41:35:c3:
+ e0:88:61:c9:88:c7:df:36:10:22:98:59:ea:b0:4a:fb:56:16:
+ 73:6e:ac:4d:f7:22:a1:4f:ad:1d:7a:2d:45:27:e5:30:c1:5e:
+ f2:da:13:cb:25:42:51:95:47:03:8c:6c:21:cc:74:42:ed:53:
+ ff:33:8b:8f:0f:57:01:16:2f:cf:a6:ee:c9:70:22:14:bd:fd:
+ be:6c:0b:03
+SHA1 Fingerprint=36:B1:2B:49:F9:81:9E:D7:4C:9E:BC:38:0F:C6:56:8F:5D:AC:B2:F7
+-----BEGIN CERTIFICATE-----
+MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEY
+MBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21t
+dW5pY2F0aW9uIFJvb3RDQTEwHhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5
+WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMPU0VDT00gVHJ1c3QubmV0MScwJQYD
+VQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEwggEiMA0GCSqGSIb3
+DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw8yl8
+9f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJ
+DKaVv0uMDPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9
+Ms+k2Y7CI9eNqPPYJayX5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/N
+QV3Is00qVUarH9oe4kA92819uZKAnDfdDJZkndwi92SL32HeFZRSFaB9UslLqCHJ
+xrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2JChzAgMBAAGjPzA9MB0G
+A1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYwDwYDVR0T
+AQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vG
+kl3g0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfr
+Uj94nK9NrvjVT8+amCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5
+Bw+SUEmK3TGXX8npN6o7WWWXlDLJs58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJU
+JRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ6rBK+1YWc26sTfcioU+tHXot
+RSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAiFL39vmwLAw==
+-----END CERTIFICATE-----
Certificate:
Data:
Version: 3 (0x2)
@@ -6665,98 +6581,6 @@ CvGwjVRDjAS6oz/v4jXH+XTgbzRB0L9zZVcg+ZtnemZoJE6AZb0QmQZZ8mWvuMZH
u/2QeItBcy6vVR/cO5JyboTT0GFMDcx2V+IthSIVNg3rAZ3r2OvEhJn7wAzMMujj
d9qDRIueVSjAi1jTkD5OGwDxFa2DK5o=
-----END CERTIFICATE-----
-Certificate:
- Data:
- Version: 3 (0x2)
- Serial Number:
- 50:94:6c:ec:18:ea:d5:9c:4d:d5:97:ef:75:8f:a0:ad
- Signature Algorithm: sha1WithRSAEncryption
- Issuer: C = US, OU = www.xrampsecurity.com, O = XRamp Security Services Inc, CN = XRamp Global Certification Authority
- Validity
- Not Before: Nov 1 17:14:04 2004 GMT
- Not After : Jan 1 05:37:19 2035 GMT
- Subject: C = US, OU = www.xrampsecurity.com, O = XRamp Security Services Inc, CN = XRamp Global Certification Authority
- Subject Public Key Info:
- Public Key Algorithm: rsaEncryption
- RSA Public-Key: (2048 bit)
- Modulus:
- 00:98:24:1e:bd:15:b4:ba:df:c7:8c:a5:27:b6:38:
- 0b:69:f3:b6:4e:a8:2c:2e:21:1d:5c:44:df:21:5d:
- 7e:23:74:fe:5e:7e:b4:4a:b7:a6:ad:1f:ae:e0:06:
- 16:e2:9b:5b:d9:67:74:6b:5d:80:8f:29:9d:86:1b:
- d9:9c:0d:98:6d:76:10:28:58:e4:65:b0:7f:4a:98:
- 79:9f:e0:c3:31:7e:80:2b:b5:8c:c0:40:3b:11:86:
- d0:cb:a2:86:36:60:a4:d5:30:82:6d:d9:6e:d0:0f:
- 12:04:33:97:5f:4f:61:5a:f0:e4:f9:91:ab:e7:1d:
- 3b:bc:e8:cf:f4:6b:2d:34:7c:e2:48:61:1c:8e:f3:
- 61:44:cc:6f:a0:4a:a9:94:b0:4d:da:e7:a9:34:7a:
- 72:38:a8:41:cc:3c:94:11:7d:eb:c8:a6:8c:b7:86:
- cb:ca:33:3b:d9:3d:37:8b:fb:7a:3e:86:2c:e7:73:
- d7:0a:57:ac:64:9b:19:eb:f4:0f:04:08:8a:ac:03:
- 17:19:64:f4:5a:25:22:8d:34:2c:b2:f6:68:1d:12:
- 6d:d3:8a:1e:14:da:c4:8f:a6:e2:23:85:d5:7a:0d:
- bd:6a:e0:e9:ec:ec:17:bb:42:1b:67:aa:25:ed:45:
- 83:21:fc:c1:c9:7c:d5:62:3e:fa:f2:c5:2d:d3:fd:
- d4:65
- Exponent: 65537 (0x10001)
- X509v3 extensions:
- 1.3.6.1.4.1.311.20.2:
- ...C.A
- X509v3 Key Usage:
- Digital Signature, Certificate Sign, CRL Sign
- X509v3 Basic Constraints: critical
- CA:TRUE
- X509v3 Subject Key Identifier:
- C6:4F:A2:3D:06:63:84:09:9C:CE:62:E4:04:AC:8D:5C:B5:E9:B6:1B
- X509v3 CRL Distribution Points:
-
- Full Name:
- URI:http://crl.xrampsecurity.com/XGCA.crl
-
- 1.3.6.1.4.1.311.21.1:
- ...
- Signature Algorithm: sha1WithRSAEncryption
- 91:15:39:03:01:1b:67:fb:4a:1c:f9:0a:60:5b:a1:da:4d:97:
- 62:f9:24:53:27:d7:82:64:4e:90:2e:c3:49:1b:2b:9a:dc:fc:
- a8:78:67:35:f1:1d:f0:11:bd:b7:48:e3:10:f6:0d:df:3f:d2:
- c9:b6:aa:55:a4:48:ba:02:db:de:59:2e:15:5b:3b:9d:16:7d:
- 47:d7:37:ea:5f:4d:76:12:36:bb:1f:d7:a1:81:04:46:20:a3:
- 2c:6d:a9:9e:01:7e:3f:29:ce:00:93:df:fd:c9:92:73:89:89:
- 64:9e:e7:2b:e4:1c:91:2c:d2:b9:ce:7d:ce:6f:31:99:d3:e6:
- be:d2:1e:90:f0:09:14:79:5c:23:ab:4d:d2:da:21:1f:4d:99:
- 79:9d:e1:cf:27:9f:10:9b:1c:88:0d:b0:8a:64:41:31:b8:0e:
- 6c:90:24:a4:9b:5c:71:8f:ba:bb:7e:1c:1b:db:6a:80:0f:21:
- bc:e9:db:a6:b7:40:f4:b2:8b:a9:b1:e4:ef:9a:1a:d0:3d:69:
- 99:ee:a8:28:a3:e1:3c:b3:f0:b2:11:9c:cf:7c:40:e6:dd:e7:
- 43:7d:a2:d8:3a:b5:a9:8d:f2:34:99:c4:d4:10:e1:06:fd:09:
- 84:10:3b:ee:c4:4c:f4:ec:27:7c:42:c2:74:7c:82:8a:09:c9:
- b4:03:25:bc
-SHA1 Fingerprint=B8:01:86:D1:EB:9C:86:A5:41:04:CF:30:54:F3:4C:52:B7:E5:58:C6
------BEGIN CERTIFICATE-----
-MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCB
-gjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEk
-MCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRY
-UmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQxMTAxMTcx
-NDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3
-dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2Vy
-dmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
-dXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS6
-38eMpSe2OAtp87ZOqCwuIR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCP
-KZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMxfoArtYzAQDsRhtDLooY2YKTVMIJt2W7Q
-DxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FEzG+gSqmUsE3a56k0enI4
-qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqsAxcZZPRa
-JSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNVi
-PvryxS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0P
-BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASs
-jVy16bYbMDYGA1UdHwQvMC0wK6ApoCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0
-eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQEwDQYJKoZIhvcNAQEFBQAD
-ggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc/Kh4ZzXxHfAR
-vbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
-qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLa
-IR9NmXmd4c8nnxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSy
-i6mx5O+aGtA9aZnuqCij4Tyz8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQ
-O+7ETPTsJ3xCwnR8gooJybQDJbw=
------END CERTIFICATE-----
Certificate:
Data:
Version: 3 (0x2)
@@ -6879,6 +6703,98 @@ aPib8qXPMThcFarmlwDB31qlpzmq6YR/PFGoOtmUW4y/Twhx5duoXNTSpv4Ao8YW
xw/ogM4cKGR0GQjTQuPOAF1/sdwTsOEFy9EgqoZ0njnnkf3/W9b3raYvAwtt41dU
63ZTGI0RmLo=
-----END CERTIFICATE-----
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number:
+ 50:94:6c:ec:18:ea:d5:9c:4d:d5:97:ef:75:8f:a0:ad
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C = US, OU = www.xrampsecurity.com, O = XRamp Security Services Inc, CN = XRamp Global Certification Authority
+ Validity
+ Not Before: Nov 1 17:14:04 2004 GMT
+ Not After : Jan 1 05:37:19 2035 GMT
+ Subject: C = US, OU = www.xrampsecurity.com, O = XRamp Security Services Inc, CN = XRamp Global Certification Authority
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public-Key: (2048 bit)
+ Modulus:
+ 00:98:24:1e:bd:15:b4:ba:df:c7:8c:a5:27:b6:38:
+ 0b:69:f3:b6:4e:a8:2c:2e:21:1d:5c:44:df:21:5d:
+ 7e:23:74:fe:5e:7e:b4:4a:b7:a6:ad:1f:ae:e0:06:
+ 16:e2:9b:5b:d9:67:74:6b:5d:80:8f:29:9d:86:1b:
+ d9:9c:0d:98:6d:76:10:28:58:e4:65:b0:7f:4a:98:
+ 79:9f:e0:c3:31:7e:80:2b:b5:8c:c0:40:3b:11:86:
+ d0:cb:a2:86:36:60:a4:d5:30:82:6d:d9:6e:d0:0f:
+ 12:04:33:97:5f:4f:61:5a:f0:e4:f9:91:ab:e7:1d:
+ 3b:bc:e8:cf:f4:6b:2d:34:7c:e2:48:61:1c:8e:f3:
+ 61:44:cc:6f:a0:4a:a9:94:b0:4d:da:e7:a9:34:7a:
+ 72:38:a8:41:cc:3c:94:11:7d:eb:c8:a6:8c:b7:86:
+ cb:ca:33:3b:d9:3d:37:8b:fb:7a:3e:86:2c:e7:73:
+ d7:0a:57:ac:64:9b:19:eb:f4:0f:04:08:8a:ac:03:
+ 17:19:64:f4:5a:25:22:8d:34:2c:b2:f6:68:1d:12:
+ 6d:d3:8a:1e:14:da:c4:8f:a6:e2:23:85:d5:7a:0d:
+ bd:6a:e0:e9:ec:ec:17:bb:42:1b:67:aa:25:ed:45:
+ 83:21:fc:c1:c9:7c:d5:62:3e:fa:f2:c5:2d:d3:fd:
+ d4:65
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ 1.3.6.1.4.1.311.20.2:
+ ...C.A
+ X509v3 Key Usage:
+ Digital Signature, Certificate Sign, CRL Sign
+ X509v3 Basic Constraints: critical
+ CA:TRUE
+ X509v3 Subject Key Identifier:
+ C6:4F:A2:3D:06:63:84:09:9C:CE:62:E4:04:AC:8D:5C:B5:E9:B6:1B
+ X509v3 CRL Distribution Points:
+
+ Full Name:
+ URI:http://crl.xrampsecurity.com/XGCA.crl
+
+ 1.3.6.1.4.1.311.21.1:
+ ...
+ Signature Algorithm: sha1WithRSAEncryption
+ 91:15:39:03:01:1b:67:fb:4a:1c:f9:0a:60:5b:a1:da:4d:97:
+ 62:f9:24:53:27:d7:82:64:4e:90:2e:c3:49:1b:2b:9a:dc:fc:
+ a8:78:67:35:f1:1d:f0:11:bd:b7:48:e3:10:f6:0d:df:3f:d2:
+ c9:b6:aa:55:a4:48:ba:02:db:de:59:2e:15:5b:3b:9d:16:7d:
+ 47:d7:37:ea:5f:4d:76:12:36:bb:1f:d7:a1:81:04:46:20:a3:
+ 2c:6d:a9:9e:01:7e:3f:29:ce:00:93:df:fd:c9:92:73:89:89:
+ 64:9e:e7:2b:e4:1c:91:2c:d2:b9:ce:7d:ce:6f:31:99:d3:e6:
+ be:d2:1e:90:f0:09:14:79:5c:23:ab:4d:d2:da:21:1f:4d:99:
+ 79:9d:e1:cf:27:9f:10:9b:1c:88:0d:b0:8a:64:41:31:b8:0e:
+ 6c:90:24:a4:9b:5c:71:8f:ba:bb:7e:1c:1b:db:6a:80:0f:21:
+ bc:e9:db:a6:b7:40:f4:b2:8b:a9:b1:e4:ef:9a:1a:d0:3d:69:
+ 99:ee:a8:28:a3:e1:3c:b3:f0:b2:11:9c:cf:7c:40:e6:dd:e7:
+ 43:7d:a2:d8:3a:b5:a9:8d:f2:34:99:c4:d4:10:e1:06:fd:09:
+ 84:10:3b:ee:c4:4c:f4:ec:27:7c:42:c2:74:7c:82:8a:09:c9:
+ b4:03:25:bc
+SHA1 Fingerprint=B8:01:86:D1:EB:9C:86:A5:41:04:CF:30:54:F3:4C:52:B7:E5:58:C6
+-----BEGIN CERTIFICATE-----
+MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCB
+gjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEk
+MCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRY
+UmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQxMTAxMTcx
+NDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMxHjAcBgNVBAsTFXd3
+dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkgU2Vy
+dmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
+dXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS6
+38eMpSe2OAtp87ZOqCwuIR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCP
+KZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMxfoArtYzAQDsRhtDLooY2YKTVMIJt2W7Q
+DxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FEzG+gSqmUsE3a56k0enI4
+qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqsAxcZZPRa
+JSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNVi
+PvryxS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0P
+BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASs
+jVy16bYbMDYGA1UdHwQvMC0wK6ApoCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0
+eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQEwDQYJKoZIhvcNAQEFBQAD
+ggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc/Kh4ZzXxHfAR
+vbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
+qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLa
+IR9NmXmd4c8nnxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSy
+i6mx5O+aGtA9aZnuqCij4Tyz8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQ
+O+7ETPTsJ3xCwnR8gooJybQDJbw=
+-----END CERTIFICATE-----
Certificate:
Data:
Version: 3 (0x2)
@@ -7575,90 +7491,6 @@ Z6tGn6D/Qqc6f1zLXbBwHSs09dR2CQzreExZBfMzQsNhFRAbd03OIozUhfJFfbdT
2tIMPNuzjsmhDYAPexZ3FL//2wmUspO8IFgV6dtxQ/PeEMMA3KgqlbbC1j+Qa3bb
bP6MvPJwNQzcmRk13NfIRmPVNnGuV/u3gm3c
-----END CERTIFICATE-----
-Certificate:
- Data:
- Version: 3 (0x2)
- Serial Number: 0 (0x0)
- Signature Algorithm: sha1WithRSAEncryption
- Issuer: C = US, O = "The Go Daddy Group, Inc.", OU = Go Daddy Class 2 Certification Authority
- Validity
- Not Before: Jun 29 17:06:20 2004 GMT
- Not After : Jun 29 17:06:20 2034 GMT
- Subject: C = US, O = "The Go Daddy Group, Inc.", OU = Go Daddy Class 2 Certification Authority
- Subject Public Key Info:
- Public Key Algorithm: rsaEncryption
- RSA Public-Key: (2048 bit)
- Modulus:
- 00:de:9d:d7:ea:57:18:49:a1:5b:eb:d7:5f:48:86:
- ea:be:dd:ff:e4:ef:67:1c:f4:65:68:b3:57:71:a0:
- 5e:77:bb:ed:9b:49:e9:70:80:3d:56:18:63:08:6f:
- da:f2:cc:d0:3f:7f:02:54:22:54:10:d8:b2:81:d4:
- c0:75:3d:4b:7f:c7:77:c3:3e:78:ab:1a:03:b5:20:
- 6b:2f:6a:2b:b1:c5:88:7e:c4:bb:1e:b0:c1:d8:45:
- 27:6f:aa:37:58:f7:87:26:d7:d8:2d:f6:a9:17:b7:
- 1f:72:36:4e:a6:17:3f:65:98:92:db:2a:6e:5d:a2:
- fe:88:e0:0b:de:7f:e5:8d:15:e1:eb:cb:3a:d5:e2:
- 12:a2:13:2d:d8:8e:af:5f:12:3d:a0:08:05:08:b6:
- 5c:a5:65:38:04:45:99:1e:a3:60:60:74:c5:41:a5:
- 72:62:1b:62:c5:1f:6f:5f:1a:42:be:02:51:65:a8:
- ae:23:18:6a:fc:78:03:a9:4d:7f:80:c3:fa:ab:5a:
- fc:a1:40:a4:ca:19:16:fe:b2:c8:ef:5e:73:0d:ee:
- 77:bd:9a:f6:79:98:bc:b1:07:67:a2:15:0d:dd:a0:
- 58:c6:44:7b:0a:3e:62:28:5f:ba:41:07:53:58:cf:
- 11:7e:38:74:c5:f8:ff:b5:69:90:8f:84:74:ea:97:
- 1b:af
- Exponent: 3 (0x3)
- X509v3 extensions:
- X509v3 Subject Key Identifier:
- D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3
- X509v3 Authority Key Identifier:
- keyid:D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3
- DirName:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
- serial:00
-
- X509v3 Basic Constraints:
- CA:TRUE
- Signature Algorithm: sha1WithRSAEncryption
- 32:4b:f3:b2:ca:3e:91:fc:12:c6:a1:07:8c:8e:77:a0:33:06:
- 14:5c:90:1e:18:f7:08:a6:3d:0a:19:f9:87:80:11:6e:69:e4:
- 96:17:30:ff:34:91:63:72:38:ee:cc:1c:01:a3:1d:94:28:a4:
- 31:f6:7a:c4:54:d7:f6:e5:31:58:03:a2:cc:ce:62:db:94:45:
- 73:b5:bf:45:c9:24:b5:d5:82:02:ad:23:79:69:8d:b8:b6:4d:
- ce:cf:4c:ca:33:23:e8:1c:88:aa:9d:8b:41:6e:16:c9:20:e5:
- 89:9e:cd:3b:da:70:f7:7e:99:26:20:14:54:25:ab:6e:73:85:
- e6:9b:21:9d:0a:6c:82:0e:a8:f8:c2:0c:fa:10:1e:6c:96:ef:
- 87:0d:c4:0f:61:8b:ad:ee:83:2b:95:f8:8e:92:84:72:39:eb:
- 20:ea:83:ed:83:cd:97:6e:08:bc:eb:4e:26:b6:73:2b:e4:d3:
- f6:4c:fe:26:71:e2:61:11:74:4a:ff:57:1a:87:0f:75:48:2e:
- cf:51:69:17:a0:02:12:61:95:d5:d1:40:b2:10:4c:ee:c4:ac:
- 10:43:a6:a5:9e:0a:d5:95:62:9a:0d:cf:88:82:c5:32:0c:e4:
- 2b:9f:45:e6:0d:9f:28:9c:b1:b9:2a:5a:57:ad:37:0f:af:1d:
- 7f:db:bd:9f
-SHA1 Fingerprint=27:96:BA:E6:3F:18:01:E2:77:26:1B:A0:D7:77:70:02:8F:20:EE:E4
------BEGIN CERTIFICATE-----
-MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEh
-MB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBE
-YWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3
-MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRo
-ZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3Mg
-MiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggEN
-ADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCA
-PVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6w
-wdhFJ2+qN1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXi
-EqITLdiOr18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWoriMY
-avx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZEewo+
-YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0OBBYEFNLE
-sNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h
-/t2oatTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5
-IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmlj
-YXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD
-ggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYXMP80kWNy
-OO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKtI3lpjbi2Tc7P
-TMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
-HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mER
-dEr/VxqHD3VILs9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5Cuf
-ReYNnyicsbkqWletNw+vHX/bvZ8=
------END CERTIFICATE-----
Certificate:
Data:
Version: 3 (0x2)
@@ -7779,6 +7611,90 @@ JPFI/2R80L5cFtHvma3AH/vLrrw4IgYmZNralw4/KBVEqE8AyvCazM90arQ+POuV
7LXTWtiBmelDGDfrs7vRWGJB82bSj6p4lVQgw1oudCvV0b4YacCs1aTPObpRhANl
6WLAYv7YTVWW4tAR+kg0Eeye7QUd5MjWHYbL
-----END CERTIFICATE-----
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 0 (0x0)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C = US, O = "The Go Daddy Group, Inc.", OU = Go Daddy Class 2 Certification Authority
+ Validity
+ Not Before: Jun 29 17:06:20 2004 GMT
+ Not After : Jun 29 17:06:20 2034 GMT
+ Subject: C = US, O = "The Go Daddy Group, Inc.", OU = Go Daddy Class 2 Certification Authority
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public-Key: (2048 bit)
+ Modulus:
+ 00:de:9d:d7:ea:57:18:49:a1:5b:eb:d7:5f:48:86:
+ ea:be:dd:ff:e4:ef:67:1c:f4:65:68:b3:57:71:a0:
+ 5e:77:bb:ed:9b:49:e9:70:80:3d:56:18:63:08:6f:
+ da:f2:cc:d0:3f:7f:02:54:22:54:10:d8:b2:81:d4:
+ c0:75:3d:4b:7f:c7:77:c3:3e:78:ab:1a:03:b5:20:
+ 6b:2f:6a:2b:b1:c5:88:7e:c4:bb:1e:b0:c1:d8:45:
+ 27:6f:aa:37:58:f7:87:26:d7:d8:2d:f6:a9:17:b7:
+ 1f:72:36:4e:a6:17:3f:65:98:92:db:2a:6e:5d:a2:
+ fe:88:e0:0b:de:7f:e5:8d:15:e1:eb:cb:3a:d5:e2:
+ 12:a2:13:2d:d8:8e:af:5f:12:3d:a0:08:05:08:b6:
+ 5c:a5:65:38:04:45:99:1e:a3:60:60:74:c5:41:a5:
+ 72:62:1b:62:c5:1f:6f:5f:1a:42:be:02:51:65:a8:
+ ae:23:18:6a:fc:78:03:a9:4d:7f:80:c3:fa:ab:5a:
+ fc:a1:40:a4:ca:19:16:fe:b2:c8:ef:5e:73:0d:ee:
+ 77:bd:9a:f6:79:98:bc:b1:07:67:a2:15:0d:dd:a0:
+ 58:c6:44:7b:0a:3e:62:28:5f:ba:41:07:53:58:cf:
+ 11:7e:38:74:c5:f8:ff:b5:69:90:8f:84:74:ea:97:
+ 1b:af
+ Exponent: 3 (0x3)
+ X509v3 extensions:
+ X509v3 Subject Key Identifier:
+ D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3
+ X509v3 Authority Key Identifier:
+ keyid:D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3
+ DirName:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
+ serial:00
+
+ X509v3 Basic Constraints:
+ CA:TRUE
+ Signature Algorithm: sha1WithRSAEncryption
+ 32:4b:f3:b2:ca:3e:91:fc:12:c6:a1:07:8c:8e:77:a0:33:06:
+ 14:5c:90:1e:18:f7:08:a6:3d:0a:19:f9:87:80:11:6e:69:e4:
+ 96:17:30:ff:34:91:63:72:38:ee:cc:1c:01:a3:1d:94:28:a4:
+ 31:f6:7a:c4:54:d7:f6:e5:31:58:03:a2:cc:ce:62:db:94:45:
+ 73:b5:bf:45:c9:24:b5:d5:82:02:ad:23:79:69:8d:b8:b6:4d:
+ ce:cf:4c:ca:33:23:e8:1c:88:aa:9d:8b:41:6e:16:c9:20:e5:
+ 89:9e:cd:3b:da:70:f7:7e:99:26:20:14:54:25:ab:6e:73:85:
+ e6:9b:21:9d:0a:6c:82:0e:a8:f8:c2:0c:fa:10:1e:6c:96:ef:
+ 87:0d:c4:0f:61:8b:ad:ee:83:2b:95:f8:8e:92:84:72:39:eb:
+ 20:ea:83:ed:83:cd:97:6e:08:bc:eb:4e:26:b6:73:2b:e4:d3:
+ f6:4c:fe:26:71:e2:61:11:74:4a:ff:57:1a:87:0f:75:48:2e:
+ cf:51:69:17:a0:02:12:61:95:d5:d1:40:b2:10:4c:ee:c4:ac:
+ 10:43:a6:a5:9e:0a:d5:95:62:9a:0d:cf:88:82:c5:32:0c:e4:
+ 2b:9f:45:e6:0d:9f:28:9c:b1:b9:2a:5a:57:ad:37:0f:af:1d:
+ 7f:db:bd:9f
+SHA1 Fingerprint=27:96:BA:E6:3F:18:01:E2:77:26:1B:A0:D7:77:70:02:8F:20:EE:E4
+-----BEGIN CERTIFICATE-----
+MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEh
+MB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBE
+YWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3
+MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRo
+ZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3Mg
+MiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggEN
+ADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCA
+PVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6w
+wdhFJ2+qN1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXi
+EqITLdiOr18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWoriMY
+avx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZEewo+
+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0OBBYEFNLE
+sNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h
+/t2oatTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5
+IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmlj
+YXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD
+ggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYXMP80kWNy
+OO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKtI3lpjbi2Tc7P
+TMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
+HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mER
+dEr/VxqHD3VILs9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5Cuf
+ReYNnyicsbkqWletNw+vHX/bvZ8=
+-----END CERTIFICATE-----
Certificate:
Data:
Version: 3 (0x2)
@@ -8100,42 +8016,335 @@ Certificate:
X509v3 Basic Constraints: critical
CA:TRUE
X509v3 Subject Key Identifier:
- 7F:10:01:16:37:3A:A4:28:E4:50:F8:A4:F7:EC:6B:32:B6:FE:E9:8B
- X509v3 Key Usage: critical
- Certificate Sign, CRL Sign
- X509v3 CRL Distribution Points:
-
- Full Name:
- URI:http://crl.d-trust.net/crl/d-trust_ev_root_ca_1_2020.crl
-
- Full Name:
- URI:ldap://directory.d-trust.net/CN=D-TRUST%20EV%20Root%20CA%201%202020,O=D-Trust%20GmbH,C=DE?certificaterevocationlist
-
- Signature Algorithm: ecdsa-with-SHA384
- 30:66:02:31:00:ca:3c:c6:2a:75:c2:5e:75:62:39:36:00:60:
- 5a:8b:c1:93:99:cc:d9:db:41:3b:3b:87:99:17:3b:d5:cc:4f:
- ca:22:f7:a0:80:cb:f9:b4:b1:1b:56:f5:72:d2:fc:19:d1:02:
- 31:00:91:f7:30:93:3f:10:46:2b:71:a4:d0:3b:44:9b:c0:29:
- 02:05:b2:41:77:51:f3:79:5a:9e:8e:14:a0:4e:42:d2:5b:81:
- f3:34:6a:03:e7:22:38:50:5b:ed:19:4f:43:16
-SHA1 Fingerprint=61:DB:8C:21:59:69:03:90:D8:7C:9C:12:86:54:CF:9D:3D:F4:DD:07
------BEGIN CERTIFICATE-----
-MIIC2zCCAmCgAwIBAgIQXwJB13qHfEwDo6yWjfv/0DAKBggqhkjOPQQDAzBIMQsw
-CQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRS
-VVNUIEVWIFJvb3QgQ0EgMSAyMDIwMB4XDTIwMDIxMTEwMDAwMFoXDTM1MDIxMTA5
-NTk1OVowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEiMCAG
-A1UEAxMZRC1UUlVTVCBFViBSb290IENBIDEgMjAyMDB2MBAGByqGSM49AgEGBSuB
-BAAiA2IABPEL3YZDIBnfl4XoIkqbz52Yv7QFJsnL46bSj8WeeHsxiamJrSc8ZRCC
-/N/DnU7wMyPE0jL1HLDfMxddxfCxivnvubcUyilKwg+pf3VlSSowZ/Rk99Yad9rD
-wpdhQntJraOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFH8QARY3
-OqQo5FD4pPfsazK2/umLMA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6g
-PKA6hjhodHRwOi8vY3JsLmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X2V2X3Jvb3Rf
-Y2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVjdG9yeS5kLXRydXN0Lm5l
-dC9DTj1ELVRSVVNUJTIwRVYlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxPPUQtVHJ1
-c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjO
-PQQDAwNpADBmAjEAyjzGKnXCXnViOTYAYFqLwZOZzNnbQTs7h5kXO9XMT8oi96CA
-y/m0sRtW9XLS/BnRAjEAkfcwkz8QRitxpNA7RJvAKQIFskF3UfN5Wp6OFKBOQtJb
-gfM0agPnIjhQW+0ZT0MW
+ 7F:10:01:16:37:3A:A4:28:E4:50:F8:A4:F7:EC:6B:32:B6:FE:E9:8B
+ X509v3 Key Usage: critical
+ Certificate Sign, CRL Sign
+ X509v3 CRL Distribution Points:
+
+ Full Name:
+ URI:http://crl.d-trust.net/crl/d-trust_ev_root_ca_1_2020.crl
+
+ Full Name:
+ URI:ldap://directory.d-trust.net/CN=D-TRUST%20EV%20Root%20CA%201%202020,O=D-Trust%20GmbH,C=DE?certificaterevocationlist
+
+ Signature Algorithm: ecdsa-with-SHA384
+ 30:66:02:31:00:ca:3c:c6:2a:75:c2:5e:75:62:39:36:00:60:
+ 5a:8b:c1:93:99:cc:d9:db:41:3b:3b:87:99:17:3b:d5:cc:4f:
+ ca:22:f7:a0:80:cb:f9:b4:b1:1b:56:f5:72:d2:fc:19:d1:02:
+ 31:00:91:f7:30:93:3f:10:46:2b:71:a4:d0:3b:44:9b:c0:29:
+ 02:05:b2:41:77:51:f3:79:5a:9e:8e:14:a0:4e:42:d2:5b:81:
+ f3:34:6a:03:e7:22:38:50:5b:ed:19:4f:43:16
+SHA1 Fingerprint=61:DB:8C:21:59:69:03:90:D8:7C:9C:12:86:54:CF:9D:3D:F4:DD:07
+-----BEGIN CERTIFICATE-----
+MIIC2zCCAmCgAwIBAgIQXwJB13qHfEwDo6yWjfv/0DAKBggqhkjOPQQDAzBIMQsw
+CQYDVQQGEwJERTEVMBMGA1UEChMMRC1UcnVzdCBHbWJIMSIwIAYDVQQDExlELVRS
+VVNUIEVWIFJvb3QgQ0EgMSAyMDIwMB4XDTIwMDIxMTEwMDAwMFoXDTM1MDIxMTA5
+NTk1OVowSDELMAkGA1UEBhMCREUxFTATBgNVBAoTDEQtVHJ1c3QgR21iSDEiMCAG
+A1UEAxMZRC1UUlVTVCBFViBSb290IENBIDEgMjAyMDB2MBAGByqGSM49AgEGBSuB
+BAAiA2IABPEL3YZDIBnfl4XoIkqbz52Yv7QFJsnL46bSj8WeeHsxiamJrSc8ZRCC
+/N/DnU7wMyPE0jL1HLDfMxddxfCxivnvubcUyilKwg+pf3VlSSowZ/Rk99Yad9rD
+wpdhQntJraOCAQ0wggEJMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFH8QARY3
+OqQo5FD4pPfsazK2/umLMA4GA1UdDwEB/wQEAwIBBjCBxgYDVR0fBIG+MIG7MD6g
+PKA6hjhodHRwOi8vY3JsLmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X2V2X3Jvb3Rf
+Y2FfMV8yMDIwLmNybDB5oHegdYZzbGRhcDovL2RpcmVjdG9yeS5kLXRydXN0Lm5l
+dC9DTj1ELVRSVVNUJTIwRVYlMjBSb290JTIwQ0ElMjAxJTIwMjAyMCxPPUQtVHJ1
+c3QlMjBHbWJILEM9REU/Y2VydGlmaWNhdGVyZXZvY2F0aW9ubGlzdDAKBggqhkjO
+PQQDAwNpADBmAjEAyjzGKnXCXnViOTYAYFqLwZOZzNnbQTs7h5kXO9XMT8oi96CA
+y/m0sRtW9XLS/BnRAjEAkfcwkz8QRitxpNA7RJvAKQIFskF3UfN5Wp6OFKBOQtJb
+gfM0agPnIjhQW+0ZT0MW
+-----END CERTIFICATE-----
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number:
+ 09:e0:93:65:ac:f7:d9:c8:b9:3e:1c:0b:04:2a:2e:f3
+ Signature Algorithm: ecdsa-with-SHA384
+ Issuer: C = US, O = "DigiCert, Inc.", CN = DigiCert TLS ECC P384 Root G5
+ Validity
+ Not Before: Jan 15 00:00:00 2021 GMT
+ Not After : Jan 14 23:59:59 2046 GMT
+ Subject: C = US, O = "DigiCert, Inc.", CN = DigiCert TLS ECC P384 Root G5
+ Subject Public Key Info:
+ Public Key Algorithm: id-ecPublicKey
+ Public-Key: (384 bit)
+ pub:
+ 04:c1:44:a1:cf:11:97:50:9a:de:23:82:35:07:cd:
+ d0:cb:18:9d:d2:f1:7f:77:35:4f:3b:dd:94:72:52:
+ ed:c2:3b:f8:ec:fa:7b:6b:58:20:ec:99:ae:c9:fc:
+ 68:b3:75:b9:db:09:ec:c8:13:f5:4e:c6:0a:1d:66:
+ 30:4c:bb:1f:47:0a:3c:61:10:42:29:7c:a5:08:0e:
+ e0:22:e9:d3:35:68:ce:9b:63:9f:84:b5:99:4d:58:
+ a0:8e:f5:54:e7:95:c9
+ ASN1 OID: secp384r1
+ NIST CURVE: P-384
+ X509v3 extensions:
+ X509v3 Subject Key Identifier:
+ C1:51:45:50:59:AB:3E:E7:2C:5A:FA:20:22:12:07:80:88:7C:11:6A
+ X509v3 Key Usage: critical
+ Digital Signature, Certificate Sign, CRL Sign
+ X509v3 Basic Constraints: critical
+ CA:TRUE
+ Signature Algorithm: ecdsa-with-SHA384
+ 30:65:02:31:00:89:6a:8d:47:e7:ec:fc:6e:55:03:d9:67:6c:
+ 26:4e:83:c6:fd:c9:fb:2b:13:bc:b7:7a:8c:b4:65:d2:69:69:
+ 63:13:63:3b:26:50:2e:01:a1:79:06:91:9d:48:bf:c2:be:02:
+ 30:47:c3:15:7b:b1:a0:91:99:49:93:a8:3c:7c:e8:46:06:8b:
+ 2c:f2:31:00:94:9d:62:c8:89:bd:19:84:14:e9:a5:fb:01:b8:
+ 0d:76:43:8c:2e:53:cb:7c:df:0c:17:96:50
+SHA1 Fingerprint=17:F3:DE:5E:9F:0F:19:E9:8E:F6:1F:32:26:6E:20:C4:07:AE:30:EE
+-----BEGIN CERTIFICATE-----
+MIICGTCCAZ+gAwIBAgIQCeCTZaz32ci5PhwLBCou8zAKBggqhkjOPQQDAzBOMQsw
+CQYDVQQGEwJVUzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJjAkBgNVBAMTHURp
+Z2lDZXJ0IFRMUyBFQ0MgUDM4NCBSb290IEc1MB4XDTIxMDExNTAwMDAwMFoXDTQ2
+MDExNDIzNTk1OVowTjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDkRpZ2lDZXJ0LCBJ
+bmMuMSYwJAYDVQQDEx1EaWdpQ2VydCBUTFMgRUNDIFAzODQgUm9vdCBHNTB2MBAG
+ByqGSM49AgEGBSuBBAAiA2IABMFEoc8Rl1Ca3iOCNQfN0MsYndLxf3c1TzvdlHJS
+7cI7+Oz6e2tYIOyZrsn8aLN1udsJ7MgT9U7GCh1mMEy7H0cKPGEQQil8pQgO4CLp
+0zVozptjn4S1mU1YoI71VOeVyaNCMEAwHQYDVR0OBBYEFMFRRVBZqz7nLFr6ICIS
+B4CIfBFqMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49
+BAMDA2gAMGUCMQCJao1H5+z8blUD2WdsJk6Dxv3J+ysTvLd6jLRl0mlpYxNjOyZQ
+LgGheQaRnUi/wr4CMEfDFXuxoJGZSZOoPHzoRgaLLPIxAJSdYsiJvRmEFOml+wG4
+DXZDjC5Ty3zfDBeWUA==
+-----END CERTIFICATE-----
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number:
+ 08:f9:b4:78:a8:fa:7e:da:6a:33:37:89:de:7c:cf:8a
+ Signature Algorithm: sha384WithRSAEncryption
+ Issuer: C = US, O = "DigiCert, Inc.", CN = DigiCert TLS RSA4096 Root G5
+ Validity
+ Not Before: Jan 15 00:00:00 2021 GMT
+ Not After : Jan 14 23:59:59 2046 GMT
+ Subject: C = US, O = "DigiCert, Inc.", CN = DigiCert TLS RSA4096 Root G5
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public-Key: (4096 bit)
+ Modulus:
+ 00:b3:d0:f4:c9:79:11:9d:fd:fc:66:81:e7:cc:d5:
+ e4:bc:ec:81:3e:6a:35:8e:2e:b7:e7:de:af:f9:07:
+ 4d:cf:30:9d:ea:09:0b:99:bd:6c:57:da:18:4a:b8:
+ 78:ac:3a:39:a8:a6:48:ac:2e:72:e5:bd:eb:f1:1a:
+ cd:e7:a4:03:a9:3f:11:b4:d8:2f:89:16:fb:94:01:
+ 3d:bb:2f:f8:13:05:a1:78:1c:8e:28:e0:45:e0:83:
+ f4:59:1b:95:b3:ae:7e:03:45:e5:be:c2:42:fe:ee:
+ f2:3c:b6:85:13:98:32:9d:16:a8:29:c2:0b:1c:38:
+ dc:9f:31:77:5c:bf:27:a3:fc:27:ac:b7:2b:bd:74:
+ 9b:17:2d:f2:81:da:5d:b0:e1:23:17:3e:88:4a:12:
+ 23:d0:ea:cf:9d:de:03:17:b1:42:4a:a0:16:4c:a4:
+ 6d:93:e9:3f:3a:ee:3a:7c:9d:58:9d:f4:4e:8f:fc:
+ 3b:23:c8:6d:b8:e2:05:da:cc:eb:ec:c3:31:f4:d7:
+ a7:29:54:80:cf:44:5b:4c:6f:30:9e:f3:cc:dd:1f:
+ 94:43:9d:4d:7f:70:70:0d:d4:3a:d1:37:f0:6c:9d:
+ 9b:c0:14:93:58:ef:cd:41:38:75:bc:13:03:95:7c:
+ 7f:e3:5c:e9:d5:0d:d5:e2:7c:10:62:aa:6b:f0:3d:
+ 76:f3:3f:a3:e8:b0:c1:fd:ef:aa:57:4d:ac:86:a7:
+ 18:b4:29:c1:2c:0e:bf:64:be:29:8c:d8:02:2d:cd:
+ 5c:2f:f2:7f:ef:15:f4:0c:15:ac:0a:b0:f1:d3:0d:
+ 4f:6a:4d:77:97:01:a0:f1:66:b7:b7:ce:ef:ce:ec:
+ ec:a5:75:ca:ac:e3:e1:63:f7:b8:a1:04:c8:bc:7b:
+ 3f:5d:2d:16:22:56:ed:48:49:fe:a7:2f:79:30:25:
+ 9b:ba:6b:2d:3f:9d:3b:c4:17:e7:1d:2e:fb:f2:cf:
+ a6:fc:e3:14:2c:96:98:21:8c:b4:91:e9:19:60:83:
+ f2:30:2b:06:73:50:d5:98:3b:06:e9:c7:8a:0c:60:
+ 8c:28:f8:52:9b:6e:e1:f6:4d:bb:06:24:9b:d7:2b:
+ 26:3f:fd:2a:2f:71:f5:d6:24:be:7f:31:9e:0f:6d:
+ e8:8f:4f:4d:a3:3f:ff:35:ea:df:49:5e:41:8f:86:
+ f9:f1:77:79:4b:1b:b4:a3:5e:2f:fb:46:02:d0:66:
+ 13:5e:5e:85:4f:ce:d8:70:88:7b:ce:01:b5:96:97:
+ d7:cd:7d:fd:82:f8:c2:24:c1:ca:01:39:4f:8d:a2:
+ c1:14:40:1f:9c:66:d5:0c:09:46:d6:f2:d0:d1:48:
+ 76:56:3a:43:cb:b6:0a:11:39:ba:8c:13:6c:06:b5:
+ 9e:cf:eb
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Subject Key Identifier:
+ 51:33:1C:ED:36:40:AF:17:D3:25:CD:69:68:F2:AF:4E:23:3E:B3:41
+ X509v3 Key Usage: critical
+ Digital Signature, Certificate Sign, CRL Sign
+ X509v3 Basic Constraints: critical
+ CA:TRUE
+ Signature Algorithm: sha384WithRSAEncryption
+ 60:a6:af:5b:5f:57:da:89:db:4b:50:a9:c4:23:35:21:ff:d0:
+ 61:30:84:91:b7:3f:10:cf:25:8e:c9:bf:46:34:d9:c1:21:26:
+ 1c:70:19:72:1e:a3:c9:87:fe:a9:43:64:96:3a:c8:53:04:0a:
+ b6:41:bb:c4:47:00:d9:9f:18:18:3b:b2:0e:f3:34:ea:24:f7:
+ dd:af:20:60:ae:92:28:5f:36:e7:5d:e4:de:c7:3c:db:50:39:
+ ad:bb:3d:28:4d:96:7c:76:c6:5b:f4:c1:db:14:a5:ab:19:62:
+ 07:18:40:5f:97:91:dc:9c:c7:ab:b5:51:0d:e6:69:53:55:cc:
+ 39:7d:da:c5:11:55:72:c5:3b:8b:89:f8:34:2d:a4:17:e5:17:
+ e6:99:7d:30:88:21:37:cd:30:17:3d:b8:f2:bc:a8:75:a0:43:
+ dc:3e:89:4b:90:ae:6d:03:e0:1c:a3:a0:96:09:bb:7d:a3:b7:
+ 2a:10:44:4b:46:07:34:63:ed:31:b9:04:ee:a3:9b:9a:ae:e6:
+ 31:78:f4:ea:24:61:3b:ab:58:64:ff:bb:87:27:62:25:81:df:
+ dc:a1:2f:f6:ed:a7:ff:7a:8f:51:2e:30:f8:a4:01:d2:85:39:
+ 5f:01:99:96:6f:5a:5b:70:19:46:fe:86:60:3e:ad:80:10:09:
+ dd:39:25:2f:58:7f:bb:d2:74:f0:f7:46:1f:46:39:4a:d8:53:
+ d0:f3:2e:3b:71:a5:d4:6f:fc:f3:67:e4:07:8f:dd:26:19:e1:
+ 8d:5b:fa:a3:93:11:9b:e9:c8:3a:c3:55:68:9a:92:e1:52:76:
+ 38:e8:e1:ba:bd:fb:4f:d5:ef:b3:e7:48:83:31:f0:82:21:e3:
+ b6:be:a7:ab:6f:ef:9f:df:4c:cf:01:b8:62:6a:23:3d:e7:09:
+ 4d:80:1b:7b:30:a4:c3:dd:07:7f:34:be:a4:26:b2:f6:41:e8:
+ 09:1d:e3:20:98:aa:37:4f:ff:f7:f1:e2:29:70:31:47:3f:74:
+ d0:14:16:fa:21:8a:02:d5:8a:09:94:77:2e:f2:59:28:8b:7c:
+ 50:92:0a:66:78:38:83:75:c4:b5:5a:a8:11:c6:e5:c1:9d:66:
+ 55:cf:53:c4:af:d7:75:85:a9:42:13:56:ec:21:77:81:93:5a:
+ 0c:ea:96:d9:49:ca:a1:08:f2:97:3b:6d:9b:04:18:24:44:8e:
+ 7c:01:f2:dc:25:d8:5e:86:9a:b1:39:db:f5:91:32:6a:d1:a6:
+ 70:8a:a2:f7:de:a4:45:85:26:a8:1e:8c:5d:29:5b:c8:4b:d8:
+ 9a:6a:03:5e:70:f2:85:4f:6c:4b:68:2f:ca:54:f6:8c:da:32:
+ fe:c3:6b:83:3f:38:c6:7e
+SHA1 Fingerprint=A7:88:49:DC:5D:7C:75:8C:8C:DE:39:98:56:B3:AA:D0:B2:A5:71:35
+-----BEGIN CERTIFICATE-----
+MIIFZjCCA06gAwIBAgIQCPm0eKj6ftpqMzeJ3nzPijANBgkqhkiG9w0BAQwFADBN
+MQswCQYDVQQGEwJVUzEXMBUGA1UEChMORGlnaUNlcnQsIEluYy4xJTAjBgNVBAMT
+HERpZ2lDZXJ0IFRMUyBSU0E0MDk2IFJvb3QgRzUwHhcNMjEwMTE1MDAwMDAwWhcN
+NDYwMTE0MjM1OTU5WjBNMQswCQYDVQQGEwJVUzEXMBUGA1UEChMORGlnaUNlcnQs
+IEluYy4xJTAjBgNVBAMTHERpZ2lDZXJ0IFRMUyBSU0E0MDk2IFJvb3QgRzUwggIi
+MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz0PTJeRGd/fxmgefM1eS87IE+
+ajWOLrfn3q/5B03PMJ3qCQuZvWxX2hhKuHisOjmopkisLnLlvevxGs3npAOpPxG0
+2C+JFvuUAT27L/gTBaF4HI4o4EXgg/RZG5Wzrn4DReW+wkL+7vI8toUTmDKdFqgp
+wgscONyfMXdcvyej/Cestyu9dJsXLfKB2l2w4SMXPohKEiPQ6s+d3gMXsUJKoBZM
+pG2T6T867jp8nVid9E6P/DsjyG244gXazOvswzH016cpVIDPRFtMbzCe88zdH5RD
+nU1/cHAN1DrRN/BsnZvAFJNY781BOHW8EwOVfH/jXOnVDdXifBBiqmvwPXbzP6Po
+sMH976pXTayGpxi0KcEsDr9kvimM2AItzVwv8n/vFfQMFawKsPHTDU9qTXeXAaDx
+Zre3zu/O7Oyldcqs4+Fj97ihBMi8ez9dLRYiVu1ISf6nL3kwJZu6ay0/nTvEF+cd
+Lvvyz6b84xQslpghjLSR6Rlgg/IwKwZzUNWYOwbpx4oMYIwo+FKbbuH2TbsGJJvX
+KyY//SovcfXWJL5/MZ4PbeiPT02jP/816t9JXkGPhvnxd3lLG7SjXi/7RgLQZhNe
+XoVPzthwiHvOAbWWl9fNff2C+MIkwcoBOU+NosEUQB+cZtUMCUbW8tDRSHZWOkPL
+tgoRObqME2wGtZ7P6wIDAQABo0IwQDAdBgNVHQ4EFgQUUTMc7TZArxfTJc1paPKv
+TiM+s0EwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcN
+AQEMBQADggIBAGCmr1tfV9qJ20tQqcQjNSH/0GEwhJG3PxDPJY7Jv0Y02cEhJhxw
+GXIeo8mH/qlDZJY6yFMECrZBu8RHANmfGBg7sg7zNOok992vIGCukihfNudd5N7H
+PNtQOa27PShNlnx2xlv0wdsUpasZYgcYQF+Xkdycx6u1UQ3maVNVzDl92sURVXLF
+O4uJ+DQtpBflF+aZfTCIITfNMBc9uPK8qHWgQ9w+iUuQrm0D4ByjoJYJu32jtyoQ
+REtGBzRj7TG5BO6jm5qu5jF49OokYTurWGT/u4cnYiWB39yhL/btp/96j1EuMPik
+AdKFOV8BmZZvWltwGUb+hmA+rYAQCd05JS9Yf7vSdPD3Rh9GOUrYU9DzLjtxpdRv
+/PNn5AeP3SYZ4Y1b+qOTEZvpyDrDVWiakuFSdjjo4bq9+0/V77PnSIMx8IIh47a+
+p6tv75/fTM8BuGJqIz3nCU2AG3swpMPdB380vqQmsvZB6Akd4yCYqjdP//fx4ilw
+MUc/dNAUFvohigLVigmUdy7yWSiLfFCSCmZ4OIN1xLVaqBHG5cGdZlXPU8Sv13WF
+qUITVuwhd4GTWgzqltlJyqEI8pc7bZsEGCREjnwB8twl2F6GmrE52/WRMmrRpnCK
+ovfepEWFJqgejF0pW8hL2JpqA15w8oVPbEtoL8pU9ozaMv7Da4M/OMZ+
+-----END CERTIFICATE-----
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number:
+ 8e:0f:f9:4b:90:71:68:65:33:54:f4:d4:44:39:b7:e0
+ Signature Algorithm: sha256WithRSAEncryption
+ Issuer: C = US, O = Certainly, CN = Certainly Root R1
+ Validity
+ Not Before: Apr 1 00:00:00 2021 GMT
+ Not After : Apr 1 00:00:00 2046 GMT
+ Subject: C = US, O = Certainly, CN = Certainly Root R1
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public-Key: (4096 bit)
+ Modulus:
+ 00:d0:36:d4:1f:ea:dd:ab:e4:d1:b6:e6:fb:22:c0:
+ dd:13:0d:6a:7b:22:13:1c:97:3c:68:63:66:32:9c:
+ 03:b5:8d:a4:81:83:da:78:30:11:cf:dc:b2:2b:be:
+ 92:bf:8e:e4:c4:13:be:a4:68:4c:da:02:68:16:74:
+ be:b2:dd:04:e4:6b:2a:dd:37:1f:60:2c:db:f5:f7:
+ a1:7c:95:b7:0c:70:86:2e:f1:3a:ef:52:f7:cc:d3:
+ 9b:f9:8b:be:0e:df:31:b7:9d:68:5c:92:a6:f5:e5:
+ f3:0a:34:b5:ff:7b:a2:e4:87:a1:c6:af:17:00:ef:
+ 03:91:ed:a9:1c:4e:71:3d:d2:8b:6c:89:f4:78:86:
+ e6:6a:49:a0:ce:b5:d2:b0:ab:9b:f6:f4:d4:2e:e3:
+ 72:f9:36:c6:eb:15:b7:25:8c:3a:fc:25:0d:b3:22:
+ 73:21:74:c8:4a:96:61:92:f5:2f:0b:18:a5:f4:ad:
+ e2:ee:41:bd:01:79:fa:96:8c:8d:17:02:30:b4:f9:
+ af:78:1a:8c:b4:36:10:10:07:05:70:d0:f4:31:90:
+ 8a:51:c5:86:26:79:b2:11:88:5e:c5:f0:0a:54:cd:
+ 49:a6:bf:02:9c:d2:44:a7:ed:e3:78:ef:46:5e:6d:
+ 71:d1:79:70:1c:46:5f:51:e9:c9:37:dc:5f:7e:69:
+ 7b:41:df:34:45:e0:3b:84:f4:a1:8a:0a:36:9e:37:
+ cc:62:52:e1:89:0d:28:f9:7a:23:b1:0d:3d:3d:9a:
+ fd:9d:81:ef:2c:90:c0:7b:44:4e:bb:49:e0:0e:4a:
+ 56:92:bc:cb:b5:dd:79:17:89:91:de:61:89:74:92:
+ a8:e3:32:85:be:4e:85:a4:4b:59:cb:2b:c5:78:8e:
+ 71:54:d0:02:37:99:8c:e5:49:ea:e0:54:72:a4:11:
+ 06:2f:0b:8c:c1:5b:be:b5:a1:b0:53:6e:9c:b8:60:
+ 91:1f:59:6b:f9:2d:f4:94:0a:97:b5:ec:c5:76:03:
+ 54:1b:65:52:ba:4c:92:56:51:35:a0:40:d8:29:db:
+ ae:52:76:3b:2d:30:40:9b:8a:d0:42:56:b4:b7:88:
+ 01:a4:87:3b:53:96:cd:a3:16:8f:f3:66:aa:17:b1:
+ c7:60:e0:c1:43:05:0c:ee:9b:5b:60:6f:06:5c:87:
+ 5b:27:f9:40:11:9e:9c:33:c1:b7:e5:35:57:05:7f:
+ 27:ce:17:20:8c:1c:fc:f1:fb:da:31:29:49:ed:f5:
+ 0b:84:a7:4f:c1:f6:4e:c2:28:9c:fa:ee:e0:af:07:
+ fb:33:11:7a:21:4f:0b:21:10:b6:40:3a:ab:22:3a:
+ 04:9c:8b:9b:84:86:72:9a:d2:a7:a5:c4:b4:75:91:
+ a9:2b:23
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Key Usage: critical
+ Certificate Sign, CRL Sign
+ X509v3 Basic Constraints: critical
+ CA:TRUE
+ X509v3 Subject Key Identifier:
+ E0:AA:3F:25:8D:9F:44:5C:C1:3A:E8:2E:AE:77:4C:84:3E:67:0C:F4
+ Signature Algorithm: sha256WithRSAEncryption
+ b9:57:af:b8:12:da:57:83:8f:68:0b:33:1d:03:53:55:f4:95:
+ 70:e4:2b:3d:b0:39:eb:fa:89:62:fd:f7:d6:18:04:2f:21:34:
+ dd:f1:68:f0:d5:96:5a:de:c2:80:a3:c1:8d:c6:6a:f7:59:77:
+ ae:15:64:cf:5b:79:05:77:66:ea:8c:d3:6b:0d:dd:f1:59:2c:
+ c1:33:a5:30:80:15:45:07:45:1a:31:22:b6:92:00:ab:99:4d:
+ 3a:8f:77:af:a9:22:ca:2f:63:ca:15:d6:c7:c6:f0:3d:6c:fc:
+ 1c:0d:98:10:61:9e:11:a2:22:d7:0a:f2:91:7a:6b:39:0e:2f:
+ 30:c3:36:49:9f:e0:e9:0f:02:44:50:37:94:55:7d:ea:9f:f6:
+ 3b:ba:94:a5:4c:e9:bc:3e:51:b4:e8:ca:92:36:54:6d:5c:25:
+ 28:da:dd:ad:14:fd:d3:ee:e2:22:05:eb:d0:f2:b7:68:12:d7:
+ 5a:8a:41:1a:c6:92:a5:5a:3b:63:45:4f:bf:e1:3a:77:22:2f:
+ 5c:bf:46:f9:5a:03:85:13:42:5f:ca:de:53:d7:62:b5:a6:35:
+ 04:c2:47:ff:99:fd:84:df:5c:ce:e9:5e:80:28:41:f2:7d:e7:
+ 1e:90:d8:4f:76:3e:82:3c:0d:fc:a5:03:fa:7b:1a:d9:45:1e:
+ 60:da:c4:8e:f9:fc:2b:c9:7b:95:c5:2a:ff:aa:89:df:82:31:
+ 0f:72:ff:0c:27:d7:0a:1e:56:00:50:1e:0c:90:c1:96:b5:d8:
+ 14:85:bb:a7:0d:16:c1:f8:07:24:1b:ba:85:a1:1a:05:09:80:
+ ba:95:63:c9:3a:ec:25:9f:7f:9d:ba:a4:47:15:9b:44:70:f1:
+ 6a:4b:d6:38:5e:43:f3:18:7e:50:6e:e9:5a:28:e6:65:e6:77:
+ 1b:3a:fd:1d:be:03:26:a3:db:d4:e1:bb:7e:96:27:2b:1d:ee:
+ a4:fb:da:25:54:13:03:de:39:c6:c3:1f:4d:90:ec:8f:1b:4a:
+ d2:1c:ed:85:95:38:50:79:46:d6:c1:90:50:31:a9:5c:9a:6e:
+ 1d:f5:33:56:8b:a7:99:d2:f2:c8:2c:33:93:92:30:c7:4e:8c:
+ 65:33:10:64:17:fd:24:17:96:d1:8d:c2:3a:6a:2b:eb:13:8b:
+ 44:f2:21:f3:4a:1a:b7:77:5f:d7:ed:88:a4:72:e5:39:1f:95:
+ 9d:be:67:c1:70:11:3d:bb:f4:f8:49:b7:e3:26:97:3a:9f:d2:
+ 5f:7c:fb:c0:99:7c:39:29:e0:7b:1d:bf:0d:a7:8f:d2:29:34:
+ 6e:24:15:cb:de:90:5e:bf:1a:c4:66:ea:c2:e6:ba:39:5f:8a:
+ 99:a9:41:59:07:b0:2c:af
+SHA1 Fingerprint=A0:50:EE:0F:28:71:F4:27:B2:12:6D:6F:50:96:25:BA:CC:86:42:AF
+-----BEGIN CERTIFICATE-----
+MIIFRzCCAy+gAwIBAgIRAI4P+UuQcWhlM1T01EQ5t+AwDQYJKoZIhvcNAQELBQAw
+PTELMAkGA1UEBhMCVVMxEjAQBgNVBAoTCUNlcnRhaW5seTEaMBgGA1UEAxMRQ2Vy
+dGFpbmx5IFJvb3QgUjEwHhcNMjEwNDAxMDAwMDAwWhcNNDYwNDAxMDAwMDAwWjA9
+MQswCQYDVQQGEwJVUzESMBAGA1UEChMJQ2VydGFpbmx5MRowGAYDVQQDExFDZXJ0
+YWlubHkgUm9vdCBSMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANA2
+1B/q3avk0bbm+yLA3RMNansiExyXPGhjZjKcA7WNpIGD2ngwEc/csiu+kr+O5MQT
+vqRoTNoCaBZ0vrLdBORrKt03H2As2/X3oXyVtwxwhi7xOu9S98zTm/mLvg7fMbed
+aFySpvXl8wo0tf97ouSHocavFwDvA5HtqRxOcT3Si2yJ9HiG5mpJoM610rCrm/b0
+1C7jcvk2xusVtyWMOvwlDbMicyF0yEqWYZL1LwsYpfSt4u5BvQF5+paMjRcCMLT5
+r3gajLQ2EBAHBXDQ9DGQilHFhiZ5shGIXsXwClTNSaa/ApzSRKft43jvRl5tcdF5
+cBxGX1HpyTfcX35pe0HfNEXgO4T0oYoKNp43zGJS4YkNKPl6I7ENPT2a/Z2B7yyQ
+wHtETrtJ4A5KVpK8y7XdeReJkd5hiXSSqOMyhb5OhaRLWcsrxXiOcVTQAjeZjOVJ
+6uBUcqQRBi8LjMFbvrWhsFNunLhgkR9Za/kt9JQKl7XsxXYDVBtlUrpMklZRNaBA
+2CnbrlJ2Oy0wQJuK0EJWtLeIAaSHO1OWzaMWj/Nmqhexx2DgwUMFDO6bW2BvBlyH
+Wyf5QBGenDPBt+U1VwV/J84XIIwc/PH72jEpSe31C4SnT8H2TsIonPru4K8H+zMR
+eiFPCyEQtkA6qyI6BJyLm4SGcprSp6XEtHWRqSsjAgMBAAGjQjBAMA4GA1UdDwEB
+/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTgqj8ljZ9EXME66C6u
+d0yEPmcM9DANBgkqhkiG9w0BAQsFAAOCAgEAuVevuBLaV4OPaAszHQNTVfSVcOQr
+PbA56/qJYv331hgELyE03fFo8NWWWt7CgKPBjcZq91l3rhVkz1t5BXdm6ozTaw3d
+8VkswTOlMIAVRQdFGjEitpIAq5lNOo93r6kiyi9jyhXWx8bwPWz8HA2YEGGeEaIi
+1wrykXprOQ4vMMM2SZ/g6Q8CRFA3lFV96p/2O7qUpUzpvD5RtOjKkjZUbVwlKNrd
+rRT90+7iIgXr0PK3aBLXWopBGsaSpVo7Y0VPv+E6dyIvXL9G+VoDhRNCX8reU9di
+taY1BMJH/5n9hN9czulegChB8n3nHpDYT3Y+gjwN/KUD+nsa2UUeYNrEjvn8K8l7
+lcUq/6qJ34IxD3L/DCfXCh5WAFAeDJDBlrXYFIW7pw0WwfgHJBu6haEaBQmAupVj
+yTrsJZ9/nbqkRxWbRHDxakvWOF5D8xh+UG7pWijmZeZ3Gzr9Hb4DJqPb1OG7fpYn
+Kx3upPvaJVQTA945xsMfTZDsjxtK0hzthZU4UHlG1sGQUDGpXJpuHfUzVounmdLy
+yCwzk5Iwx06MZTMQZBf9JBeW0Y3COmor6xOLRPIh80oat3df1+2IpHLlOR+Vnb5n
+wXARPbv0+Em34yaXOp/SX3z7wJl8OSngex2/DaeP0ik0biQVy96QXr8axGbqwua6
+OV+KmalBWQewLK8=
-----END CERTIFICATE-----
Certificate:
Data:
@@ -8221,6 +8430,243 @@ xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynp
VSJYACPq4xJDKVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEY
WQPJIrSPnNVeKtelttQKbfi3QBFGmh95DmK/D5fs4C8fF5Q=
-----END CERTIFICATE-----
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number:
+ 06:25:33:b1:47:03:33:27:5c:f9:8d:9a:b9:bf:cc:f8
+ Signature Algorithm: ecdsa-with-SHA384
+ Issuer: C = US, O = Certainly, CN = Certainly Root E1
+ Validity
+ Not Before: Apr 1 00:00:00 2021 GMT
+ Not After : Apr 1 00:00:00 2046 GMT
+ Subject: C = US, O = Certainly, CN = Certainly Root E1
+ Subject Public Key Info:
+ Public Key Algorithm: id-ecPublicKey
+ Public-Key: (384 bit)
+ pub:
+ 04:de:6f:f8:7f:1c:df:ed:f9:47:87:86:b1:a4:c0:
+ 8a:f8:82:97:80:ea:8f:c8:4a:5e:2a:7d:88:68:a7:
+ 01:62:14:91:24:7a:5c:9e:a3:17:7d:8a:86:21:34:
+ 18:50:1b:10:de:d0:37:4b:26:c7:19:60:80:e9:34:
+ bd:60:19:36:40:d6:29:87:09:3c:91:7a:f6:bc:13:
+ 23:dd:59:4e:04:5e:cf:c8:02:1c:18:53:c1:31:d8:
+ da:20:e9:44:8d:e4:76
+ ASN1 OID: secp384r1
+ NIST CURVE: P-384
+ X509v3 extensions:
+ X509v3 Key Usage: critical
+ Certificate Sign, CRL Sign
+ X509v3 Basic Constraints: critical
+ CA:TRUE
+ X509v3 Subject Key Identifier:
+ F3:28:18:CB:64:75:EE:29:2A:EB:ED:AE:23:58:38:85:EB:C8:22:07
+ Signature Algorithm: ecdsa-with-SHA384
+ 30:65:02:31:00:b1:8e:5a:20:c3:b2:19:62:4d:de:b0:4f:df:
+ 6e:d2:70:8a:f1:9f:7e:6a:8c:e6:ba:de:83:69:ca:69:b3:a9:
+ 05:b5:96:92:17:87:c2:d2:ea:d0:7b:ce:d8:41:5b:7c:ae:02:
+ 30:46:de:ea:cb:5d:9a:ec:32:c2:65:16:b0:4c:30:5c:30:f3:
+ da:4e:73:86:06:d8:ce:89:04:48:37:37:f8:dd:33:51:9d:70:
+ af:7b:55:d8:01:2e:7d:05:64:0e:86:b8:91
+SHA1 Fingerprint=F9:E1:6D:DC:01:89:CF:D5:82:45:63:3E:C5:37:7D:C2:EB:93:6F:2B
+-----BEGIN CERTIFICATE-----
+MIIB9zCCAX2gAwIBAgIQBiUzsUcDMydc+Y2aub/M+DAKBggqhkjOPQQDAzA9MQsw
+CQYDVQQGEwJVUzESMBAGA1UEChMJQ2VydGFpbmx5MRowGAYDVQQDExFDZXJ0YWlu
+bHkgUm9vdCBFMTAeFw0yMTA0MDEwMDAwMDBaFw00NjA0MDEwMDAwMDBaMD0xCzAJ
+BgNVBAYTAlVTMRIwEAYDVQQKEwlDZXJ0YWlubHkxGjAYBgNVBAMTEUNlcnRhaW5s
+eSBSb290IEUxMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE3m/4fxzf7flHh4axpMCK
++IKXgOqPyEpeKn2IaKcBYhSRJHpcnqMXfYqGITQYUBsQ3tA3SybHGWCA6TS9YBk2
+QNYphwk8kXr2vBMj3VlOBF7PyAIcGFPBMdjaIOlEjeR2o0IwQDAOBgNVHQ8BAf8E
+BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU8ygYy2R17ikq6+2uI1g4
+hevIIgcwCgYIKoZIzj0EAwMDaAAwZQIxALGOWiDDshliTd6wT99u0nCK8Z9+aozm
+ut6Dacpps6kFtZaSF4fC0urQe87YQVt8rgIwRt7qy12a7DLCZRawTDBcMPPaTnOG
+BtjOiQRINzf43TNRnXCve1XYAS59BWQOhriR
+-----END CERTIFICATE-----
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number:
+ 0d:4d:c5:cd:16:22:95:96:08:7e:b8:0b:7f:15:06:34:fb:79:10:34
+ Signature Algorithm: sha256WithRSAEncryption
+ Issuer: C = TR, L = Ankara, O = E-Tugra EBG A.S., OU = E-Tugra Trust Center, CN = E-Tugra Global Root CA RSA v3
+ Validity
+ Not Before: Mar 18 09:07:17 2020 GMT
+ Not After : Mar 12 09:07:17 2045 GMT
+ Subject: C = TR, L = Ankara, O = E-Tugra EBG A.S., OU = E-Tugra Trust Center, CN = E-Tugra Global Root CA RSA v3
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public-Key: (4096 bit)
+ Modulus:
+ 00:a2:66:f0:89:b7:72:7b:ee:09:c9:63:d2:d3:43:
+ dd:5e:c3:a6:84:38:4a:f1:8d:81:bb:14:bd:47:e8:
+ 40:17:f3:3d:c3:78:45:72:a6:2e:90:de:9a:3a:d4:
+ 20:71:ca:bc:9f:1d:4b:97:0a:c7:31:ba:3e:d7:fe:
+ 25:a9:2a:8e:36:f4:d1:2f:c7:b7:a9:5d:33:dc:30:
+ 70:f8:40:6c:4b:b2:a6:31:61:d1:34:3c:3d:31:7a:
+ c7:af:c4:a7:a7:84:e1:97:a4:e8:4b:f6:17:7c:ee:
+ 3c:07:ed:e2:8a:57:dc:b6:fb:f8:43:25:50:ea:27:
+ 81:a8:86:bc:8f:52:4a:96:3a:60:1a:96:bb:fd:73:
+ f4:85:fd:83:fd:7f:84:6d:34:6c:7f:6a:b7:4b:01:
+ 03:bf:ad:69:b7:d7:32:d9:f5:57:6a:e9:86:82:3e:
+ a5:66:31:b3:16:3d:c2:f3:26:60:32:d3:52:1e:b0:
+ 6c:a4:37:3e:f4:f5:af:eb:e1:df:80:06:cf:2a:41:
+ e7:66:09:e1:4b:97:e7:77:bd:21:6d:29:b6:67:c3:
+ 2d:7e:ed:d6:79:65:d1:cf:3a:b6:d1:b1:5e:56:61:
+ 50:7a:5a:ce:4e:50:31:80:03:98:47:e7:e4:18:7c:
+ 44:5a:c6:a4:b3:3b:c6:c6:c3:3a:f0:6c:c3:8b:c8:
+ a4:91:05:f3:f5:d9:b6:aa:06:a1:b7:ab:e4:b1:ea:
+ 21:14:5c:83:a4:fc:ff:b6:50:d3:8c:12:26:99:76:
+ 70:e9:c0:0f:a6:74:fc:bb:d0:1b:78:ce:72:92:e2:
+ 28:9c:bc:e6:e9:09:d8:3a:d3:89:e6:be:2e:77:df:
+ 01:0a:6f:96:f6:e5:8d:3c:4d:52:76:1a:56:e1:73:
+ 7e:17:ac:3d:ad:6c:a3:52:12:18:70:e6:80:4e:33:
+ f2:7e:26:32:ac:05:8d:38:a4:e6:76:3c:9f:10:69:
+ 0e:6d:9d:d2:c1:79:20:6b:5b:cf:33:8d:d1:94:76:
+ 35:e7:5d:55:c7:b7:ac:28:ab:46:cc:e7:3b:21:b5:
+ 0a:0a:e4:4a:59:dc:81:35:4b:44:95:12:0a:67:a5:
+ a1:ff:5b:00:07:d2:c0:cc:f9:3f:fc:9f:33:f2:00:
+ f8:8c:6c:87:9d:06:2d:f1:ef:e3:e6:06:fa:c5:66:
+ 13:5b:fc:50:07:9e:71:86:b2:da:6f:74:30:cf:93:
+ 53:e8:dc:22:d6:de:20:1f:61:8d:a3:2e:a3:78:32:
+ 90:6c:dc:ac:32:b5:05:e4:f5:3c:33:0d:d6:e0:87:
+ 77:17:4c:9d:b0:d8:09:a8:0d:57:f7:44:85:f0:c8:
+ 04:be:5c:5d:5a:e3:17:8e:54:63:69:7f:49:74:64:
+ 05:8c:a3
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Basic Constraints: critical
+ CA:TRUE
+ X509v3 Authority Key Identifier:
+ keyid:B2:B4:AE:E6:2D:F7:26:D5:AA:75:2D:76:4B:C0:1B:53:21:D0:48:EF
+
+ X509v3 Subject Key Identifier:
+ B2:B4:AE:E6:2D:F7:26:D5:AA:75:2D:76:4B:C0:1B:53:21:D0:48:EF
+ X509v3 Key Usage: critical
+ Certificate Sign, CRL Sign
+ Signature Algorithm: sha256WithRSAEncryption
+ 89:a8:72:7f:8c:eb:ce:2e:18:c4:10:80:2d:10:0c:ff:fb:14:
+ cd:04:e0:14:3c:4e:9a:fb:9f:29:bf:22:9e:57:b9:82:73:12:
+ 63:26:b5:cc:90:e9:d2:2a:29:ee:9c:2d:cc:2c:99:be:45:27:
+ e4:b1:71:ed:e4:38:95:31:41:f2:7d:7a:63:78:df:ca:36:16:
+ 2f:82:88:9f:bc:11:47:4f:76:4d:c8:2d:8e:eb:df:2d:7c:4e:
+ 3b:da:ae:f6:e3:da:5d:14:a6:ae:e8:85:44:9d:06:6e:8e:fb:
+ ef:7a:4a:6a:2d:2b:28:18:fe:bf:90:2c:75:16:9f:0f:ea:96:
+ 7d:05:ee:9b:13:a5:44:6c:f8:03:d0:dd:23:e1:fd:03:12:12:
+ 08:f4:18:34:b3:e0:37:0b:77:11:01:48:bf:61:b4:b5:f8:19:
+ d9:cb:4d:ea:a3:8c:ef:fd:f0:06:b5:6d:92:f4:4a:61:50:84:
+ ed:ec:49:d3:e4:be:68:e6:2e:e3:31:0b:54:0b:1a:92:d6:82:
+ d8:b6:a2:65:3c:66:04:f9:55:da:6c:fb:db:b5:14:66:4d:94:
+ 83:3b:cd:1e:a6:2b:b2:fe:77:40:86:ab:e7:df:0a:c9:fd:f6:
+ dd:87:56:18:d8:b0:2c:55:60:96:fa:08:7e:52:90:f5:4b:a6:
+ 2e:87:7c:cb:20:db:06:3e:a0:5d:03:77:7d:a2:3c:13:1b:29:
+ a2:13:55:a0:3d:14:22:af:6f:b8:d0:9a:1b:72:dd:05:01:8d:
+ 86:60:bf:a4:67:ee:b5:a5:0d:d1:7f:e6:1a:2b:62:66:c3:07:
+ ba:e7:a0:48:1c:38:c3:e9:45:fb:a7:7f:fc:ed:02:68:1a:ca:
+ 77:12:77:a6:00:55:28:14:ec:d6:c7:12:a2:1b:65:42:e9:91:
+ e8:cb:3e:87:89:54:5d:d9:af:9d:97:9c:69:e7:0a:ff:0f:5a:
+ 78:8b:63:2a:4c:7d:47:94:3f:de:4b:e9:53:d0:30:f1:c5:f6:
+ 9e:49:df:3b:a0:91:a3:a3:fe:cd:58:cc:ea:df:af:6f:28:3b:
+ a0:69:9b:8f:ec:ac:ae:2b:54:9d:9b:04:b1:47:20:af:96:12:
+ 3e:63:94:1d:04:e7:2e:bb:86:c7:0c:9a:88:bf:76:47:ef:f7:
+ b0:0b:97:66:d2:44:cf:60:52:07:e1:d5:2c:4a:3a:27:61:77:
+ ca:d7:8f:e7:87:0e:30:ff:0c:bb:04:e2:61:c3:a2:c8:97:61:
+ 8e:b4:30:6a:3c:6d:c2:07:5f:4a:73:2f:3f:f9:16:8a:01:66:
+ ef:ba:91:ca:52:57:7b:ae:d4:e6:0f:dd:0b:7a:7f:8b:9e:26:
+ 20:cf:3b:ef:81:71:83:59
+SHA1 Fingerprint=E9:A8:5D:22:14:52:1C:5B:AA:0A:B4:BE:24:6A:23:8A:C9:BA:E2:A9
+-----BEGIN CERTIFICATE-----
+MIIF8zCCA9ugAwIBAgIUDU3FzRYilZYIfrgLfxUGNPt5EDQwDQYJKoZIhvcNAQEL
+BQAwgYAxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHEwZBbmthcmExGTAXBgNVBAoTEEUt
+VHVncmEgRUJHIEEuUy4xHTAbBgNVBAsTFEUtVHVncmEgVHJ1c3QgQ2VudGVyMSYw
+JAYDVQQDEx1FLVR1Z3JhIEdsb2JhbCBSb290IENBIFJTQSB2MzAeFw0yMDAzMTgw
+OTA3MTdaFw00NTAzMTIwOTA3MTdaMIGAMQswCQYDVQQGEwJUUjEPMA0GA1UEBxMG
+QW5rYXJhMRkwFwYDVQQKExBFLVR1Z3JhIEVCRyBBLlMuMR0wGwYDVQQLExRFLVR1
+Z3JhIFRydXN0IENlbnRlcjEmMCQGA1UEAxMdRS1UdWdyYSBHbG9iYWwgUm9vdCBD
+QSBSU0EgdjMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCiZvCJt3J7
+7gnJY9LTQ91ew6aEOErxjYG7FL1H6EAX8z3DeEVypi6Q3po61CBxyryfHUuXCscx
+uj7X/iWpKo429NEvx7epXTPcMHD4QGxLsqYxYdE0PD0xesevxKenhOGXpOhL9hd8
+7jwH7eKKV9y2+/hDJVDqJ4GohryPUkqWOmAalrv9c/SF/YP9f4RtNGx/ardLAQO/
+rWm31zLZ9Vdq6YaCPqVmMbMWPcLzJmAy01IesGykNz709a/r4d+ABs8qQedmCeFL
+l+d3vSFtKbZnwy1+7dZ5ZdHPOrbRsV5WYVB6Ws5OUDGAA5hH5+QYfERaxqSzO8bG
+wzrwbMOLyKSRBfP12baqBqG3q+Sx6iEUXIOk/P+2UNOMEiaZdnDpwA+mdPy70Bt4
+znKS4iicvObpCdg604nmvi533wEKb5b25Y08TVJ2Glbhc34XrD2tbKNSEhhw5oBO
+M/J+JjKsBY04pOZ2PJ8QaQ5tndLBeSBrW88zjdGUdjXnXVXHt6woq0bM5zshtQoK
+5EpZ3IE1S0SVEgpnpaH/WwAH0sDM+T/8nzPyAPiMbIedBi3x7+PmBvrFZhNb/FAH
+nnGGstpvdDDPk1Po3CLW3iAfYY2jLqN4MpBs3KwytQXk9TwzDdbgh3cXTJ2w2Amo
+DVf3RIXwyAS+XF1a4xeOVGNpf0l0ZAWMowIDAQABo2MwYTAPBgNVHRMBAf8EBTAD
+AQH/MB8GA1UdIwQYMBaAFLK0ruYt9ybVqnUtdkvAG1Mh0EjvMB0GA1UdDgQWBBSy
+tK7mLfcm1ap1LXZLwBtTIdBI7zAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEL
+BQADggIBAImocn+M684uGMQQgC0QDP/7FM0E4BQ8Tpr7nym/Ip5XuYJzEmMmtcyQ
+6dIqKe6cLcwsmb5FJ+Sxce3kOJUxQfJ9emN438o2Fi+CiJ+8EUdPdk3ILY7r3y18
+Tjvarvbj2l0Upq7ohUSdBm6O++96SmotKygY/r+QLHUWnw/qln0F7psTpURs+APQ
+3SPh/QMSEgj0GDSz4DcLdxEBSL9htLX4GdnLTeqjjO/98Aa1bZL0SmFQhO3sSdPk
+vmjmLuMxC1QLGpLWgti2omU8ZgT5Vdps+9u1FGZNlIM7zR6mK7L+d0CGq+ffCsn9
+9t2HVhjYsCxVYJb6CH5SkPVLpi6HfMsg2wY+oF0Dd32iPBMbKaITVaA9FCKvb7jQ
+mhty3QUBjYZgv6Rn7rWlDdF/5horYmbDB7rnoEgcOMPpRfunf/ztAmgayncSd6YA
+VSgU7NbHEqIbZULpkejLPoeJVF3Zr52XnGnnCv8PWniLYypMfUeUP95L6VPQMPHF
+9p5J3zugkaOj/s1YzOrfr28oO6Bpm4/srK4rVJ2bBLFHIK+WEj5jlB0E5y67hscM
+moi/dkfv97ALl2bSRM9gUgfh1SxKOidhd8rXj+eHDjD/DLsE4mHDosiXYY60MGo8
+bcIHX0pzLz/5FooBZu+6kcpSV3uu1OYP3Qt6f4ueJiDPO++BcYNZ
+-----END CERTIFICATE-----
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number:
+ 26:46:19:77:31:e1:4f:6f:28:36:de:39:51:86:e6:d4:97:88:22:c1
+ Signature Algorithm: ecdsa-with-SHA384
+ Issuer: C = TR, L = Ankara, O = E-Tugra EBG A.S., OU = E-Tugra Trust Center, CN = E-Tugra Global Root CA ECC v3
+ Validity
+ Not Before: Mar 18 09:46:58 2020 GMT
+ Not After : Mar 12 09:46:58 2045 GMT
+ Subject: C = TR, L = Ankara, O = E-Tugra EBG A.S., OU = E-Tugra Trust Center, CN = E-Tugra Global Root CA ECC v3
+ Subject Public Key Info:
+ Public Key Algorithm: id-ecPublicKey
+ Public-Key: (384 bit)
+ pub:
+ 04:8e:98:29:bf:c7:10:1e:27:db:ab:03:cc:28:2c:
+ d8:5e:48:19:10:29:cc:cb:59:81:cc:8c:b8:92:17:
+ 89:83:2a:92:f6:c3:a4:1d:4c:62:d5:9f:d6:a0:46:
+ dc:1c:bc:76:c1:e3:47:d0:5b:13:da:e7:a5:b3:66:
+ 48:e7:21:9a:4a:4f:86:0a:7d:6c:ea:4d:32:80:0a:
+ b2:7a:09:9b:69:4b:98:81:e2:2e:ec:02:70:96:1f:
+ fd:f5:46:ce:ca:dc:82
+ ASN1 OID: secp384r1
+ NIST CURVE: P-384
+ X509v3 extensions:
+ X509v3 Basic Constraints: critical
+ CA:TRUE
+ X509v3 Authority Key Identifier:
+ keyid:FF:82:31:72:3E:F9:C4:66:6C:AD:38:9E:D1:B0:51:88:A5:90:CC:F5
+
+ X509v3 Subject Key Identifier:
+ FF:82:31:72:3E:F9:C4:66:6C:AD:38:9E:D1:B0:51:88:A5:90:CC:F5
+ X509v3 Key Usage: critical
+ Certificate Sign, CRL Sign
+ Signature Algorithm: ecdsa-with-SHA384
+ 30:66:02:31:00:e6:05:58:69:61:e5:2d:ca:0d:cb:f1:19:08:
+ bd:d6:fd:51:92:1a:7e:63:54:04:90:91:9a:35:91:39:99:fa:
+ 07:a9:66:93:ba:c8:68:d4:8a:3f:fa:ed:6e:16:02:27:b7:02:
+ 31:00:dd:5a:17:2b:76:1d:65:42:96:a6:ac:5d:8a:79:56:d8:
+ 8a:1b:df:9a:de:5f:c7:50:8f:b1:5b:71:0c:26:df:6a:40:00:
+ ec:33:91:21:71:be:68:e4:23:a4:d9:ad:a1:37
+SHA1 Fingerprint=8A:2F:AF:57:53:B1:B0:E6:A1:04:EC:5B:6A:69:71:6D:F6:1C:E2:84
+-----BEGIN CERTIFICATE-----
+MIICpTCCAiqgAwIBAgIUJkYZdzHhT28oNt45UYbm1JeIIsEwCgYIKoZIzj0EAwMw
+gYAxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHEwZBbmthcmExGTAXBgNVBAoTEEUtVHVn
+cmEgRUJHIEEuUy4xHTAbBgNVBAsTFEUtVHVncmEgVHJ1c3QgQ2VudGVyMSYwJAYD
+VQQDEx1FLVR1Z3JhIEdsb2JhbCBSb290IENBIEVDQyB2MzAeFw0yMDAzMTgwOTQ2
+NThaFw00NTAzMTIwOTQ2NThaMIGAMQswCQYDVQQGEwJUUjEPMA0GA1UEBxMGQW5r
+YXJhMRkwFwYDVQQKExBFLVR1Z3JhIEVCRyBBLlMuMR0wGwYDVQQLExRFLVR1Z3Jh
+IFRydXN0IENlbnRlcjEmMCQGA1UEAxMdRS1UdWdyYSBHbG9iYWwgUm9vdCBDQSBF
+Q0MgdjMwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASOmCm/xxAeJ9urA8woLNheSBkQ
+KczLWYHMjLiSF4mDKpL2w6QdTGLVn9agRtwcvHbB40fQWxPa56WzZkjnIZpKT4YK
+fWzqTTKACrJ6CZtpS5iB4i7sAnCWH/31Rs7K3IKjYzBhMA8GA1UdEwEB/wQFMAMB
+Af8wHwYDVR0jBBgwFoAU/4Ixcj75xGZsrTie0bBRiKWQzPUwHQYDVR0OBBYEFP+C
+MXI++cRmbK04ntGwUYilkMz1MA4GA1UdDwEB/wQEAwIBBjAKBggqhkjOPQQDAwNp
+ADBmAjEA5gVYaWHlLcoNy/EZCL3W/VGSGn5jVASQkZo1kTmZ+gepZpO6yGjUij/6
+7W4WAie3AjEA3VoXK3YdZUKWpqxdinlW2Iob35reX8dQj7FbcQwm32pAAOwzkSFx
+vmjkI6TZraE3
+-----END CERTIFICATE-----
Certificate:
Data:
Version: 3 (0x2)
@@ -11212,99 +11658,6 @@ Rp/7SNVel+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOS
Agu+TGbrIP65y7WZf+a2E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xl
nJ2lYJU6Un/10asIbvPuW/mIPX64b24D5EI=
-----END CERTIFICATE-----
-Certificate:
- Data:
- Version: 3 (0x2)
- Serial Number: 0 (0x0)
- Signature Algorithm: sha1WithRSAEncryption
- Issuer: C = GR, O = Hellenic Academic and Research Institutions Cert. Authority, CN = Hellenic Academic and Research Institutions RootCA 2011
- Validity
- Not Before: Dec 6 13:49:52 2011 GMT
- Not After : Dec 1 13:49:52 2031 GMT
- Subject: C = GR, O = Hellenic Academic and Research Institutions Cert. Authority, CN = Hellenic Academic and Research Institutions RootCA 2011
- Subject Public Key Info:
- Public Key Algorithm: rsaEncryption
- RSA Public-Key: (2048 bit)
- Modulus:
- 00:a9:53:00:e3:2e:a6:f6:8e:fa:60:d8:2d:95:3e:
- f8:2c:2a:54:4e:cd:b9:84:61:94:58:4f:8f:3d:8b:
- e4:43:f3:75:89:8d:51:e4:c3:37:d2:8a:88:4d:79:
- 1e:b7:12:dd:43:78:4a:8a:92:e6:d7:48:d5:0f:a4:
- 3a:29:44:35:b8:07:f6:68:1d:55:cd:38:51:f0:8c:
- 24:31:85:af:83:c9:7d:e9:77:af:ed:1a:7b:9d:17:
- f9:b3:9d:38:50:0f:a6:5a:79:91:80:af:37:ae:a6:
- d3:31:fb:b5:26:09:9d:3c:5a:ef:51:c5:2b:df:96:
- 5d:eb:32:1e:02:da:70:49:ec:6e:0c:c8:9a:37:8d:
- f7:f1:36:60:4b:26:2c:82:9e:d0:78:f3:0d:0f:63:
- a4:51:30:e1:f9:2b:27:12:07:d8:ea:bd:18:62:98:
- b0:59:37:7d:be:ee:f3:20:51:42:5a:83:ef:93:ba:
- 69:15:f1:62:9d:9f:99:39:82:a1:b7:74:2e:8b:d4:
- c5:0b:7b:2f:f0:c8:0a:da:3d:79:0a:9a:93:1c:a5:
- 28:72:73:91:43:9a:a7:d1:4d:85:84:b9:a9:74:8f:
- 14:40:c7:dc:de:ac:41:64:6c:b4:19:9b:02:63:6d:
- 24:64:8f:44:b2:25:ea:ce:5d:74:0c:63:32:5c:8d:
- 87:e5
- Exponent: 65537 (0x10001)
- X509v3 extensions:
- X509v3 Basic Constraints: critical
- CA:TRUE
- X509v3 Key Usage:
- Certificate Sign, CRL Sign
- X509v3 Subject Key Identifier:
- A6:91:42:FD:13:61:4A:23:9E:08:A4:29:E5:D8:13:04:23:EE:41:25
- X509v3 Name Constraints:
- Permitted:
- DNS:.gr
- DNS:.eu
- DNS:.edu
- DNS:.org
- email:.gr
- email:.eu
- email:.edu
- email:.org
-
- Signature Algorithm: sha1WithRSAEncryption
- 1f:ef:79:41:e1:7b:6e:3f:b2:8c:86:37:42:4a:4e:1c:37:1e:
- 8d:66:ba:24:81:c9:4f:12:0f:21:c0:03:97:86:25:6d:5d:d3:
- 22:29:a8:6c:a2:0d:a9:eb:3d:06:5b:99:3a:c7:cc:c3:9a:34:
- 7f:ab:0e:c8:4e:1c:e1:fa:e4:dc:cd:0d:be:bf:24:fe:6c:e7:
- 6b:c2:0d:c8:06:9e:4e:8d:61:28:a6:6a:fd:e5:f6:62:ea:18:
- 3c:4e:a0:53:9d:b2:3a:9c:eb:a5:9c:91:16:b6:4d:82:e0:0c:
- 05:48:a9:6c:f5:cc:f8:cb:9d:49:b4:f0:02:a5:fd:70:03:ed:
- 8a:21:a5:ae:13:86:49:c3:33:73:be:87:3b:74:8b:17:45:26:
- 4c:16:91:83:fe:67:7d:cd:4d:63:67:fa:f3:03:12:96:78:06:
- 8d:b1:67:ed:8e:3f:be:9f:4f:02:f5:b3:09:2f:f3:4c:87:df:
- 2a:cb:95:7c:01:cc:ac:36:7a:bf:a2:73:7a:f7:8f:c1:b5:9a:
- a1:14:b2:8f:33:9f:0d:ef:22:dc:66:7b:84:bd:45:17:06:3d:
- 3c:ca:b9:77:34:8f:ca:ea:cf:3f:31:3e:e3:88:e3:80:49:25:
- c8:97:b5:9d:9a:99:4d:b0:3c:f8:4a:00:9b:64:dd:9f:39:4b:
- d1:27:d7:b8
-SHA1 Fingerprint=FE:45:65:9B:79:03:5B:98:A1:61:B5:51:2E:AC:DA:58:09:48:22:4D
------BEGIN CERTIFICATE-----
-MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1Ix
-RDBCBgNVBAoTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1
-dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1p
-YyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIFJvb3RDQSAyMDExMB4XDTExMTIw
-NjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYTAkdSMUQwQgYDVQQK
-EztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIENl
-cnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJl
-c2VhcmNoIEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEB
-BQADggEPADCCAQoCggEBAKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPz
-dYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJ
-fel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa71HFK9+WXesyHgLacEns
-bgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u8yBRQlqD
-75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSP
-FEDH3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNV
-HRMBAf8EBTADAQH/MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp
-5dgTBCPuQSUwRwYDVR0eBEAwPqA8MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQu
-b3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQub3JnMA0GCSqGSIb3DQEBBQUA
-A4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVtXdMiKahsog2p
-6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
-TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7
-dIsXRSZMFpGD/md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8Acys
-Nnq/onN694/BtZqhFLKPM58N7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXI
-l7WdmplNsDz4SgCbZN2fOUvRJ9e4
------END CERTIFICATE-----
Certificate:
Data:
Version: 3 (0x2)
@@ -11490,154 +11843,63 @@ Certificate:
53:5f:21:f5:ba:b0:3a:52:39:2c:92:b0:6c:00:c9:ef:ce:20:
ef:06:f2:96:9e:e9:a4:74:7f:7a:16:fc:b7:f5:b6:fb:15:1b:
3f:ab:a6:c0:72:5d:10:b1:71:ee:bc:4f:e3:ad:ac:03:6d:2e:
- 71:2e:af:c4:e3:ad:a3:bd:0c:11:a7:b4:ff:4a:b2:7b:10:10:
- 1f:a7:57:41:b2:c0:ae:f4:2c:59:d6:47:10:88:f3:21:51:29:
- 30:ca:60:86:af:46:ab:1d:ed:3a:5b:b0:94:de:44:e3:41:08:
- a2:c1:ec:1d:d6:fd:4f:b6:d6:47:d0:14:0b:ca:e6:ca:b5:7b:
- 77:7e:41:1f:5e:83:c7:b6:8c:39:96:b0:3f:96:81:41:6f:60:
- 90:e2:e8:f9:fb:22:71:d9:7d:b3:3d:46:bf:b4:84:af:90:1c:
- 0f:8f:12:6a:af:ef:ee:1e:7a:ae:02:4a:8a:17:2b:76:fe:ac:
- 54:89:24:2c:4f:3f:b6:b2:a7:4e:8c:a8:91:97:fb:29:c6:7b:
- 5c:2d:b9:cb:66:b6:b7:a8:5b:12:51:85:b5:09:7e:62:78:70:
- fe:a9:6a:60:b6:1d:0e:79:0c:fd:ca:ea:24:80:72:c3:97:3f:
- f2:77:ab:43:22:0a:c7:eb:b6:0c:84:82:2c:80:6b:41:8a:08:
- c0:eb:a5:6b:df:99:12:cb:8a:d5:5e:80:0c:91:e0:26:08:36:
- 48:c5:fa:38:11:35:ff:25:83:2d:f2:7a:bf:da:fd:8e:fe:a5:
- cb:45:2c:1f:c4:88:53:ae:77:0e:d9:9a:76:c5:8e:2c:1d:a3:
- ba:d5:ec:32:ae:c0:aa:ac:f7:d1:7a:4d:eb:d4:07:e2:48:f7:
- 22:8e:b0:a4:9f:6a:ce:8e:b2:b2:60:f4:a3:22:d0:23:eb:94:
- 5a:7a:69:dd:0f:bf:40:57:ac:6b:59:50:d9:a3:99:e1:6e:fe:
- 8d:01:79:27:23:15:de:92:9d:7b:09:4d:5a:e7:4b:48:30:5a:
- 18:e6:0a:6d:e6:8f:e0:d2:bb:e6:df:7c:6e:21:82:c1:68:39:
- 4d:b4:98:58:66:62:cc:4a:90:5e:c3:fa:27:04:b1:79:15:74:
- 99:cc:be:ad:20:de:26:60:1c:eb:56:51:a6:a3:ea:e4:a3:3f:
- a7:ff:61:dc:f1:5a:4d:6c:32:23:43:ee:ac:a8:ee:ee:4a:12:
- 09:3c:5d:71:c2:be:79:fa:c2:87:68:1d:0b:fd:5c:69:cc:06:
- d0:9a:7d:54:99:2a:c9:39:1a:19:af:4b:2a:43:f3:63:5d:5a:
- 58:e2:2f:e3:1d:e4:a9:d6:d0:0a:d0:9e:bf:d7:81:09:f1:c9:
- c7:26:0d:ac:98:16:56:a0
-SHA1 Fingerprint=49:0A:75:74:DE:87:0A:47:FE:58:EE:F6:C7:6B:EB:C6:0B:12:40:99
------BEGIN CERTIFICATE-----
-MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEd
-MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3Mg
-Q2xhc3MgMiBSb290IENBMB4XDTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1ow
-TjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MSAw
-HgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEB
-BQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1g1Lr
-6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPV
-L4O2fuPn9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC91
-1K2GScuVr1QGbNgGE41b/+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHx
-MlAQTn/0hpPshNOOvEu/XAFOBz3cFIqUCqTqc/sLUegTBxj6DvEr0VQVfTzh97QZ
-QmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeffawrbD02TTqigzXsu8lkB
-arcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgIzRFo1clr
-Us3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLi
-FRhnBkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRS
-P/TizPJhk9H9Z2vXUq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN
-9SG9dKpN6nIDSdvHXx1iY8f93ZHsM+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxP
-AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMmAd+BikoL1Rpzz
-uvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAU18h
-9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
-A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3t
-OluwlN5E40EIosHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo
-+fsicdl9sz1Gv7SEr5AcD48Saq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7
-KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYdDnkM/crqJIByw5c/8nerQyIKx+u2
-DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWDLfJ6v9r9jv6ly0Us
-H8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0oyLQ
-I+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK7
-5t98biGCwWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h
-3PFaTWwyI0PurKju7koSCTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPz
-Y11aWOIv4x3kqdbQCtCev9eBCfHJxyYNrJgWVqA=
------END CERTIFICATE-----
-Certificate:
- Data:
- Version: 3 (0x2)
- Serial Number: 1164660820 (0x456b5054)
- Signature Algorithm: sha1WithRSAEncryption
- Issuer: C = US, O = "Entrust, Inc.", OU = www.entrust.net/CPS is incorporated by reference, OU = "(c) 2006 Entrust, Inc.", CN = Entrust Root Certification Authority
- Validity
- Not Before: Nov 27 20:23:42 2006 GMT
- Not After : Nov 27 20:53:42 2026 GMT
- Subject: C = US, O = "Entrust, Inc.", OU = www.entrust.net/CPS is incorporated by reference, OU = "(c) 2006 Entrust, Inc.", CN = Entrust Root Certification Authority
- Subject Public Key Info:
- Public Key Algorithm: rsaEncryption
- RSA Public-Key: (2048 bit)
- Modulus:
- 00:b6:95:b6:43:42:fa:c6:6d:2a:6f:48:df:94:4c:
- 39:57:05:ee:c3:79:11:41:68:36:ed:ec:fe:9a:01:
- 8f:a1:38:28:fc:f7:10:46:66:2e:4d:1e:1a:b1:1a:
- 4e:c6:d1:c0:95:88:b0:c9:ff:31:8b:33:03:db:b7:
- 83:7b:3e:20:84:5e:ed:b2:56:28:a7:f8:e0:b9:40:
- 71:37:c5:cb:47:0e:97:2a:68:c0:22:95:62:15:db:
- 47:d9:f5:d0:2b:ff:82:4b:c9:ad:3e:de:4c:db:90:
- 80:50:3f:09:8a:84:00:ec:30:0a:3d:18:cd:fb:fd:
- 2a:59:9a:23:95:17:2c:45:9e:1f:6e:43:79:6d:0c:
- 5c:98:fe:48:a7:c5:23:47:5c:5e:fd:6e:e7:1e:b4:
- f6:68:45:d1:86:83:5b:a2:8a:8d:b1:e3:29:80:fe:
- 25:71:88:ad:be:bc:8f:ac:52:96:4b:aa:51:8d:e4:
- 13:31:19:e8:4e:4d:9f:db:ac:b3:6a:d5:bc:39:54:
- 71:ca:7a:7a:7f:90:dd:7d:1d:80:d9:81:bb:59:26:
- c2:11:fe:e6:93:e2:f7:80:e4:65:fb:34:37:0e:29:
- 80:70:4d:af:38:86:2e:9e:7f:57:af:9e:17:ae:eb:
- 1c:cb:28:21:5f:b6:1c:d8:e7:a2:04:22:f9:d3:da:
- d8:cb
- Exponent: 65537 (0x10001)
- X509v3 extensions:
- X509v3 Key Usage: critical
- Certificate Sign, CRL Sign
- X509v3 Basic Constraints: critical
- CA:TRUE
- X509v3 Private Key Usage Period:
- Not Before: Nov 27 20:23:42 2006 GMT, Not After: Nov 27 20:53:42 2026 GMT
- X509v3 Authority Key Identifier:
- keyid:68:90:E4:67:A4:A6:53:80:C7:86:66:A4:F1:F7:4B:43:FB:84:BD:6D
-
- X509v3 Subject Key Identifier:
- 68:90:E4:67:A4:A6:53:80:C7:86:66:A4:F1:F7:4B:43:FB:84:BD:6D
- 1.2.840.113533.7.65.0:
- 0...V7.1:4.0....
- Signature Algorithm: sha1WithRSAEncryption
- 93:d4:30:b0:d7:03:20:2a:d0:f9:63:e8:91:0c:05:20:a9:5f:
- 19:ca:7b:72:4e:d4:b1:db:d0:96:fb:54:5a:19:2c:0c:08:f7:
- b2:bc:85:a8:9d:7f:6d:3b:52:b3:2a:db:e7:d4:84:8c:63:f6:
- 0f:cb:26:01:91:50:6c:f4:5f:14:e2:93:74:c0:13:9e:30:3a:
- 50:e3:b4:60:c5:1c:f0:22:44:8d:71:47:ac:c8:1a:c9:e9:9b:
- 9a:00:60:13:ff:70:7e:5f:11:4d:49:1b:b3:15:52:7b:c9:54:
- da:bf:9d:95:af:6b:9a:d8:9e:e9:f1:e4:43:8d:e2:11:44:3a:
- bf:af:bd:83:42:73:52:8b:aa:bb:a7:29:cf:f5:64:1c:0a:4d:
- d1:bc:aa:ac:9f:2a:d0:ff:7f:7f:da:7d:ea:b1:ed:30:25:c1:
- 84:da:34:d2:5b:78:83:56:ec:9c:36:c3:26:e2:11:f6:67:49:
- 1d:92:ab:8c:fb:eb:ff:7a:ee:85:4a:a7:50:80:f0:a7:5c:4a:
- 94:2e:5f:05:99:3c:52:41:e0:cd:b4:63:cf:01:43:ba:9c:83:
- dc:8f:60:3b:f3:5a:b4:b4:7b:ae:da:0b:90:38:75:ef:81:1d:
- 66:d2:f7:57:70:36:b3:bf:fc:28:af:71:25:85:5b:13:fe:1e:
- 7f:5a:b4:3c
-SHA1 Fingerprint=B3:1E:B1:B7:40:E3:6C:84:02:DA:DC:37:D4:4D:F5:D4:67:49:52:F9
+ 71:2e:af:c4:e3:ad:a3:bd:0c:11:a7:b4:ff:4a:b2:7b:10:10:
+ 1f:a7:57:41:b2:c0:ae:f4:2c:59:d6:47:10:88:f3:21:51:29:
+ 30:ca:60:86:af:46:ab:1d:ed:3a:5b:b0:94:de:44:e3:41:08:
+ a2:c1:ec:1d:d6:fd:4f:b6:d6:47:d0:14:0b:ca:e6:ca:b5:7b:
+ 77:7e:41:1f:5e:83:c7:b6:8c:39:96:b0:3f:96:81:41:6f:60:
+ 90:e2:e8:f9:fb:22:71:d9:7d:b3:3d:46:bf:b4:84:af:90:1c:
+ 0f:8f:12:6a:af:ef:ee:1e:7a:ae:02:4a:8a:17:2b:76:fe:ac:
+ 54:89:24:2c:4f:3f:b6:b2:a7:4e:8c:a8:91:97:fb:29:c6:7b:
+ 5c:2d:b9:cb:66:b6:b7:a8:5b:12:51:85:b5:09:7e:62:78:70:
+ fe:a9:6a:60:b6:1d:0e:79:0c:fd:ca:ea:24:80:72:c3:97:3f:
+ f2:77:ab:43:22:0a:c7:eb:b6:0c:84:82:2c:80:6b:41:8a:08:
+ c0:eb:a5:6b:df:99:12:cb:8a:d5:5e:80:0c:91:e0:26:08:36:
+ 48:c5:fa:38:11:35:ff:25:83:2d:f2:7a:bf:da:fd:8e:fe:a5:
+ cb:45:2c:1f:c4:88:53:ae:77:0e:d9:9a:76:c5:8e:2c:1d:a3:
+ ba:d5:ec:32:ae:c0:aa:ac:f7:d1:7a:4d:eb:d4:07:e2:48:f7:
+ 22:8e:b0:a4:9f:6a:ce:8e:b2:b2:60:f4:a3:22:d0:23:eb:94:
+ 5a:7a:69:dd:0f:bf:40:57:ac:6b:59:50:d9:a3:99:e1:6e:fe:
+ 8d:01:79:27:23:15:de:92:9d:7b:09:4d:5a:e7:4b:48:30:5a:
+ 18:e6:0a:6d:e6:8f:e0:d2:bb:e6:df:7c:6e:21:82:c1:68:39:
+ 4d:b4:98:58:66:62:cc:4a:90:5e:c3:fa:27:04:b1:79:15:74:
+ 99:cc:be:ad:20:de:26:60:1c:eb:56:51:a6:a3:ea:e4:a3:3f:
+ a7:ff:61:dc:f1:5a:4d:6c:32:23:43:ee:ac:a8:ee:ee:4a:12:
+ 09:3c:5d:71:c2:be:79:fa:c2:87:68:1d:0b:fd:5c:69:cc:06:
+ d0:9a:7d:54:99:2a:c9:39:1a:19:af:4b:2a:43:f3:63:5d:5a:
+ 58:e2:2f:e3:1d:e4:a9:d6:d0:0a:d0:9e:bf:d7:81:09:f1:c9:
+ c7:26:0d:ac:98:16:56:a0
+SHA1 Fingerprint=49:0A:75:74:DE:87:0A:47:FE:58:EE:F6:C7:6B:EB:C6:0B:12:40:99
-----BEGIN CERTIFICATE-----
-MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMC
-VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0
-Lm5ldC9DUFMgaXMgaW5jb3Jwb3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMW
-KGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsGA1UEAxMkRW50cnVzdCBSb290IENl
-cnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0MloXDTI2MTEyNzIw
-NTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMTkw
-NwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSBy
-ZWZlcmVuY2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNV
-BAMTJEVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJ
-KoZIhvcNAQEBBQADggEPADCCAQoCggEBALaVtkNC+sZtKm9I35RMOVcF7sN5EUFo
-Nu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYszA9u3g3s+IIRe7bJWKKf4
-4LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOwwCj0Yzfv9
-KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGI
-rb68j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi
-94DkZfs0Nw4pgHBNrziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOB
-sDCBrTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAi
-gA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1MzQyWjAfBgNVHSMEGDAWgBRo
-kORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DHhmak8fdLQ/uE
-vW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
-A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9t
-O1KzKtvn1ISMY/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6Zua
-AGAT/3B+XxFNSRuzFVJ7yVTav52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP
-9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTSW3iDVuycNsMm4hH2Z0kdkquM++v/
-eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0tHuu2guQOHXvgR1m
-0vdXcDazv/wor3ElhVsT/h5/WrQ8
+MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEd
+MBsGA1UECgwUQnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3Mg
+Q2xhc3MgMiBSb290IENBMB4XDTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1ow
+TjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1eXBhc3MgQVMtOTgzMTYzMzI3MSAw
+HgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIwDQYJKoZIhvcNAQEB
+BQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1g1Lr
+6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPV
+L4O2fuPn9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC91
+1K2GScuVr1QGbNgGE41b/+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHx
+MlAQTn/0hpPshNOOvEu/XAFOBz3cFIqUCqTqc/sLUegTBxj6DvEr0VQVfTzh97QZ
+QmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeffawrbD02TTqigzXsu8lkB
+arcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgIzRFo1clr
+Us3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLi
+FRhnBkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRS
+P/TizPJhk9H9Z2vXUq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN
+9SG9dKpN6nIDSdvHXx1iY8f93ZHsM+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxP
+AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFMmAd+BikoL1Rpzz
+uvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsFAAOCAgEAU18h
+9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
+A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3t
+OluwlN5E40EIosHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo
++fsicdl9sz1Gv7SEr5AcD48Saq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7
+KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYdDnkM/crqJIByw5c/8nerQyIKx+u2
+DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWDLfJ6v9r9jv6ly0Us
+H8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0oyLQ
+I+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK7
+5t98biGCwWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h
+3PFaTWwyI0PurKju7koSCTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPz
+Y11aWOIv4x3kqdbQCtCev9eBCfHJxyYNrJgWVqA=
-----END CERTIFICATE-----
Certificate:
Data:
@@ -11758,6 +12020,97 @@ kbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg41
u79leNKGef9JOxqDDPDeeOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq
4/g7u9xN12TyUb7mqqta6THuBrxzvxNiCp/HuZc=
-----END CERTIFICATE-----
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 1164660820 (0x456b5054)
+ Signature Algorithm: sha1WithRSAEncryption
+ Issuer: C = US, O = "Entrust, Inc.", OU = www.entrust.net/CPS is incorporated by reference, OU = "(c) 2006 Entrust, Inc.", CN = Entrust Root Certification Authority
+ Validity
+ Not Before: Nov 27 20:23:42 2006 GMT
+ Not After : Nov 27 20:53:42 2026 GMT
+ Subject: C = US, O = "Entrust, Inc.", OU = www.entrust.net/CPS is incorporated by reference, OU = "(c) 2006 Entrust, Inc.", CN = Entrust Root Certification Authority
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public-Key: (2048 bit)
+ Modulus:
+ 00:b6:95:b6:43:42:fa:c6:6d:2a:6f:48:df:94:4c:
+ 39:57:05:ee:c3:79:11:41:68:36:ed:ec:fe:9a:01:
+ 8f:a1:38:28:fc:f7:10:46:66:2e:4d:1e:1a:b1:1a:
+ 4e:c6:d1:c0:95:88:b0:c9:ff:31:8b:33:03:db:b7:
+ 83:7b:3e:20:84:5e:ed:b2:56:28:a7:f8:e0:b9:40:
+ 71:37:c5:cb:47:0e:97:2a:68:c0:22:95:62:15:db:
+ 47:d9:f5:d0:2b:ff:82:4b:c9:ad:3e:de:4c:db:90:
+ 80:50:3f:09:8a:84:00:ec:30:0a:3d:18:cd:fb:fd:
+ 2a:59:9a:23:95:17:2c:45:9e:1f:6e:43:79:6d:0c:
+ 5c:98:fe:48:a7:c5:23:47:5c:5e:fd:6e:e7:1e:b4:
+ f6:68:45:d1:86:83:5b:a2:8a:8d:b1:e3:29:80:fe:
+ 25:71:88:ad:be:bc:8f:ac:52:96:4b:aa:51:8d:e4:
+ 13:31:19:e8:4e:4d:9f:db:ac:b3:6a:d5:bc:39:54:
+ 71:ca:7a:7a:7f:90:dd:7d:1d:80:d9:81:bb:59:26:
+ c2:11:fe:e6:93:e2:f7:80:e4:65:fb:34:37:0e:29:
+ 80:70:4d:af:38:86:2e:9e:7f:57:af:9e:17:ae:eb:
+ 1c:cb:28:21:5f:b6:1c:d8:e7:a2:04:22:f9:d3:da:
+ d8:cb
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Key Usage: critical
+ Certificate Sign, CRL Sign
+ X509v3 Basic Constraints: critical
+ CA:TRUE
+ X509v3 Private Key Usage Period:
+ Not Before: Nov 27 20:23:42 2006 GMT, Not After: Nov 27 20:53:42 2026 GMT
+ X509v3 Authority Key Identifier:
+ keyid:68:90:E4:67:A4:A6:53:80:C7:86:66:A4:F1:F7:4B:43:FB:84:BD:6D
+
+ X509v3 Subject Key Identifier:
+ 68:90:E4:67:A4:A6:53:80:C7:86:66:A4:F1:F7:4B:43:FB:84:BD:6D
+ 1.2.840.113533.7.65.0:
+ 0...V7.1:4.0....
+ Signature Algorithm: sha1WithRSAEncryption
+ 93:d4:30:b0:d7:03:20:2a:d0:f9:63:e8:91:0c:05:20:a9:5f:
+ 19:ca:7b:72:4e:d4:b1:db:d0:96:fb:54:5a:19:2c:0c:08:f7:
+ b2:bc:85:a8:9d:7f:6d:3b:52:b3:2a:db:e7:d4:84:8c:63:f6:
+ 0f:cb:26:01:91:50:6c:f4:5f:14:e2:93:74:c0:13:9e:30:3a:
+ 50:e3:b4:60:c5:1c:f0:22:44:8d:71:47:ac:c8:1a:c9:e9:9b:
+ 9a:00:60:13:ff:70:7e:5f:11:4d:49:1b:b3:15:52:7b:c9:54:
+ da:bf:9d:95:af:6b:9a:d8:9e:e9:f1:e4:43:8d:e2:11:44:3a:
+ bf:af:bd:83:42:73:52:8b:aa:bb:a7:29:cf:f5:64:1c:0a:4d:
+ d1:bc:aa:ac:9f:2a:d0:ff:7f:7f:da:7d:ea:b1:ed:30:25:c1:
+ 84:da:34:d2:5b:78:83:56:ec:9c:36:c3:26:e2:11:f6:67:49:
+ 1d:92:ab:8c:fb:eb:ff:7a:ee:85:4a:a7:50:80:f0:a7:5c:4a:
+ 94:2e:5f:05:99:3c:52:41:e0:cd:b4:63:cf:01:43:ba:9c:83:
+ dc:8f:60:3b:f3:5a:b4:b4:7b:ae:da:0b:90:38:75:ef:81:1d:
+ 66:d2:f7:57:70:36:b3:bf:fc:28:af:71:25:85:5b:13:fe:1e:
+ 7f:5a:b4:3c
+SHA1 Fingerprint=B3:1E:B1:B7:40:E3:6C:84:02:DA:DC:37:D4:4D:F5:D4:67:49:52:F9
+-----BEGIN CERTIFICATE-----
+MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMC
+VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0
+Lm5ldC9DUFMgaXMgaW5jb3Jwb3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMW
+KGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsGA1UEAxMkRW50cnVzdCBSb290IENl
+cnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0MloXDTI2MTEyNzIw
+NTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMTkw
+NwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSBy
+ZWZlcmVuY2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNV
+BAMTJEVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJ
+KoZIhvcNAQEBBQADggEPADCCAQoCggEBALaVtkNC+sZtKm9I35RMOVcF7sN5EUFo
+Nu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYszA9u3g3s+IIRe7bJWKKf4
+4LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOwwCj0Yzfv9
+KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGI
+rb68j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi
+94DkZfs0Nw4pgHBNrziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOB
+sDCBrTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAi
+gA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1MzQyWjAfBgNVHSMEGDAWgBRo
+kORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DHhmak8fdLQ/uE
+vW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
+A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9t
+O1KzKtvn1ISMY/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6Zua
+AGAT/3B+XxFNSRuzFVJ7yVTav52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP
+9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTSW3iDVuycNsMm4hH2Z0kdkquM++v/
+eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0tHuu2guQOHXvgR1m
+0vdXcDazv/wor3ElhVsT/h5/WrQ8
+-----END CERTIFICATE-----
Certificate:
Data:
Version: 3 (0x2)
@@ -12733,3 +13086,87 @@ g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlP
BSeOE6Fuwg==
-----END CERTIFICATE-----
+Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 6643877497813316402 (0x5c33cb622c5fb332)
+ Signature Algorithm: sha256WithRSAEncryption
+ Issuer: CN = Atos TrustedRoot 2011, O = Atos, C = DE
+ Validity
+ Not Before: Jul 7 14:58:30 2011 GMT
+ Not After : Dec 31 23:59:59 2030 GMT
+ Subject: CN = Atos TrustedRoot 2011, O = Atos, C = DE
+ Subject Public Key Info:
+ Public Key Algorithm: rsaEncryption
+ RSA Public-Key: (2048 bit)
+ Modulus:
+ 00:95:85:3b:97:6f:2a:3b:2e:3b:cf:a6:f3:29:35:
+ be:cf:18:ac:3e:aa:d9:f8:4d:a0:3e:1a:47:b9:bc:
+ 9a:df:f2:fe:cc:3e:47:e8:7a:96:c2:24:8e:35:f4:
+ a9:0c:fc:82:fd:6d:c1:72:62:27:bd:ea:6b:eb:e7:
+ 8a:cc:54:3e:90:50:cf:80:d4:95:fb:e8:b5:82:d4:
+ 14:c5:b6:a9:55:25:57:db:b1:50:f6:b0:60:64:59:
+ 7a:69:cf:03:b7:6f:0d:be:ca:3e:6f:74:72:ea:aa:
+ 30:2a:73:62:be:49:91:61:c8:11:fe:0e:03:2a:f7:
+ 6a:20:dc:02:15:0d:5e:15:6a:fc:e3:82:c1:b5:c5:
+ 9d:64:09:6c:a3:59:98:07:27:c7:1b:96:2b:61:74:
+ 71:6c:43:f1:f7:35:89:10:e0:9e:ec:55:a1:37:22:
+ a2:87:04:05:2c:47:7d:b4:1c:b9:62:29:66:28:ca:
+ b7:e1:93:f5:a4:94:03:99:b9:70:85:b5:e6:48:ea:
+ 8d:50:fc:d9:de:cc:6f:07:0e:dd:0b:72:9d:80:30:
+ 16:07:95:3f:28:0e:fd:c5:75:4f:53:d6:74:9a:b4:
+ 24:2e:8e:02:91:cf:76:c5:9b:1e:55:74:9c:78:21:
+ b1:f0:2d:f1:0b:9f:c2:d5:96:18:1f:f0:54:22:7a:
+ 8c:07
+ Exponent: 65537 (0x10001)
+ X509v3 extensions:
+ X509v3 Subject Key Identifier:
+ A7:A5:06:B1:2C:A6:09:60:EE:D1:97:E9:70:AE:BC:3B:19:6C:DB:21
+ X509v3 Basic Constraints: critical
+ CA:TRUE
+ X509v3 Authority Key Identifier:
+ keyid:A7:A5:06:B1:2C:A6:09:60:EE:D1:97:E9:70:AE:BC:3B:19:6C:DB:21
+
+ X509v3 Certificate Policies:
+ Policy: 1.3.6.1.4.1.6189.3.4.1.1
+
+ X509v3 Key Usage: critical
+ Digital Signature, Certificate Sign, CRL Sign
+ Signature Algorithm: sha256WithRSAEncryption
+ 26:77:34:db:94:48:86:2a:41:9d:2c:3e:06:90:60:c4:8c:ac:
+ 0b:54:b8:1f:b9:7b:d3:07:39:e4:fa:3e:7b:b2:3d:4e:ed:9f:
+ 23:bd:97:f3:6b:5c:ef:ee:fd:40:a6:df:a1:93:a1:0a:86:ac:
+ ef:20:d0:79:01:bd:78:f7:19:d8:24:31:34:04:01:a6:ba:15:
+ 9a:c3:27:dc:d8:4f:0f:cc:18:63:ff:99:0f:0e:91:6b:75:16:
+ e1:21:fc:d8:26:c7:47:b7:a6:cf:58:72:71:7e:ba:e1:4d:95:
+ 47:3b:c9:af:6d:a1:b4:c1:ec:89:f6:b4:0f:38:b5:e2:64:dc:
+ 25:cf:a6:db:eb:9a:5c:99:a1:c5:08:de:fd:e6:da:d5:d6:5a:
+ 45:0c:c4:b7:c2:b5:14:ef:b4:11:ff:0e:15:b5:f5:f5:db:c6:
+ bd:eb:5a:a7:f0:56:22:a9:3c:65:54:c6:15:a8:bd:86:9e:cd:
+ 83:96:68:7a:71:81:89:e1:0b:e1:ea:11:1b:68:08:cc:69:9e:
+ ec:9e:41:9e:44:32:26:7a:e2:87:0a:71:3d:eb:e4:5a:a4:d2:
+ db:c5:cd:c6:de:60:7f:b9:f3:4f:44:92:ef:2a:b7:18:3e:a7:
+ 19:d9:0b:7d:b1:37:41:42:b0:ba:60:1d:f2:fe:09:11:b0:f0:
+ 87:7b:a7:9d
+SHA1 Fingerprint=2B:B1:F5:3E:55:0C:1D:C5:F1:D4:E6:B7:6A:46:4B:55:06:02:AC:21
+-----BEGIN CERTIFICATE-----
+MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UE
+AwwVQXRvcyBUcnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQG
+EwJERTAeFw0xMTA3MDcxNDU4MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMM
+FUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsGA1UECgwEQXRvczELMAkGA1UEBhMC
+REUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCVhTuXbyo7LjvPpvMp
+Nb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr54rM
+VD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+
+SZFhyBH+DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ
+4J7sVaE3IqKHBAUsR320HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0L
+cp2AMBYHlT8oDv3FdU9T1nSatCQujgKRz3bFmx5VdJx4IbHwLfELn8LVlhgf8FQi
+eowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7Rl+lwrrw7GWzbITAPBgNV
+HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZbNshMBgG
+A1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3
+DQEBCwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8j
+vZfza1zv7v1Apt+hk6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kP
+DpFrdRbhIfzYJsdHt6bPWHJxfrrhTZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pc
+maHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a961qn8FYiqTxlVMYVqL2Gns2D
+lmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G3mB/ufNPRJLv
+KrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
+-----END CERTIFICATE-----
From 6ebff00a9038c0f3ade1a4a187ad92ef54634782 Mon Sep 17 00:00:00 2001
From: kerim371
Date: Tue, 21 Jun 2022 11:24:58 +0300
Subject: [PATCH 02/15] DOC: Improve Centos 7 build instructions
This commit is a follow up of 192af076d3 (DOC: Update build
instructions to include CentOS 7).
There were two lines having a similar meaning.
---
Docs/developer_guide/build_instructions/linux.md | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/Docs/developer_guide/build_instructions/linux.md b/Docs/developer_guide/build_instructions/linux.md
index 0d9607358bf..ea76e696b9d 100644
--- a/Docs/developer_guide/build_instructions/linux.md
+++ b/Docs/developer_guide/build_instructions/linux.md
@@ -93,9 +93,7 @@ Slicer built on CentOS 7 will be available for many Linux distributions and rele
Install Qt and CMake as described in [Any Distribution](./linux.md#any-distribution) section.
-Since by default CentOS 7 comes with `gcc 4.8.5` only having [experimental support for C++14](https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcc/C-Dialect-Options.html#C-Dialect-Options), the following allows to install and activate the `devtoolset-11` [providing](https://access.redhat.com/documentation/en-us/red_hat_developer_toolset/11/html/11.0_release_notes/dts11.0_release#Changes_in_DTS) `gcc 11.2.1` [supporting C++20](https://en.cppreference.com/w/cpp/compiler_support/20).
-
-CentOS 7 comes with pretty old devtoolset (gcc 4.8.5). Install and activate newer toolset (11 in this case):
+Since by default CentOS 7 comes with `gcc 4.8.5` only having [experimental support for C++14](https://gcc.gnu.org/onlinedocs/gcc-4.8.5/gcc/C-Dialect-Options.html#C-Dialect-Options), the following allows to install and activate the `devtoolset-11` [providing](https://access.redhat.com/documentation/en-us/red_hat_developer_toolset/11/html/11.0_release_notes/dts11.0_release#Changes_in_DTS) `gcc 11.2.1` [supporting C++20](https://en.cppreference.com/w/cpp/compiler_support/20):
```console
sudo yum install centos-release-scl
From fa651d23ae4b064630a28dd077c9662407c676d0 Mon Sep 17 00:00:00 2001
From: Andras Lasso
Date: Tue, 21 Jun 2022 12:08:55 -0400
Subject: [PATCH 03/15] DOC: Clarify that each extension build tree can only be
used for one build mode
---
Docs/developer_guide/extensions.md | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/Docs/developer_guide/extensions.md b/Docs/developer_guide/extensions.md
index 87a939192c4..393468e00be 100644
--- a/Docs/developer_guide/extensions.md
+++ b/Docs/developer_guide/extensions.md
@@ -22,6 +22,8 @@ If developing modules in Python only, then it is not necessary to build the exte
:::
+Similarly to the building of Slicer core, multi-configuration builds are not supported: one build tree can be only used for one build mode (Release or Debug or RelWithDebInfo or MinSizeRel). If a release and debug mode build are needed then the same source code folder can be used (e.g., `C:\D\SlicerHeart`) but a separate binary folder must be created for each build mode (e.g., `C:\D\SlicerHeart-R` and `C:\D\SlicerHeart-D` for release and debug modes).
+
Assuming that the source code of your extension is located in folder `MyExtension`, an extension can be built by the following steps.
### Linux and macOS
@@ -69,7 +71,7 @@ Run `CMake (cmake-gui)` from the Windows Start menu.
- Click `Configure`. No errors should be displayed.
- Click `Generate` button.
- Click `Open project` button to open `MyExtension.sln` in Visual Studio.
-- Select build configuration (Debug, Release, ...) that matches the build configuration of the chosen Slicer build.
+- Select build configuration (Debug, Release, ...) that matches the build configuration (Release, Debug, ...) of the chosen Slicer build.
- In the menu choose Build / Build Solution.
## Test an extension
@@ -158,7 +160,6 @@ $ make package
- Open `MyExtension.sln` in Visual Studio.
- Right-click on `PACKAGES` project, then select `Build`.
-
## Write documentation for an extension
Keep documentation with your extension's source code and keep it up-to-date whenever the software changes.
From e2cb3d291b4c39e46ef5e099bc032b0598739fd6 Mon Sep 17 00:00:00 2001
From: Andras Lasso
Date: Tue, 21 Jun 2022 15:14:52 -0400
Subject: [PATCH 04/15] ENH: Do not use QSignalSpy in
qSlicerExtensionsManagerModel
QSignalSpy is intended for testing, therefore use qRestAPI's synchronous query instead to get extensions metadata from the server.
To simplify the implementation of synchronous query, extension metadata is now always downloaded using a single query (by specifying `limit=0` query parameter).
see #6437
Co-authored-by: Jean-Christophe Fillion-Robin
---
.../Cxx/qSlicerExtensionsManagerModelTest.cxx | 3 -
Base/QTCore/qSlicerExtensionsManagerModel.cxx | 101 +++++-------------
Base/QTCore/qSlicerExtensionsManagerModel.h | 14 +--
3 files changed, 30 insertions(+), 88 deletions(-)
diff --git a/Base/QTCore/Testing/Cxx/qSlicerExtensionsManagerModelTest.cxx b/Base/QTCore/Testing/Cxx/qSlicerExtensionsManagerModelTest.cxx
index 43900557b2a..cf502773fab 100644
--- a/Base/QTCore/Testing/Cxx/qSlicerExtensionsManagerModelTest.cxx
+++ b/Base/QTCore/Testing/Cxx/qSlicerExtensionsManagerModelTest.cxx
@@ -254,8 +254,6 @@ void qSlicerExtensionsManagerModelTester::installHelper(qSlicerExtensionsManager
QVERIFY(model != nullptr);
QVERIFY(extensionId >= 0 && extensionId <= 3);
- model->setServerQueryWithLimitEnabled(false);
-
QString inputArchiveFile = QString(":/extension-%1-%2.tar.gz").arg(os).arg(extensionId);
QString copiedArchiveFile = tmp + "/" + QFileInfo(inputArchiveFile).fileName();
if (!QFile::exists(copiedArchiveFile))
@@ -582,7 +580,6 @@ void qSlicerExtensionsManagerModelTester::testRetrieveExtensionMetadata()
QFETCH(QString, slicerVersion);
qSlicerExtensionsManagerModel model;
- model.setServerQueryWithLimitEnabled(false);
model.setExtensionsSettingsFilePath(QSettings().fileName());
model.setSlicerVersion(slicerVersion);
diff --git a/Base/QTCore/qSlicerExtensionsManagerModel.cxx b/Base/QTCore/qSlicerExtensionsManagerModel.cxx
index 2d43bb0b5fe..84e70bdb629 100644
--- a/Base/QTCore/qSlicerExtensionsManagerModel.cxx
+++ b/Base/QTCore/qSlicerExtensionsManagerModel.cxx
@@ -28,11 +28,11 @@
#include
#include
#include
-#include
#include
#include
#include
#include
+#include
#include
#include
@@ -164,9 +164,6 @@ class qSlicerExtensionsManagerModelPrivate
int role(const QByteArray& roleName);
- /// This method should only be called after initialization.
- void queryExtensionsMetadataFromServer();
-
/// Save/load extensions metadata that was retrieved from the server to a local cache
/// (in application settings) to avoid too frequent polling of the server.
void saveExtensionsMetadataFromServerToCache();
@@ -243,9 +240,7 @@ class qSlicerExtensionsManagerModelPrivate
QNetworkAccessManager NetworkManager;
qRestAPI ExtensionsMetadataFromServerAPI;
- bool ServerQueryWithLimit = true;
QMap ExtensionsMetadataFromServer;
- QList ExtensionsMetadataFromServerQueryResults;
QUuid ExtensionsMetadataFromServerQueryUID; // if not null then it means that query is in progress
QHash AvailableUpdates;
@@ -398,38 +393,6 @@ int qSlicerExtensionsManagerModelPrivate::role(const QByteArray& roleName)
return -1;
}
-// --------------------------------------------------------------------------
-void qSlicerExtensionsManagerModelPrivate::queryExtensionsMetadataFromServer()
-{
- Q_Q(qSlicerExtensionsManagerModel);
-
- // Build parameters to query server about the extension
- qRestAPI::Parameters parameters;
- if (q->serverAPI() == qSlicerExtensionsManagerModel::Girder_v1)
- {
- parameters["app_revision"] = q->slicerRevision();
- parameters["os"] = q->slicerOs();
- parameters["arch"] = q->slicerArch();
- if (this->ServerQueryWithLimit)
- {
- parameters["offset"] = QString::number(this->ExtensionsMetadataFromServerQueryResults.size());
- // "limit" parameter is not specified as we rely on the server's default value
- }
- else
- {
- parameters["limit"] = QString::number(-1);
- }
- }
- else
- {
- qWarning() << Q_FUNC_INFO << " failed: missing implementation for serverAPI" << q->serverAPI();
- return;
- }
-
- // Issue the query
- this->ExtensionsMetadataFromServerQueryUID = this->ExtensionsMetadataFromServerAPI.get("", parameters);
-}
-
// --------------------------------------------------------------------------
void qSlicerExtensionsManagerModelPrivate::saveExtensionsMetadataFromServerToCache()
{
@@ -2022,12 +1985,10 @@ bool qSlicerExtensionsManagerModel::updateExtensionsMetadataFromServer(bool forc
return true;
}
- QSignalSpy spy{ this, SIGNAL(updateExtensionsMetadataFromServerCompleted(bool)) };
-
if (d->ExtensionsMetadataFromServerQueryUID.isNull())
{
// query is not in progress yet, start it
- d->ExtensionsMetadataFromServerQueryResults.clear();
+ qRestAPI::Parameters parameters;
if (this->serverAPI() == qSlicerExtensionsManagerModel::Girder_v1)
{
QString appID = "5f4474d0e1d8c75dfc705482";
@@ -2038,13 +1999,20 @@ bool qSlicerExtensionsManagerModel::updateExtensionsMetadataFromServer(bool forc
return false;
}
d->ExtensionsMetadataFromServerAPI.setServerUrl(this->serverUrl().toString() + QString("/api/v1/app/%1/extension").arg(appID));
+ parameters["app_revision"] = this->slicerRevision();
+ parameters["os"] = this->slicerOs();
+ parameters["arch"] = this->slicerArch();
+ // request all metadata in a single response (it makes synchronous query simpler)
+ parameters["limit"] = QString::number(0);
}
else
{
qWarning() << "Update extension information from server failed: missing implementation for serverAPI" << this->serverAPI();
return false;
}
- d->queryExtensionsMetadataFromServer();
+
+ // Issue the query
+ d->ExtensionsMetadataFromServerQueryUID = d->ExtensionsMetadataFromServerAPI.get("", parameters);
}
if (!waitForCompletion)
@@ -2052,21 +2020,26 @@ bool qSlicerExtensionsManagerModel::updateExtensionsMetadataFromServer(bool forc
return true;
}
- // Wait up to 15 seconds for the update check to complete
- // (typically takes only a few seconds)
- int timeoutMsec = 15000;
- bool completedSignalReceived = spy.wait(timeoutMsec);
- if (!completedSignalReceived)
+ // Temporarily disable onExtensionsMetadataFromServerQueryFinished call via signal/slot
+ // because we'll call it directly to get returned result.
+ QObject::disconnect(&d->ExtensionsMetadataFromServerAPI,
+ SIGNAL(finished(QUuid)),
+ this, SLOT(onExtensionsMetadataFromServerQueryFinished(QUuid)));
+
+ bool success = this->onExtensionsMetadataFromServerQueryFinished(d->ExtensionsMetadataFromServerQueryUID);
+
+ QObject::connect(&d->ExtensionsMetadataFromServerAPI,
+ SIGNAL(finished(QUuid)),
+ this, SLOT(onExtensionsMetadataFromServerQueryFinished(QUuid)));
+
+ if (!success)
{
d->warning(tr("Update extension information from server failed: timed out while waiting for server response from %1")
.arg(d->ExtensionsMetadataFromServerAPI.serverUrl()));
}
- return completedSignalReceived;
-}
-// --------------------------------------------------------------------------
-CTK_GET_CPP(qSlicerExtensionsManagerModel, bool, serverQueryWithLimitEnabled, ServerQueryWithLimit);
-CTK_SET_CPP(qSlicerExtensionsManagerModel, bool, setServerQueryWithLimitEnabled, ServerQueryWithLimit);
+ return success;
+}
// --------------------------------------------------------------------------
QDateTime qSlicerExtensionsManagerModel::lastUpdateTimeExtensionsMetadataFromServer()
@@ -2098,7 +2071,7 @@ QStringList qSlicerExtensionsManagerModel::availableUpdateExtensions() const
}
// --------------------------------------------------------------------------
-void qSlicerExtensionsManagerModel::onExtensionsMetadataFromServerQueryFinished(const QUuid& requestId)
+bool qSlicerExtensionsManagerModel::onExtensionsMetadataFromServerQueryFinished(const QUuid& requestId)
{
Q_UNUSED(requestId);
Q_D(qSlicerExtensionsManagerModel);
@@ -2117,31 +2090,15 @@ void qSlicerExtensionsManagerModel::onExtensionsMetadataFromServerQueryFinished(
{
// Query failed
d->warning(tr("Failed to download extension metadata from server"));
- d->ExtensionsMetadataFromServerQueryResults.clear();
d->ExtensionsMetadataFromServerQueryUID = QUuid();
emit updateExtensionsMetadataFromServerCompleted(false);
- return;
- }
-
- d->ExtensionsMetadataFromServerQueryResults.append(restResult->results());
-
- if (restResult->results().count() > 0 && d->ServerQueryWithLimit)
- {
- // May not have received all the items yet.
- // To make things simpler, we don't process the data received so far,
- // but keep requesting more data until there is no more (we received
- // everything) and then process all data at once.
- // This should not be an issue because these few queries should be
- // all done in a few seconds (with current sever settings, 50 items
- // are returned and there are less than 200 extensions).
- d->queryExtensionsMetadataFromServer();
- return;
+ return false;
}
d->ExtensionsMetadataFromServer.clear();
// Process response
- foreach (const QVariantMap& result, d->ExtensionsMetadataFromServerQueryResults)
+ foreach (const QVariantMap& result, restResult->results())
{
// Get extension information from server response
ExtensionMetadataType serverExtensionMetadata = qRestAPI::qVariantMapFlattened(result);
@@ -2155,13 +2112,13 @@ void qSlicerExtensionsManagerModel::onExtensionsMetadataFromServerQueryFinished(
}
d->ExtensionsMetadataFromServer[extensionName] = extensionMetadata;
}
- d->ExtensionsMetadataFromServerQueryResults.clear();
d->ExtensionsMetadataFromServerQueryUID = QUuid();
d->saveExtensionsMetadataFromServerToCache();
this->updateModel();
emit updateExtensionsMetadataFromServerCompleted(true);
+ return true;
}
// --------------------------------------------------------------------------
diff --git a/Base/QTCore/qSlicerExtensionsManagerModel.h b/Base/QTCore/qSlicerExtensionsManagerModel.h
index 9f47c9703c6..28202b677f6 100644
--- a/Base/QTCore/qSlicerExtensionsManagerModel.h
+++ b/Base/QTCore/qSlicerExtensionsManagerModel.h
@@ -399,18 +399,6 @@ public slots:
/// Returns false if waitForCompletion is set to true and metadata cannot be retrieved.
bool updateExtensionsMetadataFromServer(bool force=false, bool waitForCompletion=false);
- /// \brief Enable/disable the use of limit and offset parameters for querying extension metadata from the extensions server.
- ///
- /// If enabled (the default), the server may return metadata for a limited number of extensions
- /// at once (for example, 50) to keep the server's load and response time low. The model automatically
- /// submits additional queries until all data is retrieved.
- ///
- /// IF disabled, the limit is to -1 and all metadata are retrieve at once.
- ///
- /// \sa updateExtensionsMetadataFromServer()
- bool serverQueryWithLimitEnabled()const;
- void setServerQueryWithLimitEnabled(bool value);
-
/// Compares current extensions versions with versions available on the server.
/// Emits extensionMetadataUpdated(QString extensionName) and emit extensionUpdatesAvailable(bool found) signals.
/// If Extensions/AutoUpdateInstall is enabled in application settings then this will also install the updated extensions.
@@ -559,7 +547,7 @@ protected slots:
void onUpdateDownloadProgress(qSlicerExtensionDownloadTask* task,
qint64 received, qint64 total);
- void onExtensionsMetadataFromServerQueryFinished(const QUuid& requestId);
+ bool onExtensionsMetadataFromServerQueryFinished(const QUuid& requestId);
protected:
QScopedPointer d_ptr;
From fd03c693ee0bf969567894efbd2bc18410612ae1 Mon Sep 17 00:00:00 2001
From: Andras Lasso
Date: Tue, 21 Jun 2022 18:12:54 -0400
Subject: [PATCH 05/15] BUG: Fix extension update
Basic extension metadata was passed to extension download task (instead of files metadata), which did not contain archivename.
---
Base/QTCore/qSlicerExtensionsManagerModel.cxx | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/Base/QTCore/qSlicerExtensionsManagerModel.cxx b/Base/QTCore/qSlicerExtensionsManagerModel.cxx
index 84e70bdb629..779d7e860d7 100644
--- a/Base/QTCore/qSlicerExtensionsManagerModel.cxx
+++ b/Base/QTCore/qSlicerExtensionsManagerModel.cxx
@@ -1582,8 +1582,9 @@ qSlicerExtensionsManagerModelPrivate::downloadExtensionByName(const QString& ext
return nullptr;
}
- // Retrieve file_id associated with the item
+ // Retrieve file_id and archive name (extension package filename) associated with the item
QString file_id;
+ QString archivename;
this->debug(qSlicerExtensionsManagerModel::tr("Retrieving %1 extension files (extensionId: %2)").arg(extensionName).arg(item_id));
qRestAPI getItemFilesApi;
@@ -1602,6 +1603,7 @@ qSlicerExtensionsManagerModelPrivate::downloadExtensionByName(const QString& ext
else if (results.count() == 1)
{
file_id = results.at(0).value("_id").toString();
+ archivename = results.at(0).value("name").toString();
}
else
{
@@ -1610,13 +1612,14 @@ qSlicerExtensionsManagerModelPrivate::downloadExtensionByName(const QString& ext
}
}
- if (file_id.isEmpty())
+ if (file_id.isEmpty() || archivename.isEmpty())
{
return nullptr;
}
this->debug(qSlicerExtensionsManagerModel::tr("Downloading %1 extension (item_id: %2, file_id: %3)").arg(extensionName).arg(item_id).arg(file_id));
downloadUrl.setPath(downloadUrl.path() + QString("/api/v1/file/%1/download").arg(file_id));
+ extensionMetadata.insert("archivename", archivename);
}
else
{
@@ -2259,7 +2262,7 @@ void qSlicerExtensionsManagerModel::onUpdateDownloadFinished(
QFile file(archivePath);
if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate))
{
- d->critical(tr("Could not create file for writing: %1").arg(file.errorString()));
+ d->critical(tr("Could not write file: '%1' (%2)").arg(archivePath).arg(file.errorString()));
d->ActiveTasks.remove(task);
return;
}
From 64f63404b9e84f19a4926e76219d9c50db2103ce Mon Sep 17 00:00:00 2001
From: Andras Lasso
Date: Tue, 21 Jun 2022 19:36:02 -0400
Subject: [PATCH 06/15] BUG: Fix subject hierarchy item visibility change in
batch mode
"Batch processing" mode is activated automatically when a large (10+ children) branch visibility is changed.
In batch mode, item visibility change requests were mistakenly ignored.
fixes #6445
---
Libs/MRML/Core/vtkMRMLSubjectHierarchyNode.cxx | 4 ----
1 file changed, 4 deletions(-)
diff --git a/Libs/MRML/Core/vtkMRMLSubjectHierarchyNode.cxx b/Libs/MRML/Core/vtkMRMLSubjectHierarchyNode.cxx
index 0fdeb81293e..fc8fb62dd87 100644
--- a/Libs/MRML/Core/vtkMRMLSubjectHierarchyNode.cxx
+++ b/Libs/MRML/Core/vtkMRMLSubjectHierarchyNode.cxx
@@ -3129,10 +3129,6 @@ void vtkMRMLSubjectHierarchyNode::SetItemDisplayVisibility(vtkIdType itemID, int
<< ". Needs to be one of the following: 0:Hidden, 1:Visible" );
return;
}
- if (this->Scene->IsBatchProcessing())
- {
- return;
- }
vtkMRMLNode* dataNode = this->GetItemDataNode(itemID);
vtkMRMLDisplayableNode* displayableNode = vtkMRMLDisplayableNode::SafeDownCast(dataNode);
From 1026bb846d29fe9099de9ec002e332168da8392a Mon Sep 17 00:00:00 2001
From: Andras Lasso
Date: Sat, 18 Jun 2022 00:15:14 -0400
Subject: [PATCH 07/15] BUG: Fix copying of trimmed sequences
fixes #6435
---
Libs/MRML/Core/vtkMRMLSequenceNode.cxx | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/Libs/MRML/Core/vtkMRMLSequenceNode.cxx b/Libs/MRML/Core/vtkMRMLSequenceNode.cxx
index 9d9b2f4eb05..72522b3d1b0 100644
--- a/Libs/MRML/Core/vtkMRMLSequenceNode.cxx
+++ b/Libs/MRML/Core/vtkMRMLSequenceNode.cxx
@@ -245,6 +245,9 @@ void vtkMRMLSequenceNode::Copy(vtkMRMLNode *anode)
}
this->SequenceScene=vtkMRMLScene::New();
+ // Get data node ID in the target scene from the data node ID in the source scene
+ std::map< std::string, std::string > sourceToTargetDataNodeID;
+
if (snode->SequenceScene)
{
for (int n = 0; n < snode->SequenceScene->GetNodes()->GetNumberOfItems(); n++)
@@ -255,7 +258,8 @@ void vtkMRMLSequenceNode::Copy(vtkMRMLNode *anode)
vtkErrorMacro("Invalid node in vtkMRMLSequenceNode");
continue;
}
- this->DeepCopyNodeToScene(node, this->SequenceScene);
+ vtkMRMLNode* targetDataNode = this->DeepCopyNodeToScene(node, this->SequenceScene);
+ sourceToTargetDataNodeID[node->GetID()] = targetDataNode->GetID();
}
}
@@ -267,13 +271,15 @@ void vtkMRMLSequenceNode::Copy(vtkMRMLNode *anode)
seqItem.DataNode = nullptr;
if (sourceIndexIt->DataNode!=nullptr)
{
- seqItem.DataNode=this->SequenceScene->GetNodeByID(sourceIndexIt->DataNode->GetID());
+ std::string targetDataNodeID = sourceToTargetDataNodeID[sourceIndexIt->DataNode->GetID()];
+ seqItem.DataNode = this->SequenceScene->GetNodeByID(targetDataNodeID);
seqItem.DataNodeID.clear();
}
if (seqItem.DataNode==nullptr)
{
// data node was not found, at least copy its ID
- seqItem.DataNodeID=sourceIndexIt->DataNodeID;
+ std::string targetDataNodeID = sourceToTargetDataNodeID[sourceIndexIt->DataNodeID];
+ seqItem.DataNodeID = targetDataNodeID;
if (seqItem.DataNodeID.empty())
{
vtkWarningMacro("vtkMRMLSequenceNode::Copy: node was not found at index value "<
Date: Wed, 22 Jun 2022 13:00:20 -0400
Subject: [PATCH 08/15] ENH: Only show load DICOM toolbar button when DICOM
module loaded (#6420)
---
Base/QTApp/Resources/UI/qSlicerMainWindow.ui | 3 +++
Modules/Scripted/DICOM/DICOM.py | 1 +
2 files changed, 4 insertions(+)
diff --git a/Base/QTApp/Resources/UI/qSlicerMainWindow.ui b/Base/QTApp/Resources/UI/qSlicerMainWindow.ui
index e578e087716..ae48f683910 100644
--- a/Base/QTApp/Resources/UI/qSlicerMainWindow.ui
+++ b/Base/QTApp/Resources/UI/qSlicerMainWindow.ui
@@ -352,6 +352,9 @@
Raise the DICOM module for loading DICOM datasets.
+
+ false
+
diff --git a/Modules/Scripted/DICOM/DICOM.py b/Modules/Scripted/DICOM/DICOM.py
index 38912e47144..9a8b2acb1ce 100644
--- a/Modules/Scripted/DICOM/DICOM.py
+++ b/Modules/Scripted/DICOM/DICOM.py
@@ -83,6 +83,7 @@ def performPostModuleDiscoveryTasks(self):
self.startListener()
if not slicer.app.commandOptions().noMainWindow:
+ slicer.util.mainWindow().findChild(qt.QAction, "LoadDICOMAction").setVisible(True)
# add to the main app file menu
self.addMenu()
# add the settings options
From 5b0fc5cecb16636980ab3f0119184485961d74c9 Mon Sep 17 00:00:00 2001
From: James Butler
Date: Fri, 13 May 2022 19:29:17 -0400
Subject: [PATCH 09/15] STYLE: Update python code with whitespace fixes
This fixes all remaining pycodestyle E2 whitespace error codes.
Bulk of updates performed using autopep8 CLI
with the following command:
autopep8 --in-place --select E201,E202,E203,E211,E221,E222,E225,E226,E227,E228,E231,E241,E251,E261,E262,E265,E266,E271 $(git ls-files '*.py')
See https://github.com/hhatto/autopep8#readme
References:
* Whitespace after '('
See https://www.flake8rules.com/rules/E201.html
* Whitespace before ')'
See https://www.flake8rules.com/rules/E202.html
* Whitespace before ':'
See https://www.flake8rules.com/rules/E203.html
* Whitespace before '('
See https://www.flake8rules.com/rules/E211.html
* Multiple spaces before operator
See https://www.flake8rules.com/rules/E221.html
* Multiple spaces after operator
See https://www.flake8rules.com/rules/E222.html
* Missing whitespace around operator
See https://www.flake8rules.com/rules/E225.html
* Missing whitespace around arithmetic operator
See https://www.flake8rules.com/rules/E226.html
* Missing whitespace around bitwise or shift operator
See https://www.flake8rules.com/rules/E227.html
* Missing whitespace around modulo operator
See https://www.flake8rules.com/rules/E228.html
* Missing whitespace after ',', ';', or ':'
See https://www.flake8rules.com/rules/E231.html
* Multiple spaces after ','
See https://www.flake8rules.com/rules/E241.html
* Unexpected spaces around keyword / parameter equals
See https://www.flake8rules.com/rules/E251.html
* At least two spaces before inline comment
See https://www.flake8rules.com/rules/E261.html
* Inline comment should start with '# '
See https://www.flake8rules.com/rules/E262.html
* Block comment should start with '# '
See https://www.flake8rules.com/rules/E265.html
* Too many leading '#' for block comment
See https://www.flake8rules.com/rules/E266.html
* Multiple spaces after keyword
See https://www.flake8rules.com/rules/E271.html
---
.flake8 | 36 ----
.../SlicerApp/Testing/Python/AtlasTests.py | 20 +-
...RAINSFitRigidRegistrationCrashIssue4139.py | 16 +-
.../SlicerApp/Testing/Python/CLIEventTest.py | 8 +-
.../Testing/Python/CLISerializationTest.py | 138 ++++++------
.../Testing/Python/DCMTKPrivateDictTest.py | 4 +-
.../SlicerApp/Testing/Python/DICOMReaders.py | 26 +--
.../Testing/Python/DWMRIMultishellIOTests.py | 22 +-
.../Python/FiducialLayoutSwitchBug1914.py | 18 +-
.../SlicerApp/Testing/Python/JRC2013Vis.py | 40 ++--
...odeByClassWithSetReferenceCountMinusOne.py | 2 +-
.../Testing/Python/MeasureStartupTimes.py | 10 +-
.../Testing/Python/RSNA2012ProstateDemo.py | 10 +-
.../Testing/Python/RSNAQuantTutorial.py | 104 ++++-----
.../Testing/Python/RSNAVisTutorial.py | 148 ++++++-------
.../Testing/Python/ScenePerformance.py | 26 +--
.../Python/ScriptedModuleCleanupTest.py | 8 +-
.../ScriptedModuleCleanupTestHelperModule.py | 2 +-
.../ScriptedModuleDiscoveryTest/ModuleA.py | 2 +-
.../ScriptedModuleDiscoveryTest/ModuleB.py | 2 +-
.../ModuleC_WithoutWidget.py | 2 +-
.../ModuleD_WithFileDialog_WithoutWidget.py | 4 +-
.../ModuleE_WithFileWriter_WithoutWidget.py | 2 +-
.../Testing/Python/ShaderProperties.py | 70 +++---
.../Testing/Python/SliceLinkLogic.py | 50 ++---
.../SlicerApp/Testing/Python/Slicer4Minute.py | 10 +-
.../Testing/Python/SlicerAppTesting.py | 4 +-
.../Testing/Python/SlicerBoundsTest.py | 20 +-
.../Python/SlicerCreateRulerCrashIssue4199.py | 6 +-
.../SlicerMRBMultipleSaveRestoreLoopTest.py | 8 +-
.../SlicerMRBMultipleSaveRestoreTest.py | 22 +-
.../SlicerMRBSaveRestoreCheckPathsTest.py | 30 +--
.../Python/SlicerOptionDisableSettingsTest.py | 2 +-
.../Python/SlicerOptionIgnoreSlicerRCTest.py | 12 +-
.../Python/SlicerOptionModulesToIgnoreTest.py | 4 +-
.../Python/SlicerOrientationSelectorTest.py | 6 +-
.../SlicerRestoreSceneViewCrashIssue3445.py | 4 +-
.../SlicerScriptedFileReaderWriterTest.py | 8 +-
.../Python/SlicerStartupCompletedTest.py | 12 +-
.../SlicerStartupCompletedTestHelperModule.py | 2 +-
.../Python/SlicerTransformInteractionTest1.py | 138 ++++++------
.../Testing/Python/SlicerUnitTestTest.py | 2 +-
.../Testing/Python/TwoCLIsInARowTest.py | 12 +-
.../Testing/Python/TwoCLIsInParallelTest.py | 10 +-
.../SlicerApp/Testing/Python/UtilTest.py | 162 +++++++-------
...iewControllersSliceInterpolationBug1926.py | 24 +--
.../SlicerApp/Testing/Python/WebEngine.py | 8 +-
.../Testing/Python/sceneImport2428.py | 40 ++--
Base/Python/sitkUtils.py | 4 +-
Base/Python/slicer/ScriptedLoadableModule.py | 32 +--
Base/Python/slicer/__init__.py | 12 +-
Base/Python/slicer/cli.py | 18 +-
Base/Python/slicer/slicerqt.py | 74 +++----
Base/Python/slicer/testing.py | 2 +-
Base/Python/slicer/tests/test_slicer_mgh.py | 4 +-
Base/Python/slicer/tests/test_slicer_minc.py | 2 +-
.../tests/test_slicer_python_sqlite3.py | 2 +-
.../slicer/tests/test_slicer_util_getNodes.py | 6 +-
Base/Python/slicer/util.py | 160 +++++++-------
Base/Python/tests/test_PythonManager.py | 6 +-
Base/Python/tests/test_sitkUtils.py | 16 +-
...criptedLoadableModuleNewStyleTestWidget.py | 2 +-
...qSlicerScriptedLoadableModuleTestWidget.py | 2 +-
Docs/conf.py | 2 +-
.../ScriptedLoadableModuleTemplate.py | 24 +--
...riptedSegmentEditorEffectModuleTemplate.py | 16 +-
.../SegmentEditorEffect.py | 8 +-
...erate_default_color_node_property_table.py | 4 +-
...tkITKArchetypeDiffusionTensorReaderFile.py | 8 +-
.../vtkITKArchetypeScalarReaderFile.py | 8 +-
...ionsTestingFiducialWithSceneViewRestore.py | 12 +-
.../Python/LoadAnnotationRulerScene.py | 2 +-
.../Testing/Python/ColorLegendSelfTest.py | 12 +-
...omColorTableSceneViewRestoreTestBug3992.py | 16 +-
.../Testing/Python/CropVolumeSelfTest.py | 6 +-
.../Python/AddManyMarkupsFiducialTest.py | 20 +-
.../Python/MarkupsCurveCoordinateFrameTest.py | 50 ++---
.../Python/MarkupsCurveMeasurementsTest.py | 20 +-
.../Python/MarkupsInCompareViewersSelfTest.py | 2 +-
.../Testing/Python/MarkupsInViewsSelfTest.py | 20 +-
.../Testing/Python/MarkupsMeasurementsTest.py | 12 +-
.../MarkupsSceneViewRestoreTestManyLists.py | 8 +-
.../MarkupsSceneViewRestoreTestSimple.py | 12 +-
...surgicalPlanningTutorialMarkupsSelfTest.py | 48 ++---
.../Python/PluggableMarkupsSelfTest.py | 16 +-
.../Testing/Python/MarkupsWidgetsSelfTest.py | 22 +-
.../Plots/Testing/Python/PlotsSelfTest.py | 4 +-
.../AddStorableDataAfterSceneViewTest.py | 6 +-
...ScriptedSegmentEditorAutoCompleteEffect.py | 54 ++---
.../AbstractScriptedSegmentEditorEffect.py | 6 +-
.../Python/SegmentEditorDrawEffect.py | 14 +-
.../SegmentEditorFillBetweenSlicesEffect.py | 2 +-
.../SegmentEditorGrowFromSeedsEffect.py | 6 +-
.../Python/SegmentEditorHollowEffect.py | 16 +-
.../Python/SegmentEditorIslandsEffect.py | 38 ++--
.../Python/SegmentEditorLevelTracingEffect.py | 14 +-
.../Python/SegmentEditorLogicalEffect.py | 10 +-
.../Python/SegmentEditorMarginEffect.py | 8 +-
.../Python/SegmentEditorMaskVolumeEffect.py | 12 +-
.../Python/SegmentEditorSmoothingEffect.py | 40 ++--
.../Python/SegmentEditorThresholdEffect.py | 56 ++---
.../Python/SegmentationWidgetsTest1.py | 68 +++---
.../Python/SegmentationsModuleTest1.py | 134 ++++++------
.../Python/SegmentationsModuleTest2.py | 170 +++++++--------
.../SubjectHierarchyCorePluginsSelfTest.py | 62 +++---
.../Python/SubjectHierarchyFoldersTest1.py | 42 ++--
.../Python/SubjectHierarchyGenericSelfTest.py | 200 +++++++++---------
.../Tables/Testing/Python/TablesSelfTest.py | 84 ++++----
.../VolumeRendering_CTAbdomenTutorial.py | 2 +-
...VolumeRendering_CTAbdomen_AppleTutorial.py | 2 +-
.../VolumesLogicCompareVolumeGeometry.py | 26 +--
.../CropVolumeSequence/CropVolumeSequence.py | 16 +-
Modules/Scripted/DICOM/DICOM.py | 48 ++---
Modules/Scripted/DICOMLib/DICOMBrowser.py | 6 +-
.../DICOMLib/DICOMExportScalarVolume.py | 12 +-
Modules/Scripted/DICOMLib/DICOMExportScene.py | 20 +-
Modules/Scripted/DICOMLib/DICOMPlugin.py | 94 ++++----
Modules/Scripted/DICOMLib/DICOMProcesses.py | 42 ++--
.../DICOMLib/DICOMRecentActivityWidget.py | 2 +-
Modules/Scripted/DICOMLib/DICOMSendDialog.py | 4 +-
Modules/Scripted/DICOMLib/DICOMUtils.py | 92 ++++----
Modules/Scripted/DICOMPatcher/DICOMPatcher.py | 88 ++++----
.../DICOMEnhancedUSVolumePlugin.py | 6 +-
.../DICOMPlugins/DICOMGeAbusPlugin.py | 50 ++---
.../DICOMPlugins/DICOMImageSequencePlugin.py | 18 +-
.../DICOMPlugins/DICOMScalarVolumePlugin.py | 126 +++++------
.../DICOMPlugins/DICOMVolumeSequencePlugin.py | 28 +--
Modules/Scripted/DMRIInstall/DMRIInstall.py | 6 +-
Modules/Scripted/DataProbe/DataProbe.py | 80 +++----
.../DataProbe/DataProbeLib/DataProbeUtil.py | 10 +-
.../DataProbeLib/SliceViewAnnotations.py | 134 ++++++------
Modules/Scripted/Endoscopy/Endoscopy.py | 102 ++++-----
.../ExtensionWizard/ExtensionWizard.py | 38 ++--
.../CreateComponentDialog.py | 28 +--
.../ExtensionWizardLib/DirectoryListWidget.py | 14 +-
.../EditExtensionMetadataDialog.py | 24 +--
.../ExtensionWizardLib/EditableTreeWidget.py | 32 +--
.../ExtensionWizardLib/LoadModulesDialog.py | 26 +--
.../ExtensionWizardLib/ModuleInfo.py | 16 +-
.../ExtensionWizardLib/SettingsPanel.py | 14 +-
.../TemplatePathUtilities.py | 4 +-
.../PerformanceTests/PerformanceTests.py | 54 ++---
Modules/Scripted/SampleData/SampleData.py | 58 ++---
.../Scripted/ScreenCapture/ScreenCapture.py | 154 +++++++-------
.../Scripted/SegmentEditor/SegmentEditor.py | 2 +-
.../SegmentEditorSubjectHierarchyPlugin.py | 4 +-
.../SegmentStatistics/SegmentStatistics.py | 194 ++++++++---------
.../ClosedSurfaceSegmentStatisticsPlugin.py | 6 +-
.../LabelmapSegmentStatisticsPlugin.py | 44 ++--
.../ScalarVolumeSegmentStatisticsPlugin.py | 24 +--
.../SegmentStatisticsPluginBase.py | 50 ++---
Modules/Scripted/SelfTests/SelfTests.py | 22 +-
.../VectorToScalarVolume.py | 6 +-
Modules/Scripted/WebServer/WebServer.py | 58 ++---
.../WebServerLib/DICOMRequestHandler.py | 8 +-
.../WebServerLib/SlicerRequestHandler.py | 166 +++++++--------
.../WebServerLib/StaticPagesRequestHandler.py | 4 +-
Testing/ModelRender.py | 12 +-
Testing/TextureModel.py | 18 +-
Utilities/Scripts/ModuleWizard.py | 46 ++--
Utilities/Scripts/SEMToMediaWiki.py | 4 +-
Utilities/Scripts/SlicerWizard/CMakeParser.py | 54 ++---
.../SlicerWizard/ExtensionDescription.py | 32 +--
.../Scripts/SlicerWizard/ExtensionProject.py | 30 +--
.../Scripts/SlicerWizard/ExtensionWizard.py | 28 +--
.../Scripts/SlicerWizard/GithubHelper.py | 16 +-
Utilities/Scripts/SlicerWizard/Subversion.py | 18 +-
.../Scripts/SlicerWizard/TemplateManager.py | 34 +--
Utilities/Scripts/SlicerWizard/Utilities.py | 44 ++--
.../SlicerWizard/WizardHelpFormatter.py | 6 +-
Utilities/Scripts/SlicerWizard/doc/conf.py | 134 ++++++------
Utilities/Scripts/genqrc.py | 12 +-
Utilities/Scripts/qrcc.py | 2 +-
.../Templates/Modules/Scripted/TemplateKey.py | 8 +-
.../Modules/ScriptedCLI/TemplateKey.py | 8 +-
.../SegmentEditorTemplateKey.py | 16 +-
.../SegmentEditorEffect.py | 8 +-
177 files changed, 2805 insertions(+), 2841 deletions(-)
diff --git a/.flake8 b/.flake8
index c30584c18db..cecc112d4e0 100644
--- a/.flake8
+++ b/.flake8
@@ -70,42 +70,6 @@ ignore = \
E129, \
# continuation line unaligned for hanging indent
E131, \
- # whitespace after '('
- E201, \
- # whitespace before ')'
- E202, \
- # whitespace before ','
- E203, \
- # whitespace before '('
- E211, \
- # multiple spaces before operator
- E221, \
- # multiple spaces after operator
- E222, \
- # missing whitespace around operator
- E225, \
- # missing whitespace around arithmetic operator
- E226, \
- # missing whitespace around bitwise or shift operator
- E227, \
- # missing whitespace around modulo operator
- E228, \
- # missing whitespace after ','
- E231, \
- # multiple spaces after ','
- E241, \
- # unexpected spaces around keyword / parameter equals
- E251, \
- # at least two spaces before inline comment
- E261, \
- # inline comment should start with '# '
- E262, \
- # block comment should start with '# '
- E265, \
- # too many leading '#' for block comment
- E266, \
- # multiple spaces after keyword
- E271, \
# multiple imports on one line
E401, \
# module level import not at top of file
diff --git a/Applications/SlicerApp/Testing/Python/AtlasTests.py b/Applications/SlicerApp/Testing/Python/AtlasTests.py
index f19e0a4765d..36dd5d4d1e7 100644
--- a/Applications/SlicerApp/Testing/Python/AtlasTests.py
+++ b/Applications/SlicerApp/Testing/Python/AtlasTests.py
@@ -17,10 +17,10 @@ class AtlasTests(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
- parent.title = "AtlasTests" # TODO make this more human readable by adding spaces
+ parent.title = "AtlasTests" # TODO make this more human readable by adding spaces
parent.categories = ["Testing.TestCases"]
parent.dependencies = []
- parent.contributors = ["Steve Pieper (Isomics)"] # replace with "Firstname Lastname (Org)"
+ parent.contributors = ["Steve Pieper (Isomics)"] # replace with "Firstname Lastname (Org)"
parent.helpText = """
This is a self test that downloads and displays volumetric atlases from the NA-MIC publication database.
@@ -33,7 +33,7 @@ def __init__(self, parent):
"""
parent.acknowledgementText = """
This file was originally developed by Steve Pieper, Isomics, Inc. and was partially funded by NIH grant 3P41RR013218-12S1.
-""" # replace with organization, grant and thanks.
+""" # replace with organization, grant and thanks.
#
@@ -105,7 +105,7 @@ class AtlasTestsLogic(ScriptedLoadableModuleLogic):
https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/ScriptedLoadableModule.py
"""
- def hasImageData(self,volumeNode):
+ def hasImageData(self, volumeNode):
"""This is a dummy logic method that
returns true if the passed in volume
node has valid image data
@@ -161,7 +161,7 @@ def test_AbdominalAtlasTest(self):
'uris': TESTING_DATA_URL + 'SHA256/5d315abf7d303326669c6075f9eea927eeda2e531a5b1662cfa505806cb498ea',
'checksums': 'SHA256:5d315abf7d303326669c6075f9eea927eeda2e531a5b1662cfa505806cb498ea',
}
- self.perform_AtlasTest(downloads,'I')
+ self.perform_AtlasTest(downloads, 'I')
def test_BrainAtlasTest(self):
self.delayDisplay('Running Brain Atlas Test')
@@ -171,7 +171,7 @@ def test_BrainAtlasTest(self):
'uris': TESTING_DATA_URL + 'SHA256/688ebcc6f45989795be2bcdc6b8b5bfc461f1656d677ed3ddef8c313532687f1',
'checksums': 'SHA256:688ebcc6f45989795be2bcdc6b8b5bfc461f1656d677ed3ddef8c313532687f1',
}
- self.perform_AtlasTest(downloads,'A1_grayT1')
+ self.perform_AtlasTest(downloads, 'A1_grayT1')
def test_KneeAtlasTest(self):
self.delayDisplay('Running Knee Atlas Test')
@@ -181,7 +181,7 @@ def test_KneeAtlasTest(self):
'uris': TESTING_DATA_URL + 'SHA256/5d5506c07c238918d0c892e7b04c26ad7f43684d89580780bb207d1d860b0b33',
'checksums': 'SHA256:5d5506c07c238918d0c892e7b04c26ad7f43684d89580780bb207d1d860b0b33',
}
- self.perform_AtlasTest(downloads,'I')
+ self.perform_AtlasTest(downloads, 'I')
def perform_AtlasTest(self, downloads, testVolumePattern):
""" Perform the actual atlas test.
@@ -201,7 +201,7 @@ def perform_AtlasTest(self, downloads, testVolumePattern):
volumeNode = slicer.util.getNode(pattern=testVolumePattern)
logic = AtlasTestsLogic()
- self.assertIsNotNone( logic.hasImageData(volumeNode) )
+ self.assertIsNotNone(logic.hasImageData(volumeNode))
m = slicer.util.mainWindow()
@@ -236,7 +236,7 @@ def perform_AtlasTest(self, downloads, testVolumePattern):
# collapse and change the color on the hierarchy to full red
mh.SetExpanded(0)
self.delayDisplay("Model hierarchy " + mh.GetName() + ": expanded = false")
- mhd.SetColor(1,0,0)
+ mhd.SetColor(1, 0, 0)
self.delayDisplay("Model hierarchy " + mh.GetName() + ": color = red")
# set the collapsed visibility to 0
mhd.SetVisibility(0)
@@ -257,7 +257,7 @@ def perform_AtlasTest(self, downloads, testVolumePattern):
numSceneViews = slicer.mrmlScene.GetNumberOfNodesByClass("vtkMRMLSceneViewNode")
for s in range(numSceneViews):
sv = slicer.mrmlScene.GetNthNodeByClass(s, "vtkMRMLSceneViewNode")
- self.delayDisplay("Restoring scene " + sv.GetName() + " (" + str(s+1) + "/" + str(numSceneViews) + ")")
+ self.delayDisplay("Restoring scene " + sv.GetName() + " (" + str(s + 1) + "/" + str(numSceneViews) + ")")
sv.RestoreScene()
self.delayDisplay('Test passed!')
diff --git a/Applications/SlicerApp/Testing/Python/BRAINSFitRigidRegistrationCrashIssue4139.py b/Applications/SlicerApp/Testing/Python/BRAINSFitRigidRegistrationCrashIssue4139.py
index 32cb80b8c1e..2fbc333d8b1 100644
--- a/Applications/SlicerApp/Testing/Python/BRAINSFitRigidRegistrationCrashIssue4139.py
+++ b/Applications/SlicerApp/Testing/Python/BRAINSFitRigidRegistrationCrashIssue4139.py
@@ -18,7 +18,7 @@ def __init__(self, parent):
self.parent.title = "BRAINSFit Rigid Registration vtkITKTransformConverter crash (Issue 4139)"
self.parent.categories = ["Testing.TestCases"]
self.parent.dependencies = []
- self.parent.contributors = ["Jean-Christophe Fillion-Robin (Kitware)"] # replace with "Firstname Lastname (Organization)"
+ self.parent.contributors = ["Jean-Christophe Fillion-Robin (Kitware)"] # replace with "Firstname Lastname (Organization)"
self.parent.helpText = """This test has been added to check that
Slicer does not crash in vtkITKTransformConverter after completing BRAINSFit rigid registration.
@@ -28,7 +28,7 @@ def __init__(self, parent):
self.parent.acknowledgementText = """
This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
and was partially funded by NIH grant 1U24CA194354-01.
- """ # replace with organization, grant and thanks.
+ """ # replace with organization, grant and thanks.
#
@@ -58,7 +58,7 @@ class BRAINSFitRigidRegistrationCrashIssue4139Logic(ScriptedLoadableModuleLogic)
https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/ScriptedLoadableModule.py
"""
- def hasImageData(self,volumeNode):
+ def hasImageData(self, volumeNode):
"""This is an example logic method that
returns true if the passed in volume
node has valid image data
@@ -123,11 +123,11 @@ def test_BRAINSFitRigidRegistrationCrashIssue4139(self):
slicer.mrmlScene.AddNode(outputVolume)
parameters = {
- 'fixedVolume' : fixed,
- 'movingVolume' : moving,
- 'linearTransform' : outputTransform,
- 'outputVolume' : outputVolume,
- 'useRigid' : True
+ 'fixedVolume': fixed,
+ 'movingVolume': moving,
+ 'linearTransform': outputTransform,
+ 'outputVolume': outputVolume,
+ 'useRigid': True
}
cmdLineNode = slicer.cli.runSync(slicer.modules.brainsfit, parameters=parameters)
self.assertIsNotNone(cmdLineNode)
diff --git a/Applications/SlicerApp/Testing/Python/CLIEventTest.py b/Applications/SlicerApp/Testing/Python/CLIEventTest.py
index 1cc15e5aa3f..2ce78316f9a 100644
--- a/Applications/SlicerApp/Testing/Python/CLIEventTest.py
+++ b/Applications/SlicerApp/Testing/Python/CLIEventTest.py
@@ -11,14 +11,14 @@
class CLIEventTest(ScriptedLoadableModule):
def __init__(self, parent):
- parent.title = "CLIEventTest" # TODO make this more human readable by adding spaces
+ parent.title = "CLIEventTest" # TODO make this more human readable by adding spaces
parent.categories = ["Testing.TestCases"]
parent.dependencies = ["CLI4Test"]
parent.contributors = ["Johan Andruejol (Kitware)"]
parent.helpText = """
This is a self test that tests that CLI send all the event properly.
"""
- parent.acknowledgementText = """""" # replace with organization, grant and thanks.
+ parent.acknowledgementText = """""" # replace with organization, grant and thanks.
self.parent = parent
# Add this test to the SelfTest module's list for discovery when the module
@@ -65,7 +65,7 @@ def runCLI(self, cliModule, cliNode, parameters, wait_for_completion):
cliNode = slicer.cli.run(cliModule, cliNode, parameters, wait_for_completion)
def onCLIModified(self, cliNode, event):
- print ("-- " + cliNode.GetStatusString() + ":" + cliNode.GetName())
+ print("-- " + cliNode.GetStatusString() + ":" + cliNode.GetName())
self.StatusEvents.append(cliNode.GetStatus())
if not cliNode.IsBusy():
@@ -237,7 +237,7 @@ def test_SubjectHierarchyReference(self):
self.assertEqual(shNode.GetItemParent(shNode.GetItemByDataNode(outputVolume)), shNode.GetSceneItemID())
self.delayDisplay('Run CLI module')
- cliParams = {'InputVolume': inputVolume.GetID(), 'OutputVolume': outputVolume.GetID(), 'ThresholdValue' : 100, 'ThresholdType' : 'Above'}
+ cliParams = {'InputVolume': inputVolume.GetID(), 'OutputVolume': outputVolume.GetID(), 'ThresholdValue': 100, 'ThresholdType': 'Above'}
cliNode = slicer.cli.run(slicer.modules.thresholdscalarvolume, None, cliParams, wait_for_completion=True)
# After CLI execution is completed, output volume must be in the same folder as the referenced node
diff --git a/Applications/SlicerApp/Testing/Python/CLISerializationTest.py b/Applications/SlicerApp/Testing/Python/CLISerializationTest.py
index bc2e0ea3296..ac1dcae3d31 100644
--- a/Applications/SlicerApp/Testing/Python/CLISerializationTest.py
+++ b/Applications/SlicerApp/Testing/Python/CLISerializationTest.py
@@ -70,11 +70,11 @@ def deserializeCLI(self, cli_name, json_file_path, parameters=[]):
temp_dir = os.path.expanduser(getattr(args, "/path/to/temp_dir"))
# Create input/output
- serializeSeedsOutFile = '%s/%s.acsv' %(temp_dir, 'SeedsSerialized')
- deserializeSeedsOutFile = '%s/%s.acsv' %(temp_dir, 'SeedsDeSerialized')
- json_file = '%s/%s.json' %(temp_dir, 'ExecutionModelTourSerialized')
+ serializeSeedsOutFile = '%s/%s.acsv' % (temp_dir, 'SeedsSerialized')
+ deserializeSeedsOutFile = '%s/%s.acsv' % (temp_dir, 'SeedsDeSerialized')
+ json_file = '%s/%s.json' % (temp_dir, 'ExecutionModelTourSerialized')
- #Copy .mrml file to prevent modification of source tree
+ # Copy .mrml file to prevent modification of source tree
mrml_source_path = os.path.join(data_dir, 'ExecutionModelTourTest.mrml')
mrml_dest_path = os.path.join(temp_dir, 'ExecutionModelTourTestPython.mrml')
shutil.copyfile(mrml_source_path, mrml_dest_path)
@@ -84,8 +84,8 @@ def deserializeCLI(self, cli_name, json_file_path, parameters=[]):
EMTSerializer.SlicerExecutable = slicer_executable
CLIName = 'ExecutionModelTour'
required_inputs = [
- '--transform1', '%s/ExecutionModelTourTestPython.mrml#vtkMRMLLinearTransformNode1'%(temp_dir),
- '--transform2', '%s/ExecutionModelTourTestPython.mrml#vtkMRMLLinearTransformNode2'%(temp_dir),
+ '--transform1', '%s/ExecutionModelTourTestPython.mrml#vtkMRMLLinearTransformNode1' % (temp_dir),
+ '--transform2', '%s/ExecutionModelTourTestPython.mrml#vtkMRMLLinearTransformNode2' % (temp_dir),
mrHeadResampled,
ctHeadAxial,
]
@@ -106,93 +106,93 @@ def deserializeCLI(self, cli_name, json_file_path, parameters=[]):
# Serialize the CLI
(returncode, serializeErr, serializeOut) = EMTSerializer.serializeCLI(CLIName, json_file, parameters)
if returncode != EXIT_SUCCESS:
- print("Problem while serializing the CLI: %s" %serializeErr)
+ print("Problem while serializing the CLI: %s" % serializeErr)
exit(EXIT_FAILURE)
# Make sure the Json is generated correctly
expected_json = {
- "Parameters" :
+ "Parameters":
{
- "Boolean Parameters" :
+ "Boolean Parameters":
{
- "boolean1" : True,
- "boolean2" : False,
- "boolean3" : False
+ "boolean1": True,
+ "boolean2": False,
+ "boolean3": False
},
- "Enumeration Parameters" :
+ "Enumeration Parameters":
{
- "stringChoice" : "Bill"
+ "stringChoice": "Bill"
},
- "File, Directory and Image Parameters" :
+ "File, Directory and Image Parameters":
{
- "directory1" : "",
- "file1" : "",
- "files" : [ "1.does", "2.not", "3.matter" ],
- "image1" : "",
- "image2" : "",
- "outputFile1" : ""
+ "directory1": "",
+ "file1": "",
+ "files": ["1.does", "2.not", "3.matter"],
+ "image1": "",
+ "image2": "",
+ "outputFile1": ""
},
- "Generic Tables" :
+ "Generic Tables":
{
- "inputDT" : "",
- "outputDT" : ""
+ "inputDT": "",
+ "outputDT": ""
},
- "Geometry Parameters" :
+ "Geometry Parameters":
{
- "InputModel" : "",
- "ModelSceneFile" : [],
- "OutputModel" : ""
+ "InputModel": "",
+ "ModelSceneFile": [],
+ "OutputModel": ""
},
- "Index Parameters" :
+ "Index Parameters":
{
- "arg0" : mrHeadResampled,
- "arg1" : ctHeadAxial
+ "arg0": mrHeadResampled,
+ "arg1": ctHeadAxial
},
- "Measurements" :
+ "Measurements":
{
- "inputFA" : "",
- "outputFA" : ""
+ "inputFA": "",
+ "outputFA": ""
},
- "Point Parameters" :
+ "Point Parameters":
{
- "seed" : [[1.0,0.0,-1.0]],
- "seedsFile" : "",
- "seedsOutFile" : serializeSeedsOutFile,
+ "seed": [[1.0, 0.0, -1.0]],
+ "seedsFile": "",
+ "seedsOutFile": serializeSeedsOutFile,
},
- "Regions of interest" :
+ "Regions of interest":
{
- "regions" : []
+ "regions": []
},
- "Scalar Parameters (\u00e1rv\u00edzt\u0171r\u0151 t\u00fck\u00f6rf\u00far\u00f3g\u00e9p)" :
+ "Scalar Parameters (\u00e1rv\u00edzt\u0171r\u0151 t\u00fck\u00f6rf\u00far\u00f3g\u00e9p)":
{
- "doubleVariable" : 30,
- "integerVariable" : 30
+ "doubleVariable": 30,
+ "integerVariable": 30
},
- "Simple return types" :
+ "Simple return types":
{
- "abooleanreturn" : False,
- "adoublereturn" : 14,
- "afloatreturn" : 7,
- "anintegerreturn" : 5,
- "anintegervectorreturn" : [],
- "astringchoicereturn" : "Bill",
- "astringreturn" : "Hello"
+ "abooleanreturn": False,
+ "adoublereturn": 14,
+ "afloatreturn": 7,
+ "anintegerreturn": 5,
+ "anintegervectorreturn": [],
+ "astringchoicereturn": "Bill",
+ "astringreturn": "Hello"
},
- "Transform Parameters" :
+ "Transform Parameters":
{
- "transform1" : "%s/ExecutionModelTourTestPython.mrml#vtkMRMLLinearTransformNode1"%(temp_dir),
- "transform2" : "%s/ExecutionModelTourTestPython.mrml#vtkMRMLLinearTransformNode2"%(temp_dir),
- "transformInput" : "",
- "transformInputBspline" : "",
- "transformInputNonlinear" : "",
- "transformOutput" : "",
- "transformOutputBspline" : "",
- "transformOutputNonlinear" : ""
+ "transform1": "%s/ExecutionModelTourTestPython.mrml#vtkMRMLLinearTransformNode1" % (temp_dir),
+ "transform2": "%s/ExecutionModelTourTestPython.mrml#vtkMRMLLinearTransformNode2" % (temp_dir),
+ "transformInput": "",
+ "transformInputBspline": "",
+ "transformInputNonlinear": "",
+ "transformOutput": "",
+ "transformOutputBspline": "",
+ "transformOutputNonlinear": ""
},
- "Vector Parameters" :
+ "Vector Parameters":
{
- "floatVector" : [ 1.2999999523162842, 2, -14 ],
- "stringVector" : [ "foo", "bar", "foobar" ]
+ "floatVector": [1.2999999523162842, 2, -14],
+ "stringVector": ["foo", "bar", "foobar"]
}
}
}
@@ -201,11 +201,11 @@ def deserializeCLI(self, cli_name, json_file_path, parameters=[]):
data = json.load(file)
if data != expected_json:
print('Json comparison failed !')
- expected_json_filename = temp_dir+'/ExecutionModelTourSerializedBaseline.json'
+ expected_json_filename = temp_dir + '/ExecutionModelTourSerializedBaseline.json'
print("Expected json: " + expected_json_filename)
with open(expected_json_filename, 'w', encoding='utf8') as outfile:
json.dump(expected_json, outfile, indent="\t", ensure_ascii=False)
- actual_json_filename = temp_dir+'/ExecutionModelTourSerializedActual.json'
+ actual_json_filename = temp_dir + '/ExecutionModelTourSerializedActual.json'
print("Actual json: " + actual_json_filename)
with open(actual_json_filename, 'w', encoding='utf8') as outfile:
json.dump(data, outfile, indent="\t", ensure_ascii=False)
@@ -217,7 +217,7 @@ def deserializeCLI(self, cli_name, json_file_path, parameters=[]):
]
(returncode, deserializeErr, deserializeOut) = EMTSerializer.deserializeCLI(CLIName, json_file, parameters)
if returncode != EXIT_SUCCESS:
- print("Problem while deserializing the CLI: %s" %deserializeErr)
+ print("Problem while deserializing the CLI: %s" % deserializeErr)
exit(EXIT_FAILURE)
# Finally compare seeds file
@@ -233,9 +233,9 @@ def deserializeCLI(self, cli_name, json_file_path, parameters=[]):
for i in range(len(serializedRows)):
if serializedRows[i] != deserializedRows[i]:
- print('Row #%s comparison failed:' %i)
- print('Serialize row: %s' %serializedRows[i])
- print('Deserialize row: %s' %deserializedRows[i])
+ print('Row #%s comparison failed:' % i)
+ print('Serialize row: %s' % serializedRows[i])
+ print('Deserialize row: %s' % deserializedRows[i])
exit(EXIT_FAILURE)
try:
diff --git a/Applications/SlicerApp/Testing/Python/DCMTKPrivateDictTest.py b/Applications/SlicerApp/Testing/Python/DCMTKPrivateDictTest.py
index fb8c2f9f8f9..cd606b48289 100644
--- a/Applications/SlicerApp/Testing/Python/DCMTKPrivateDictTest.py
+++ b/Applications/SlicerApp/Testing/Python/DCMTKPrivateDictTest.py
@@ -4,8 +4,8 @@
dcmfile = sys.argv[1]
-dcmdump=DICOMLib.DICOMCommand('dcmdump',[dcmfile])
-dump=str(dcmdump.start()).replace("\\r","\r").replace("\\n","\n").splitlines()
+dcmdump = DICOMLib.DICOMCommand('dcmdump', [dcmfile])
+dump = str(dcmdump.start()).replace("\\r", "\r").replace("\\n", "\n").splitlines()
found_private_tag = False
for line in dump:
diff --git a/Applications/SlicerApp/Testing/Python/DICOMReaders.py b/Applications/SlicerApp/Testing/Python/DICOMReaders.py
index ea5015d727a..bf141b8763e 100644
--- a/Applications/SlicerApp/Testing/Python/DICOMReaders.py
+++ b/Applications/SlicerApp/Testing/Python/DICOMReaders.py
@@ -26,7 +26,7 @@ def __init__(self, parent):
"""
parent.acknowledgementText = """This work is supported primarily by the National Institutes of Health, National Cancer Institute, Informatics Technology for Cancer Research (ITCR) program, grant Quantitative Image Informatics for Cancer Research (QIICR) (U24 CA180918, PIs Kikinis and Fedorov). We also acknowledge support of the following grants: Neuroimage Analysis Center (NAC) (P41 EB015902, PI Kikinis) and National Center for Image Guided Therapy (NCIGT) (P41 EB015898, PI Tempany).
This file was originally developed by Steve Pieper, Isomics, Inc.
-""" # replace with organization, grant and thanks.
+""" # replace with organization, grant and thanks.
#
@@ -71,7 +71,7 @@ def test_AlternateReaders(self):
self.delayDisplay("Starting the DICOM test")
referenceData = [
- { "url": TESTING_DATA_URL + "SHA256/3450ef9372a3460a2f181c8d3bb35a74b4f0acb10c6e18cfcf7804e1d99bf843",
+ {"url": TESTING_DATA_URL + "SHA256/3450ef9372a3460a2f181c8d3bb35a74b4f0acb10c6e18cfcf7804e1d99bf843",
"checksum": "SHA256:3450ef9372a3460a2f181c8d3bb35a74b4f0acb10c6e18cfcf7804e1d99bf843",
"fileName": "Mouse-MR-example-where-GDCM_fails.zip",
"name": "Mouse-MR-example-where-GDCM_fails",
@@ -82,7 +82,7 @@ def test_AlternateReaders(self):
"voxelValueQuantity": "(110852, DCM, \"MR signal intensity\")",
"voxelValueUnits": "(1, UCUM, \"no units\")"
},
- { "url": TESTING_DATA_URL + "SHA256/899f3f8617ca53bad7dca0b2908478319e708b48ff41dfa64b6bac1d76529928",
+ {"url": TESTING_DATA_URL + "SHA256/899f3f8617ca53bad7dca0b2908478319e708b48ff41dfa64b6bac1d76529928",
"checksum": "SHA256:899f3f8617ca53bad7dca0b2908478319e708b48ff41dfa64b6bac1d76529928",
"fileName": "deidentifiedMRHead-dcm-one-series.zip",
"name": "deidentifiedMRHead-dcm-one-series",
@@ -95,12 +95,12 @@ def test_AlternateReaders(self):
# another dataset that could be added in the future - currently fails for all readers
# due to invalid format - see https://issues.slicer.org/view.php?id=3569
- #{ "url": TESTING_DATA_URL + "SHA256/4cbd051dc249ea47d0f7b4147ea8340ba11a4a18a1771d37c387e40538374cab",
- #"fileName": "RIDER_bug.zip",
- #"name": "RIDER_bug",
- #"seriesUID": "1.3.6.1.4.1.9328.50.7.261772317324041365541450388603508531852",
- #"expectedFailures": []
- #}
+ # { "url": TESTING_DATA_URL + "SHA256/4cbd051dc249ea47d0f7b4147ea8340ba11a4a18a1771d37c387e40538374cab",
+ # "fileName": "RIDER_bug.zip",
+ # "name": "RIDER_bug",
+ # "seriesUID": "1.3.6.1.4.1.9328.50.7.261772317324041365541450388603508531852",
+ # "expectedFailures": []
+ # }
loadingResult = {}
#
@@ -153,7 +153,7 @@ def test_AlternateReaders(self):
for readerApproach in readerApproaches:
self.delayDisplay('Loading Selection with approach: %s' % readerApproach)
loadable.name = basename + "-" + readerApproach
- volumeNode = scalarVolumePlugin.load(loadable,readerApproach)
+ volumeNode = scalarVolumePlugin.load(loadable, readerApproach)
if not volumeNode and readerApproach not in dataset['expectedFailures']:
raise Exception("Expected to be able to read with %s, but couldn't" % readerApproach)
if volumeNode and readerApproach in dataset['expectedFailures']:
@@ -177,14 +177,14 @@ def test_AlternateReaders(self):
for approachIndex in range(len(approachesThatLoaded)):
firstApproach = approachesThatLoaded[approachIndex]
firstVolume = volumesByApproach[firstApproach]
- for secondApproachIndex in range(approachIndex+1,len(approachesThatLoaded)):
+ for secondApproachIndex in range(approachIndex + 1, len(approachesThatLoaded)):
secondApproach = approachesThatLoaded[secondApproachIndex]
secondVolume = volumesByApproach[secondApproach]
print(f'comparing {firstApproach},{secondApproach}')
- comparison = slicer.modules.dicomPlugins['DICOMScalarVolumePlugin'].compareVolumeNodes(firstVolume,secondVolume)
+ comparison = slicer.modules.dicomPlugins['DICOMScalarVolumePlugin'].compareVolumeNodes(firstVolume, secondVolume)
if comparison != "":
print(('failed: %s', comparison))
- failedComparisons[firstApproach,secondApproach] = comparison
+ failedComparisons[firstApproach, secondApproach] = comparison
if len(failedComparisons.keys()) > 0:
raise Exception("Loaded volumes don't match: %s" % failedComparisons)
diff --git a/Applications/SlicerApp/Testing/Python/DWMRIMultishellIOTests.py b/Applications/SlicerApp/Testing/Python/DWMRIMultishellIOTests.py
index 5e0c2178ed5..d691bc44ddc 100644
--- a/Applications/SlicerApp/Testing/Python/DWMRIMultishellIOTests.py
+++ b/Applications/SlicerApp/Testing/Python/DWMRIMultishellIOTests.py
@@ -9,21 +9,21 @@
import slicer
-#===============================================================================
+# ===============================================================================
mrmlcore_testdata_path = "Libs/MRML/Core/Testing/TestData/"
multishell_dwi_451 = os.path.join(mrmlcore_testdata_path, "multishell-DWI-451dir.nhdr")
-#================================================================================
+# ================================================================================
NRRD = namedtuple('NRRD', ['header', 'bvalue', 'gradients'])
def parse_nhdr(path):
- dwmri_bval_key = "DWMRI_b-value"
- dwmri_grad_keybase = "DWMRI_gradient_"
- dwmri_grad_key_n = "DWMRI_gradient_{:04d}"
+ dwmri_bval_key = "DWMRI_b-value"
+ dwmri_grad_keybase = "DWMRI_gradient_"
+ dwmri_grad_key_n = "DWMRI_gradient_{:04d}"
kvdict = {}
grad_count = 0
@@ -44,9 +44,9 @@ def parse_nhdr(path):
kvdict[key] = val
if key.startswith(dwmri_grad_keybase):
- _gn = int(key[ len(dwmri_grad_keybase):None ])
+ _gn = int(key[len(dwmri_grad_keybase):None])
# monotonic keys
- assert( _gn == grad_count ) # offset
+ assert(_gn == grad_count) # offset
grad_count += 1
bvalue = float(kvdict[dwmri_bval_key])
@@ -60,13 +60,13 @@ def parse_nhdr(path):
return NRRD(header=kvdict, bvalue=bvalue, gradients=grads)
-#================================================================================
+# ================================================================================
def normalize(vec):
norm = np.linalg.norm(vec)
if norm == 0.0:
return vec
else:
- return vec * 1/norm
+ return vec * 1 / norm
def test_nrrd_dwi_load(first_file, second_file=None):
@@ -94,7 +94,7 @@ def test_nrrd_dwi_load(first_file, second_file=None):
##################################
# 1) check the number of gradients
- assert( len(parsed_nrrd.gradients) == slicer_numgrads )
+ assert(len(parsed_nrrd.gradients) == slicer_numgrads)
##################################
# 2) check the node b values and gradients are correct
@@ -126,7 +126,7 @@ def test_nrrd_dwi_load(first_file, second_file=None):
for i in range(0, slicer_numgrads):
grad_key = f"DWMRI_gradient_{i:04d}"
parsed_gradient = np.fromstring(parsed_nrrd.header[grad_key], count=3, sep=' ', dtype=np.float64)
- attr_gradient = np.fromstring(dw_node.GetAttribute(grad_key), count=3, sep=' ', dtype=np.float64)
+ attr_gradient = np.fromstring(dw_node.GetAttribute(grad_key), count=3, sep=' ', dtype=np.float64)
np.testing.assert_array_almost_equal(parsed_gradient, attr_gradient, decimal=12,
err_msg="NHDR gradient does not match gradient in node attribute dictionary")
diff --git a/Applications/SlicerApp/Testing/Python/FiducialLayoutSwitchBug1914.py b/Applications/SlicerApp/Testing/Python/FiducialLayoutSwitchBug1914.py
index 99cf4f50a63..5993ff0cec6 100644
--- a/Applications/SlicerApp/Testing/Python/FiducialLayoutSwitchBug1914.py
+++ b/Applications/SlicerApp/Testing/Python/FiducialLayoutSwitchBug1914.py
@@ -51,7 +51,7 @@ class FiducialLayoutSwitchBug1914Logic(ScriptedLoadableModuleLogic):
def __init__(self):
ScriptedLoadableModuleLogic.__init__(self)
- def getPointSliceDisplayableManagerHelper(self,sliceName='Red'):
+ def getPointSliceDisplayableManagerHelper(self, sliceName='Red'):
sliceWidget = slicer.app.layoutManager().sliceWidget(sliceName)
sliceView = sliceWidget.sliceView()
collection = vtk.vtkCollection()
@@ -127,7 +127,7 @@ def test_FiducialLayoutSwitchBug1914(self):
handleRep = seedRepresentation.GetHandleRepresentation(fidIndex)
startingSeedDisplayCoords = handleRep.GetDisplayPosition()
print('Starting seed display coords = %d, %d, %d' % (startingSeedDisplayCoords[0], startingSeedDisplayCoords[1], startingSeedDisplayCoords[2]))
- self.takeScreenshot('FiducialLayoutSwitchBug1914-StartingPosition','Point starting position',slicer.qMRMLScreenShotDialog.Red)
+ self.takeScreenshot('FiducialLayoutSwitchBug1914-StartingPosition', 'Point starting position', slicer.qMRMLScreenShotDialog.Red)
# Switch to red slice only
lm.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutOneUpRedSliceView)
@@ -148,10 +148,10 @@ def test_FiducialLayoutSwitchBug1914(self):
handleRep = seedRepresentation.GetHandleRepresentation(fidIndex)
endingSeedDisplayCoords = handleRep.GetDisplayPosition()
print('Ending seed display coords = %d, %d, %d' % (endingSeedDisplayCoords[0], endingSeedDisplayCoords[1], endingSeedDisplayCoords[2]))
- self.takeScreenshot('FiducialLayoutSwitchBug1914-EndingPosition','Point ending position',slicer.qMRMLScreenShotDialog.Red)
+ self.takeScreenshot('FiducialLayoutSwitchBug1914-EndingPosition', 'Point ending position', slicer.qMRMLScreenShotDialog.Red)
# Compare to original seed widget location
- diff = math.pow((startingSeedDisplayCoords[0] - endingSeedDisplayCoords[0]),2) + math.pow((startingSeedDisplayCoords[1] - endingSeedDisplayCoords[1]),2) + math.pow((startingSeedDisplayCoords[2] - endingSeedDisplayCoords[2]),2)
+ diff = math.pow((startingSeedDisplayCoords[0] - endingSeedDisplayCoords[0]), 2) + math.pow((startingSeedDisplayCoords[1] - endingSeedDisplayCoords[1]), 2) + math.pow((startingSeedDisplayCoords[2] - endingSeedDisplayCoords[2]), 2)
if diff != 0.0:
diff = math.sqrt(diff)
self.delayDisplay("Difference between starting and ending seed display coordinates = %g" % diff)
@@ -160,13 +160,13 @@ def test_FiducialLayoutSwitchBug1914(self):
# double check against the RAS coordinates of the underlying volume since the display could have changed with a FOV adjustment.
sliceView = sliceWidget.sliceView()
volumeRAS = sliceView.convertXYZToRAS(endingSeedDisplayCoords)
- seedRAS = [0,0,0]
- markupNode.GetNthControlPointPosition(0,seedRAS)
- rasDiff = math.pow((seedRAS[0] - volumeRAS[0]),2) + math.pow((seedRAS[1] - volumeRAS[1]),2) + math.pow((seedRAS[2] - volumeRAS[2]),2)
+ seedRAS = [0, 0, 0]
+ markupNode.GetNthControlPointPosition(0, seedRAS)
+ rasDiff = math.pow((seedRAS[0] - volumeRAS[0]), 2) + math.pow((seedRAS[1] - volumeRAS[1]), 2) + math.pow((seedRAS[2] - volumeRAS[2]), 2)
if rasDiff != 0.0:
rasDiff = math.sqrt(rasDiff)
- print('Checking the difference between point RAS position',seedRAS,
- 'and volume RAS as derived from the point display position',volumeRAS,': ',rasDiff)
+ print('Checking the difference between point RAS position', seedRAS,
+ 'and volume RAS as derived from the point display position', volumeRAS, ': ', rasDiff)
if rasDiff > maximumRASDifference:
raise Exception(f"RAS coordinate difference is too large as well!\nExpected < {maximumRASDifference:g} but got {rasDiff:g}")
else:
diff --git a/Applications/SlicerApp/Testing/Python/JRC2013Vis.py b/Applications/SlicerApp/Testing/Python/JRC2013Vis.py
index f9ec5c5d9c7..d82181742b3 100644
--- a/Applications/SlicerApp/Testing/Python/JRC2013Vis.py
+++ b/Applications/SlicerApp/Testing/Python/JRC2013Vis.py
@@ -16,16 +16,16 @@
class JRC2013Vis(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
- parent.title = "JRC2013Vis" # TODO make this more human readable by adding spaces
+ parent.title = "JRC2013Vis" # TODO make this more human readable by adding spaces
parent.categories = ["Testing.TestCases"]
parent.dependencies = []
- parent.contributors = ["Nicholas Herlambang (AZE R&D)"] # replace with "Firstname Lastname (Org)"
+ parent.contributors = ["Nicholas Herlambang (AZE R&D)"] # replace with "Firstname Lastname (Org)"
parent.helpText = """
This module was developed as a self test to perform the operations needed for the JRC 2013 Visualization Tutorial
"""
parent.acknowledgementText = """
This file was originally developed by Steve Pieper, Isomics, Inc. and was partially funded by NIH grant 3P41RR013218-12S1.
-""" # replace with organization, grant and thanks.
+""" # replace with organization, grant and thanks.
#
@@ -53,8 +53,8 @@ def setup(self):
formLayout = qt.QFormLayout(testsCollapsibleButton)
# test buttons
- tests = ( ("Part 1: DICOM",self.onPart1DICOM),("Part 2: Head", self.onPart2Head),("Part 3: Liver", self.onPart3Liver),("Part 4: Lung", self.onPart4Lung),)
- for text,slot in tests:
+ tests = (("Part 1: DICOM", self.onPart1DICOM), ("Part 2: Head", self.onPart2Head), ("Part 3: Liver", self.onPart3Liver), ("Part 4: Lung", self.onPart4Lung),)
+ for text, slot in tests:
testButton = qt.QPushButton(text)
testButton.toolTip = "Run the test."
formLayout.addWidget(testButton)
@@ -83,7 +83,7 @@ def onPart4Lung(self):
tester.setUp()
tester.test_Part4Lung()
- def onStartStopDicomPeer(self,flag):
+ def onStartStopDicomPeer(self, flag):
if flag:
self.startStopDicomPeerButton.setEnabled(False)
dicomFilesDirectory = slicer.app.temporaryPath
@@ -197,8 +197,8 @@ def test_Part1DICOM(self):
import os
configFilePath = dicomFilesDirectory + '/Dcmtk-db/dcmqrscp.cfg'
processCurrentPath = dicomFilesDirectory + '/Dcmtk-db/'
- print("configFilePath: "+os.path.abspath(configFilePath))
- print("processCurrentPath: "+os.path.abspath(processCurrentPath))
+ print("configFilePath: " + os.path.abspath(configFilePath))
+ print("processCurrentPath: " + os.path.abspath(processCurrentPath))
dcmqrscpExeOptions = (
'/bin',
@@ -249,20 +249,20 @@ def test_Part1DICOM(self):
self.delayDisplay('Change Level')
layoutManager = slicer.app.layoutManager()
redWidget = layoutManager.sliceWidget('Red')
- slicer.util.clickAndDrag(redWidget,start=(10,10),end=(10,40))
+ slicer.util.clickAndDrag(redWidget, start=(10, 10), end=(10, 40))
self.delayDisplay('Change Window')
- slicer.util.clickAndDrag(redWidget,start=(10,10),end=(40,10))
+ slicer.util.clickAndDrag(redWidget, start=(10, 10), end=(40, 10))
self.delayDisplay('Change Layout')
layoutManager = slicer.app.layoutManager()
layoutManager.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutOneUpRedSliceView)
self.delayDisplay('Zoom')
- slicer.util.clickAndDrag(redWidget,button='Right',start=(10,10),end=(10,40))
+ slicer.util.clickAndDrag(redWidget, button='Right', start=(10, 10), end=(10, 40))
self.delayDisplay('Pan')
- slicer.util.clickAndDrag(redWidget,button='Middle',start=(10,10),end=(40,40))
+ slicer.util.clickAndDrag(redWidget, button='Middle', start=(10, 10), end=(40, 40))
self.delayDisplay('Center')
redWidget.sliceController().fitSliceToBackground()
@@ -280,7 +280,7 @@ def test_Part1DICOM(self):
layoutManager.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutFourUpView)
self.delayDisplay('Shift Mouse')
- slicer.util.clickAndDrag(redWidget,button='None',start=(100,100),end=(140,140),modifiers=['Shift'])
+ slicer.util.clickAndDrag(redWidget, button='None', start=(100, 100), end=(140, 140), modifiers=['Shift'])
self.delayDisplay('Conventional, Link, Slice Model')
layoutManager.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutConventionalView)
@@ -293,7 +293,7 @@ def test_Part1DICOM(self):
self.delayDisplay('Zoom')
threeDView = layoutManager.threeDWidget(0).threeDView()
- slicer.util.clickAndDrag(threeDView,button='Right')
+ slicer.util.clickAndDrag(threeDView, button='Right')
self.delayDisplay('Test passed!')
except Exception as e:
@@ -327,9 +327,9 @@ def test_Part2Head(self):
mainWindow = slicer.util.mainWindow()
layoutManager = slicer.app.layoutManager()
threeDView = layoutManager.threeDWidget(0).threeDView()
- redWidget = layoutManager.sliceWidget('vtkMRMLSliceNode1') # it would be 'Red' in a recent scene
+ redWidget = layoutManager.sliceWidget('vtkMRMLSliceNode1') # it would be 'Red' in a recent scene
redController = redWidget.sliceController()
- greenWidget = layoutManager.sliceWidget('vtkMRMLSliceNode2') # it would be 'Green' in a recent scene
+ greenWidget = layoutManager.sliceWidget('vtkMRMLSliceNode2') # it would be 'Green' in a recent scene
greenController = greenWidget.sliceController()
self.delayDisplay('Models and Slice Model')
@@ -337,7 +337,7 @@ def test_Part2Head(self):
redWidget.sliceController().setSliceVisible(True)
self.delayDisplay('Scroll Slices')
- for offset in range(-20,20,2):
+ for offset in range(-20, 20, 2):
redController.setSliceOffsetValue(offset)
self.delayDisplay('Skin Opacity')
@@ -372,7 +372,7 @@ def test_Part2Head(self):
self.delayDisplay('Zoom')
threeDView = layoutManager.threeDWidget(0).threeDView()
- slicer.util.clickAndDrag(threeDView,button='Right')
+ slicer.util.clickAndDrag(threeDView, button='Right')
self.delayDisplay('Test passed!')
except Exception as e:
@@ -412,7 +412,7 @@ def test_Part3Liver(self):
mainWindow.moduleSelector().selectModule('Models')
segmentII = slicer.util.getNode('LiverSegment_II')
segmentII.GetDisplayNode().SetVisibility(0)
- slicer.util.clickAndDrag(threeDView,start=(10,200),end=(10,10))
+ slicer.util.clickAndDrag(threeDView, start=(10, 200), end=(10, 10))
self.delayDisplay('Segment II visible')
segmentII.GetDisplayNode().SetVisibility(1)
@@ -433,7 +433,7 @@ def test_Part3Liver(self):
modelNode.GetDisplayNode().SetVisibility(0)
segmentVII = slicer.util.getNode('LiverSegment_II')
- transparentNodes = ('MiddleHepaticVein_and_Branches','LiverSegment_IVb','LiverSegmentV',)
+ transparentNodes = ('MiddleHepaticVein_and_Branches', 'LiverSegment_IVb', 'LiverSegmentV',)
for nodeName in transparentNodes:
modelNode = slicer.util.getNode(nodeName)
modelNode.GetDisplayNode().SetOpacity(0.5)
diff --git a/Applications/SlicerApp/Testing/Python/MRMLCreateNodeByClassWithSetReferenceCountMinusOne.py b/Applications/SlicerApp/Testing/Python/MRMLCreateNodeByClassWithSetReferenceCountMinusOne.py
index df7984a56ae..839e490fc35 100644
--- a/Applications/SlicerApp/Testing/Python/MRMLCreateNodeByClassWithSetReferenceCountMinusOne.py
+++ b/Applications/SlicerApp/Testing/Python/MRMLCreateNodeByClassWithSetReferenceCountMinusOne.py
@@ -3,7 +3,7 @@
def testMRMLCreateNodeByClassWithSetReferenceCountMinusOne():
n = slicer.mrmlScene.CreateNodeByClass('vtkMRMLViewNode')
- n.UnRegister(None) # the node object is now owned by n Python variable therefore we can release the reference that CreateNodeByClass added
+ n.UnRegister(None) # the node object is now owned by n Python variable therefore we can release the reference that CreateNodeByClass added
slicer.mrmlScene.AddNode(n)
diff --git a/Applications/SlicerApp/Testing/Python/MeasureStartupTimes.py b/Applications/SlicerApp/Testing/Python/MeasureStartupTimes.py
index c31c9f5c196..0f06703153f 100755
--- a/Applications/SlicerApp/Testing/Python/MeasureStartupTimes.py
+++ b/Applications/SlicerApp/Testing/Python/MeasureStartupTimes.py
@@ -44,7 +44,7 @@ def TemporaryPythonScript(code, *args, **kwargs):
def collect_startup_times_normal(output_file, drop_cache=False, display_output=False):
- results= {}
+ results = {}
test = []
(duration, result) = runSlicerAndExitWithTime(slicer_executable, test, drop_cache=drop_cache)
(returnCode, stdout, stderr) = result
@@ -58,7 +58,7 @@ def collect_startup_times_normal(output_file, drop_cache=False, display_output=F
def collect_startup_times_overall(output_file, drop_cache=False, display_output=False):
- results= {}
+ results = {}
test = ["--help"]
(duration, result) = runSlicerAndExitWithTime(slicer_executable, test, drop_cache=drop_cache)
@@ -173,7 +173,7 @@ def collect_startup_times_excluding_one_module(output_file, module_list, drop_ca
# Collect startup times disabling each module one by one
moduleTimes = {}
for (idx, (moduleName, moduleType)) in enumerate(modules.iteritems(), start=1):
- #if moduleType == "CLI":
+ # if moduleType == "CLI":
# print("=> Skipping CLI [%s]\n" % moduleName)
# continue
print("[%d/%d]" % (idx, len(modules)))
@@ -207,7 +207,7 @@ def collect_startup_times_modules_to_load(output_file, modules_to_load, module_l
if stdout: print("STDOUT [%s]\n" % stdout)
if stderr and returnCode == EXIT_SUCCESS: print("STDERR [%s]\n" % stderr)
- results= {}
+ results = {}
results[" ".join(modulesToIgnore)] = duration
with open(output_file, 'w') as file:
file.write(json.dumps(results, indent=4))
@@ -223,7 +223,7 @@ def collect_startup_times_modules_to_load(output_file, modules_to_load, module_l
parser.add_argument("--excluding-one-module", action="store_true")
parser.add_argument("--including-one-module", action="store_true")
# Common options
- parser.add_argument("-n", "--repeat", default=1, type=int)
+ parser.add_argument("-n", "--repeat", default=1, type=int)
parser.add_argument("--drop-cache", action="store_true")
parser.add_argument("--reuse-module-list", action="store_true")
parser.add_argument("--display-slicer-output", action="store_true")
diff --git a/Applications/SlicerApp/Testing/Python/RSNA2012ProstateDemo.py b/Applications/SlicerApp/Testing/Python/RSNA2012ProstateDemo.py
index 5ca2305f052..46c6bc93000 100644
--- a/Applications/SlicerApp/Testing/Python/RSNA2012ProstateDemo.py
+++ b/Applications/SlicerApp/Testing/Python/RSNA2012ProstateDemo.py
@@ -14,16 +14,16 @@ class RSNA2012ProstateDemo(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
- parent.title = "RSNA2012ProstateDemo" # TODO make this more human readable by adding spaces
+ parent.title = "RSNA2012ProstateDemo" # TODO make this more human readable by adding spaces
parent.categories = ["Testing.TestCases"]
parent.dependencies = []
- parent.contributors = ["Steve Pieper (Isomics)"] # replace with "Firstname Lastname (Org)"
+ parent.contributors = ["Steve Pieper (Isomics)"] # replace with "Firstname Lastname (Org)"
parent.helpText = """
This module was developed as a self test to perform the operations needed for the RSNA 2012 Prostate Demo
"""
parent.acknowledgementText = """
This file was originally developed by Steve Pieper, Isomics, Inc. and was partially funded by NIH grant 3P41RR013218-12S1.
-""" # replace with organization, grant and thanks.
+""" # replace with organization, grant and thanks.
#
@@ -78,8 +78,8 @@ def test_RSNA2012ProstateDemo(self):
svns = slicer.util.getNodes('vtkMRMLSceneViewNode*')
for reps in range(5):
- for svname,svnode in svns.items():
- self.delayDisplay('Restoring scene view %s ...' % svname )
+ for svname, svnode in svns.items():
+ self.delayDisplay('Restoring scene view %s ...' % svname)
svnode.RestoreScene()
self.delayDisplay('OK')
diff --git a/Applications/SlicerApp/Testing/Python/RSNAQuantTutorial.py b/Applications/SlicerApp/Testing/Python/RSNAQuantTutorial.py
index 67baf45f3a8..9ca47ad13f2 100644
--- a/Applications/SlicerApp/Testing/Python/RSNAQuantTutorial.py
+++ b/Applications/SlicerApp/Testing/Python/RSNAQuantTutorial.py
@@ -17,16 +17,16 @@ class RSNAQuantTutorial(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
- parent.title = "RSNAQuantTutorial" # TODO make this more human readable by adding spaces
+ parent.title = "RSNAQuantTutorial" # TODO make this more human readable by adding spaces
parent.categories = ["Testing.TestCases"]
parent.dependencies = []
- parent.contributors = ["Steve Pieper (Isomics)"] # replace with "Firstname Lastname (Org)"
+ parent.contributors = ["Steve Pieper (Isomics)"] # replace with "Firstname Lastname (Org)"
parent.helpText = """
This module was developed as a self test to perform the operations needed for the RSNA 2012 Quantitative Imaging Tutorial
"""
parent.acknowledgementText = """
This file was originally developed by Steve Pieper, Isomics, Inc. and was partially funded by NIH grant 3P41RR013218-12S1.
-""" # replace with organization, grant and thanks.
+""" # replace with organization, grant and thanks.
#
@@ -51,8 +51,8 @@ def setup(self):
formLayout = qt.QFormLayout(testsCollapsibleButton)
# test buttons
- tests = ( ("Part 1 : Ruler", self.onPart1Ruler),("Part 2: ChangeTracker", self.onPart2ChangeTracker),("Part 3 : PETCT", self.onPart3PETCT) )
- for text,slot in tests:
+ tests = (("Part 1 : Ruler", self.onPart1Ruler), ("Part 2: ChangeTracker", self.onPart2ChangeTracker), ("Part 3 : PETCT", self.onPart3PETCT))
+ for text, slot in tests:
testButton = qt.QPushButton(text)
testButton.toolTip = "Run the test."
formLayout.addWidget(testButton)
@@ -94,7 +94,7 @@ def onPart1Ruler(self):
tester = RSNAQuantTutorialTest()
tester.setUp()
- tester.test_Part1Ruler(enableScreenshotsFlag,screenshotScaleFactor)
+ tester.test_Part1Ruler(enableScreenshotsFlag, screenshotScaleFactor)
def onPart2ChangeTracker(self):
enableScreenshotsFlag = self.enableScreenshotsFlagCheckBox.checked
@@ -102,7 +102,7 @@ def onPart2ChangeTracker(self):
tester = RSNAQuantTutorialTest()
tester.setUp()
- tester.test_Part2ChangeTracker(enableScreenshotsFlag,screenshotScaleFactor)
+ tester.test_Part2ChangeTracker(enableScreenshotsFlag, screenshotScaleFactor)
def onPart3PETCT(self):
enableScreenshotsFlag = self.enableScreenshotsFlagCheckBox.checked
@@ -110,7 +110,7 @@ def onPart3PETCT(self):
tester = RSNAQuantTutorialTest()
tester.setUp()
- tester.test_Part3PETCT(enableScreenshotsFlag,screenshotScaleFactor)
+ tester.test_Part3PETCT(enableScreenshotsFlag, screenshotScaleFactor)
#
@@ -152,7 +152,7 @@ def runTest(self):
self.setUp()
self.test_Part3PETCT()
- def test_Part1Ruler(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
+ def test_Part1Ruler(self, enableScreenshotsFlag=0, screenshotScaleFactor=1):
""" Test using rulers
"""
self.enableScreenshots = enableScreenshotsFlag
@@ -178,16 +178,16 @@ def test_Part1Ruler(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
# add ruler 1
rulerNode1 = slicer.vtkMRMLAnnotationRulerNode()
rulerNode1.SetName("d1")
- rulerNode1.SetPosition1(-7.59519,43.544,28.6)
- rulerNode1.SetPosition2(-5.56987,14.177,28.6)
+ rulerNode1.SetPosition1(-7.59519, 43.544, 28.6)
+ rulerNode1.SetPosition2(-5.56987, 14.177, 28.6)
rulerNode1.Initialize(slicer.mrmlScene)
self.delayDisplay("Ruler 1")
# add ruler 2
rulerNode2 = slicer.vtkMRMLAnnotationRulerNode()
rulerNode2.SetName("d2")
- rulerNode2.SetPosition1(-3.54455,27.656,13.1646)
- rulerNode2.SetPosition2(-2.5319,27.656,47.5949)
+ rulerNode2.SetPosition1(-3.54455, 27.656, 13.1646)
+ rulerNode2.SetPosition2(-2.5319, 27.656, 47.5949)
rulerNode2.Initialize(slicer.mrmlScene)
self.delayDisplay("Ruler 2")
@@ -200,7 +200,7 @@ def test_Part1Ruler(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
redWidget.sliceController().setSliceLink(True)
redWidget.sliceController().setSliceVisible(True)
- self.takeScreenshot('Ruler','Ruler used to measure tumor diameter',-1)
+ self.takeScreenshot('Ruler', 'Ruler used to measure tumor diameter', -1)
self.delayDisplay('Test passed!')
except Exception as e:
@@ -208,7 +208,7 @@ def test_Part1Ruler(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
traceback.print_exc()
self.delayDisplay('Test caused exception!\n' + str(e))
- def test_Part3PETCT(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
+ def test_Part3PETCT(self, enableScreenshotsFlag=0, screenshotScaleFactor=1):
""" Test using the PETCT module
"""
self.enableScreenshots = enableScreenshotsFlag
@@ -228,7 +228,7 @@ def test_Part3PETCT(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
self.delayDisplay("Loading PET_CT_pre-treatment.mrb")
preTreatmentPath = extractPath + '/PET_CT_pre-treatment.mrb'
slicer.util.loadScene(preTreatmentPath)
- self.takeScreenshot('PETCT-LoadedPre','Loaded pre-treatement scene',-1)
+ self.takeScreenshot('PETCT-LoadedPre', 'Loaded pre-treatement scene', -1)
try:
mainWindow = slicer.util.mainWindow()
@@ -247,22 +247,22 @@ def test_Part3PETCT(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
break
threeDView.resetFocalPoint()
- slicer.util.clickAndDrag(threeDView,button='Right')
+ slicer.util.clickAndDrag(threeDView, button='Right')
redWidget.sliceController().setSliceVisible(True)
yellowWidget.sliceController().setSliceVisible(True)
- self.takeScreenshot('PETCT-ConfigureView','Configure View',-1)
+ self.takeScreenshot('PETCT-ConfigureView', 'Configure View', -1)
mainWindow.moduleSelector().selectModule('Volumes')
compositNode = redWidget.mrmlSliceCompositeNode()
compositNode.SetForegroundOpacity(0.2)
- self.takeScreenshot('PETCT-ShowVolumes','Show Volumes with lesion',-1)
+ self.takeScreenshot('PETCT-ShowVolumes', 'Show Volumes with lesion', -1)
compositNode.SetForegroundOpacity(0.5)
- self.takeScreenshot('PETCT-CTOpacity','CT1 volume opacity to 0.5',-1)
+ self.takeScreenshot('PETCT-CTOpacity', 'CT1 volume opacity to 0.5', -1)
yellowWidget.sliceController().setSliceVisible(False)
greenWidget.sliceController().setSliceVisible(True)
- self.takeScreenshot('PETCT-ShowSlices','Show axial and sagittal slices',-1)
+ self.takeScreenshot('PETCT-ShowSlices', 'Show axial and sagittal slices', -1)
self.delayDisplay('SUV Computation')
if not hasattr(slicer.modules, 'petstandarduptakevaluecomputation'):
@@ -287,16 +287,16 @@ def test_Part3PETCT(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
self.delayDisplay("Loading PET_CT_post-treatment.mrb")
postTreatmentPath = extractPath + '/PET_CT_post-treatment.mrb'
slicer.util.loadScene(postTreatmentPath)
- self.takeScreenshot('PETCT-LoadedPost','Loaded post-treatement scene',-1)
+ self.takeScreenshot('PETCT-LoadedPost', 'Loaded post-treatement scene', -1)
compositNode.SetForegroundOpacity(0.5)
- self.takeScreenshot('PETCT-CT2Opacity','CT2 volume opacity to 0.5',-1)
+ self.takeScreenshot('PETCT-CT2Opacity', 'CT2 volume opacity to 0.5', -1)
redController.setSliceOffsetValue(-165.01)
- self.takeScreenshot('PETCT-LarynxUptake','Mild uptake in the larynx and pharynx',-1)
+ self.takeScreenshot('PETCT-LarynxUptake', 'Mild uptake in the larynx and pharynx', -1)
redController.setSliceOffsetValue(-106.15)
- self.takeScreenshot('PETCT-TumorUptake','No uptake in the area of the primary tumor',-1)
+ self.takeScreenshot('PETCT-TumorUptake', 'No uptake in the area of the primary tumor', -1)
self.delayDisplay('Test passed!')
except Exception as e:
@@ -304,7 +304,7 @@ def test_Part3PETCT(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
traceback.print_exc()
self.delayDisplay('Test caused exception!\n' + str(e))
- def test_Part2ChangeTracker(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
+ def test_Part2ChangeTracker(self, enableScreenshotsFlag=0, screenshotScaleFactor=1):
""" Test the ChangeTracker module
"""
self.enableScreenshots = enableScreenshotsFlag
@@ -325,7 +325,7 @@ def test_Part2ChangeTracker(self,enableScreenshotsFlag=0,screenshotScaleFactor=1
loadFiles=True,
uris=TESTING_DATA_URL + 'SHA256/64734cbbf8ebafe4a52f551d1510a8f6f3d0625eb5b6c1e328be117c48e2c653',
checksums='SHA256:64734cbbf8ebafe4a52f551d1510a8f6f3d0625eb5b6c1e328be117c48e2c653')
- self.takeScreenshot('ChangeTracker-Loaded','Finished with download and loading',-1)
+ self.takeScreenshot('ChangeTracker-Loaded', 'Finished with download and loading', -1)
try:
mainWindow = slicer.util.mainWindow()
@@ -341,7 +341,7 @@ def test_Part2ChangeTracker(self,enableScreenshotsFlag=0,screenshotScaleFactor=1
self.delayDisplay('Configure Module')
mainWindow.moduleSelector().selectModule('ChangeTracker')
- self.takeScreenshot('ChangeTracker-ModuleGUI','Select the ChangeTracker module',-1)
+ self.takeScreenshot('ChangeTracker-ModuleGUI', 'Select the ChangeTracker module', -1)
changeTracker = slicer.modules.changetracker.widgetRepresentation().self()
@@ -349,53 +349,53 @@ def test_Part2ChangeTracker(self,enableScreenshotsFlag=0,screenshotScaleFactor=1
followupNode = slicer.util.getNode('2007-spgr1')
changeTracker.selectScansStep._ChangeTrackerSelectScansStep__baselineVolumeSelector.setCurrentNode(baselineNode)
changeTracker.selectScansStep._ChangeTrackerSelectScansStep__followupVolumeSelector.setCurrentNode(followupNode)
- self.takeScreenshot('ChangeTracker-SetInputs','Select input scans',-1)
+ self.takeScreenshot('ChangeTracker-SetInputs', 'Select input scans', -1)
changeTracker.workflow.goForward()
- self.takeScreenshot('ChangeTracker-GoForward','Go Forward',-1)
+ self.takeScreenshot('ChangeTracker-GoForward', 'Go Forward', -1)
- slicer.util.clickAndDrag(redWidget,button='Right')
- self.takeScreenshot('ChangeTracker-Zoom','Inspect - zoom',-1)
+ slicer.util.clickAndDrag(redWidget, button='Right')
+ self.takeScreenshot('ChangeTracker-Zoom', 'Inspect - zoom', -1)
- slicer.util.clickAndDrag(redWidget,button='Middle')
- self.takeScreenshot('ChangeTracker-Pan','Inspect - pan',-1)
+ slicer.util.clickAndDrag(redWidget, button='Middle')
+ self.takeScreenshot('ChangeTracker-Pan', 'Inspect - pan', -1)
- for offset in range(-20,20,2):
+ for offset in range(-20, 20, 2):
redController.setSliceOffsetValue(offset)
- self.takeScreenshot('ChangeTracker-Scroll','Inspect - scroll',-1)
+ self.takeScreenshot('ChangeTracker-Scroll', 'Inspect - scroll', -1)
self.delayDisplay('Set ROI')
roi = changeTracker.defineROIStep._ChangeTrackerDefineROIStep__roi
roi.SetXYZ(-2.81037, 28.7629, 28.4536)
- self.takeScreenshot('ChangeTracker-SetROICenter','Center VOI',-1)
+ self.takeScreenshot('ChangeTracker-SetROICenter', 'Center VOI', -1)
roi.SetRadiusXYZ(22.6467, 22.6804, 22.9897)
- self.takeScreenshot('ChangeTracker-SetROIExtent','Resize the VOI',-1)
+ self.takeScreenshot('ChangeTracker-SetROIExtent', 'Resize the VOI', -1)
layoutManager.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutConventionalWidescreenView)
- self.takeScreenshot('ChangeTracker-ConventionalWidescreen','Select the viewing mode Conventional Widescreen',-1)
+ self.takeScreenshot('ChangeTracker-ConventionalWidescreen', 'Select the viewing mode Conventional Widescreen', -1)
- slicer.util.clickAndDrag(redWidget,button='Right')
- self.takeScreenshot('ChangeTracker-ZoomVOI','Zoom',-1)
+ slicer.util.clickAndDrag(redWidget, button='Right')
+ self.takeScreenshot('ChangeTracker-ZoomVOI', 'Zoom', -1)
layoutManager.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutFourUpView)
- self.takeScreenshot('ChangeTracker-FourUpLayout','Go back to Four-Up layout',-1)
+ self.takeScreenshot('ChangeTracker-FourUpLayout', 'Go back to Four-Up layout', -1)
changeTracker.workflow.goForward()
- self.takeScreenshot('ChangeTracker-GoForward','Go Forward',-1)
+ self.takeScreenshot('ChangeTracker-GoForward', 'Go Forward', -1)
changeTracker.segmentROIStep._ChangeTrackerSegmentROIStep__threshRange.minimumValue = 120
- self.takeScreenshot('ChangeTracker-Threshold','Set threshold',-1)
+ self.takeScreenshot('ChangeTracker-Threshold', 'Set threshold', -1)
changeTracker.workflow.goForward()
- self.takeScreenshot('ChangeTracker-GoForward','Go Forward',-1)
+ self.takeScreenshot('ChangeTracker-GoForward', 'Go Forward', -1)
checkList = changeTracker.analyzeROIStep._ChangeTrackerAnalyzeROIStep__metricCheckboxList
index = list(checkList.values()).index('IntensityDifferenceMetric')
list(checkList.keys())[index].checked = True
- self.takeScreenshot('ChangeTracker-PickMetric','Select the ROI analysis method',-1)
+ self.takeScreenshot('ChangeTracker-PickMetric', 'Select the ROI analysis method', -1)
changeTracker.workflow.goForward()
- self.takeScreenshot('ChangeTracker-GoForward','Go Forward',-1)
+ self.takeScreenshot('ChangeTracker-GoForward', 'Go Forward', -1)
self.delayDisplay('Look!')
redWidget.sliceController().setSliceVisible(True)
@@ -405,21 +405,21 @@ def test_Part2ChangeTracker(self,enableScreenshotsFlag=0,screenshotScaleFactor=1
style = compareWidget.interactorStyle()
interactor = style.GetInteractor()
for step in range(100):
- interactor.SetEventPosition(10,step)
+ interactor.SetEventPosition(10, step)
style.OnMouseMove()
self.delayDisplay('Zoom')
- slicer.util.clickAndDrag(compareWidget,button='Right')
+ slicer.util.clickAndDrag(compareWidget, button='Right')
self.delayDisplay('Pan')
- slicer.util.clickAndDrag(compareWidget,button='Middle')
+ slicer.util.clickAndDrag(compareWidget, button='Middle')
self.delayDisplay('Inspect - scroll')
compareController = redWidget.sliceController()
- for offset in range(10,30,2):
+ for offset in range(10, 30, 2):
compareController.setSliceOffsetValue(offset)
- self.takeScreenshot('ChangeTracker-InspectResults','Inspected results',-1)
+ self.takeScreenshot('ChangeTracker-InspectResults', 'Inspected results', -1)
self.delayDisplay('Test passed!')
except Exception as e:
diff --git a/Applications/SlicerApp/Testing/Python/RSNAVisTutorial.py b/Applications/SlicerApp/Testing/Python/RSNAVisTutorial.py
index 5290605d01f..5ea65fed9f2 100644
--- a/Applications/SlicerApp/Testing/Python/RSNAVisTutorial.py
+++ b/Applications/SlicerApp/Testing/Python/RSNAVisTutorial.py
@@ -18,16 +18,16 @@ class RSNAVisTutorial(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
- parent.title = "RSNAVisTutorial" # TODO make this more human readable by adding spaces
+ parent.title = "RSNAVisTutorial" # TODO make this more human readable by adding spaces
parent.categories = ["Testing.TestCases"]
parent.dependencies = []
- parent.contributors = ["Steve Pieper (Isomics)"] # replace with "Firstname Lastname (Org)"
+ parent.contributors = ["Steve Pieper (Isomics)"] # replace with "Firstname Lastname (Org)"
parent.helpText = """
This module was developed as a self test to perform the operations needed for the RSNA 2012 Visualization Tutorial
"""
parent.acknowledgementText = """
This file was originally developed by Steve Pieper, Isomics, Inc. and was partially funded by NIH grant 3P41RR013218-12S1.
-""" # replace with organization, grant and thanks.
+""" # replace with organization, grant and thanks.
#
@@ -52,8 +52,8 @@ def setup(self):
formLayout = qt.QFormLayout(testsCollapsibleButton)
# test buttons
- tests = ( ("Part 1: DICOM",self.onPart1DICOM),("Part 2: Head", self.onPart2Head),("Part 3: Liver", self.onPart3Liver),("Part 4: Lung", self.onPart4Lung),)
- for text,slot in tests:
+ tests = (("Part 1: DICOM", self.onPart1DICOM), ("Part 2: Head", self.onPart2Head), ("Part 3: Liver", self.onPart3Liver), ("Part 4: Lung", self.onPart4Lung),)
+ for text, slot in tests:
testButton = qt.QPushButton(text)
testButton.toolTip = "Run the test."
formLayout.addWidget(testButton)
@@ -95,7 +95,7 @@ def onPart1DICOM(self):
tester = RSNAVisTutorialTest()
tester.setUp()
- tester.test_Part1DICOM(enableScreenshotsFlag,screenshotScaleFactor)
+ tester.test_Part1DICOM(enableScreenshotsFlag, screenshotScaleFactor)
def onPart2Head(self):
enableScreenshotsFlag = self.enableScreenshotsFlagCheckBox.checked
@@ -103,7 +103,7 @@ def onPart2Head(self):
tester = RSNAVisTutorialTest()
tester.setUp()
- tester.test_Part2Head(enableScreenshotsFlag,screenshotScaleFactor)
+ tester.test_Part2Head(enableScreenshotsFlag, screenshotScaleFactor)
def onPart3Liver(self):
enableScreenshotsFlag = self.enableScreenshotsFlagCheckBox.checked
@@ -111,7 +111,7 @@ def onPart3Liver(self):
tester = RSNAVisTutorialTest()
tester.setUp()
- tester.test_Part3Liver(enableScreenshotsFlag,screenshotScaleFactor)
+ tester.test_Part3Liver(enableScreenshotsFlag, screenshotScaleFactor)
def onPart4Lung(self):
enableScreenshotsFlag = self.enableScreenshotsFlagCheckBox.checked
@@ -119,15 +119,15 @@ def onPart4Lung(self):
tester = RSNAVisTutorialTest()
tester.setUp()
- tester.test_Part4Lung(enableScreenshotsFlag,screenshotScaleFactor)
+ tester.test_Part4Lung(enableScreenshotsFlag, screenshotScaleFactor)
- def onReload(self,moduleName="RSNAVisTutorial"):
+ def onReload(self, moduleName="RSNAVisTutorial"):
"""Generic reload method for any scripted module.
ModuleWizard will substitute correct default moduleName.
"""
globals()[moduleName] = slicer.util.reloadScriptedModule(moduleName)
- def onReloadAndTest(self,moduleName="RSNAVisTutorial"):
+ def onReloadAndTest(self, moduleName="RSNAVisTutorial"):
self.onReload()
evalString = f'globals()["{moduleName}"].{moduleName}Test()'
tester = eval(evalString)
@@ -177,7 +177,7 @@ def runTest(self):
self.setUp()
self.test_Part4Lung()
- def test_Part1DICOM(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
+ def test_Part1DICOM(self, enableScreenshotsFlag=0, screenshotScaleFactor=1):
""" Test the DICOM part of the test using the head atlas
"""
self.enableScreenshots = enableScreenshotsFlag
@@ -210,81 +210,81 @@ def test_Part1DICOM(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
self.delayDisplay('Loading Selection')
browserWidget.loadCheckedLoadables()
- self.takeScreenshot('LoadingADICOMVolume-Loaded','Loaded DICOM Volume',-1)
+ self.takeScreenshot('LoadingADICOMVolume-Loaded', 'Loaded DICOM Volume', -1)
layoutManager = slicer.app.layoutManager()
redWidget = layoutManager.sliceWidget('Red')
- slicer.util.clickAndDrag(redWidget,start=(10,10),end=(10,40))
- slicer.util.clickAndDrag(redWidget,start=(10,10),end=(40,10))
+ slicer.util.clickAndDrag(redWidget, start=(10, 10), end=(10, 40))
+ slicer.util.clickAndDrag(redWidget, start=(10, 10), end=(40, 10))
- self.takeScreenshot('LoadingADICOMVolume-WL','Changed level and window',-1)
+ self.takeScreenshot('LoadingADICOMVolume-WL', 'Changed level and window', -1)
redWidget.sliceController().setSliceLink(True)
redWidget.sliceController().setSliceVisible(True)
- self.takeScreenshot('LoadingADICOMVolume-LinkView','Linked and visible',-1)
+ self.takeScreenshot('LoadingADICOMVolume-LinkView', 'Linked and visible', -1)
- slicer.util.clickAndDrag(redWidget,button='Right',start=(10,10),end=(10,40))
- self.takeScreenshot('LoadingADICOMVolume-Zoom','Zoom',-1)
+ slicer.util.clickAndDrag(redWidget, button='Right', start=(10, 10), end=(10, 40))
+ self.takeScreenshot('LoadingADICOMVolume-Zoom', 'Zoom', -1)
threeDView = layoutManager.threeDWidget(0).threeDView()
slicer.util.clickAndDrag(threeDView)
- self.takeScreenshot('LoadingADICOMVolume-Rotate','Rotate',-1)
+ self.takeScreenshot('LoadingADICOMVolume-Rotate', 'Rotate', -1)
threeDView.resetFocalPoint()
- self.takeScreenshot('LoadingADICOMVolume-Center','Center the view',-1)
+ self.takeScreenshot('LoadingADICOMVolume-Center', 'Center the view', -1)
layoutManager.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutConventionalWidescreenView)
- self.takeScreenshot('LoadingADICOMVolume-ConventionalWidescreen','Conventional Widescreen Layout',-1)
+ self.takeScreenshot('LoadingADICOMVolume-ConventionalWidescreen', 'Conventional Widescreen Layout', -1)
slicer.util.mainWindow().moduleSelector().selectModule('VolumeRendering')
- self.takeScreenshot('VolumeRendering-Module','Volume Rendering',-1)
+ self.takeScreenshot('VolumeRendering-Module', 'Volume Rendering', -1)
volumeRenderingWidgetRep = slicer.modules.volumerendering.widgetRepresentation()
abdomenVolume = slicer.mrmlScene.GetFirstNodeByName('6: CT_Thorax_Abdomen')
volumeRenderingWidgetRep.setMRMLVolumeNode(abdomenVolume)
- self.takeScreenshot('VolumeRendering-SelectVolume','Select the volume 6: CT_Thorax_Abdomen',-1)
+ self.takeScreenshot('VolumeRendering-SelectVolume', 'Select the volume 6: CT_Thorax_Abdomen', -1)
presetsScene = slicer.modules.volumerendering.logic().GetPresetsScene()
ctCardiac3 = presetsScene.GetFirstNodeByName('CT-Cardiac3')
volumeRenderingWidgetRep.mrmlVolumePropertyNode().Copy(ctCardiac3)
- self.takeScreenshot('VolumeRendering-SelectPreset','Select the Preset CT-Cardiac-3')
+ self.takeScreenshot('VolumeRendering-SelectPreset', 'Select the Preset CT-Cardiac-3')
self.delayDisplay('Skipping: Select VTK CPU Ray Casting')
volumeRenderingNode = slicer.mrmlScene.GetFirstNodeByName('VolumeRendering')
volumeRenderingNode.SetVisibility(1)
- self.takeScreenshot('VolumeRendering-ViewRendering','View Volume Rendering',-1)
+ self.takeScreenshot('VolumeRendering-ViewRendering', 'View Volume Rendering', -1)
self.delayDisplay('Skipping Move the Shift slider')
redWidget.sliceController().setSliceVisible(False)
- self.takeScreenshot('VolumeRendering-SlicesOff','Turn off visibility of slices in 3D',-1)
+ self.takeScreenshot('VolumeRendering-SlicesOff', 'Turn off visibility of slices in 3D', -1)
threeDView = layoutManager.threeDWidget(0).threeDView()
slicer.util.clickAndDrag(threeDView)
- self.takeScreenshot('VolumeRendering-RotateVolumeRendering','Rotate volume rendered image',-1)
+ self.takeScreenshot('VolumeRendering-RotateVolumeRendering', 'Rotate volume rendered image', -1)
volumeRenderingNode.SetVisibility(0)
- self.takeScreenshot('VolumeRendering-TurnOffVolumeRendering','Turn off volume rendered image',-1)
+ self.takeScreenshot('VolumeRendering-TurnOffVolumeRendering', 'Turn off volume rendered image', -1)
volumeRenderingNode.SetCroppingEnabled(1)
annotationROI = slicer.mrmlScene.GetFirstNodeByName('AnnotationROI')
annotationROI.SetDisplayVisibility(1)
- self.takeScreenshot('VolumeRendering-DisplayROI','Enable cropping and display ROI',-1)
+ self.takeScreenshot('VolumeRendering-DisplayROI', 'Enable cropping and display ROI', -1)
redWidget.sliceController().setSliceVisible(True)
- self.takeScreenshot('VolumeRendering-SlicesOn','Turn on visibility of slices in 3D',-1)
+ self.takeScreenshot('VolumeRendering-SlicesOn', 'Turn on visibility of slices in 3D', -1)
- annotationROI.SetXYZ(-79.61,154.16,-232.591)
- annotationROI.SetRadiusXYZ(43.4,65.19,70.5)
- self.takeScreenshot('VolumeRendering-SizedROI','Position the ROI over a kidney',-1)
+ annotationROI.SetXYZ(-79.61, 154.16, -232.591)
+ annotationROI.SetRadiusXYZ(43.4, 65.19, 70.5)
+ self.takeScreenshot('VolumeRendering-SizedROI', 'Position the ROI over a kidney', -1)
volumeRenderingNode.SetVisibility(1)
- self.takeScreenshot('VolumeRendering-ROIRendering','ROI volume rendered',-1)
+ self.takeScreenshot('VolumeRendering-ROIRendering', 'ROI volume rendered', -1)
- annotationROI.SetXYZ(15,146,-186)
- annotationROI.SetRadiusXYZ(138,57,61)
- self.takeScreenshot('VolumeRendering-BothKidneys','Rendered both kidneys',-1)
+ annotationROI.SetXYZ(15, 146, -186)
+ annotationROI.SetRadiusXYZ(138, 57, 61)
+ self.takeScreenshot('VolumeRendering-BothKidneys', 'Rendered both kidneys', -1)
self.delayDisplay('Test passed!')
except Exception as e:
@@ -295,7 +295,7 @@ def test_Part1DICOM(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
self.delayDisplay("Restoring original database directory")
DICOMUtils.closeTemporaryDatabase(originalDatabaseDirectory)
- def test_Part2Head(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
+ def test_Part2Head(self, enableScreenshotsFlag=0, screenshotScaleFactor=1):
""" Test using the head atlas - may not be needed - Slicer4Minute is already tested
"""
self.enableScreenshots = enableScreenshotsFlag
@@ -312,7 +312,7 @@ def test_Part2Head(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
uris=TESTING_DATA_URL + 'SHA256/6785e481925c912a5a3940e9c9b71935df93a78a871e10f66ab71f8478229e68',
checksums='SHA256:6785e481925c912a5a3940e9c9b71935df93a78a871e10f66ab71f8478229e68')
- self.takeScreenshot('Head-Downloaded','Finished with download and loading',-1)
+ self.takeScreenshot('Head-Downloaded', 'Finished with download and loading', -1)
try:
mainWindow = slicer.util.mainWindow()
@@ -325,16 +325,16 @@ def test_Part2Head(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
mainWindow.moduleSelector().selectModule('Models')
redWidget.sliceController().setSliceVisible(True)
- self.takeScreenshot('Head-ModelsAndSliceModel','Models and Slice Model',-1)
+ self.takeScreenshot('Head-ModelsAndSliceModel', 'Models and Slice Model', -1)
slicer.util.clickAndDrag(threeDView)
- self.takeScreenshot('Head-Rotate','Rotate',-1)
+ self.takeScreenshot('Head-Rotate', 'Rotate', -1)
redController.setSliceVisible(True)
- self.takeScreenshot('Head-AxialSlice','Display Axial Slice',-1)
+ self.takeScreenshot('Head-AxialSlice', 'Display Axial Slice', -1)
layoutManager.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutConventionalView)
- self.takeScreenshot('Head-ConventionalView','Conventional Layout',-1)
+ self.takeScreenshot('Head-ConventionalView', 'Conventional Layout', -1)
viewNode = threeDView.mrmlViewNode()
cameras = slicer.util.getNodes('vtkMRMLCameraNode*')
@@ -347,15 +347,15 @@ def test_Part2Head(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
# turn off skin and skull
skin = slicer.util.getNode(pattern='Skin.vtk')
skin.GetDisplayNode().SetOpacity(0.5)
- self.takeScreenshot('Head-SkinOpacity','Skin Opacity to 0.5',-1)
+ self.takeScreenshot('Head-SkinOpacity', 'Skin Opacity to 0.5', -1)
skin.GetDisplayNode().SetVisibility(0)
- self.takeScreenshot('Head-SkinOpacityZero','Skin Opacity to 0',-1)
+ self.takeScreenshot('Head-SkinOpacityZero', 'Skin Opacity to 0', -1)
skull = slicer.util.getNode(pattern='skull_bone.vtk')
greenWidget.sliceController().setSliceVisible(True)
- self.takeScreenshot('Head-GreenSlice','Display Coronal Slice',-1)
+ self.takeScreenshot('Head-GreenSlice', 'Display Coronal Slice', -1)
# hemispheric_white_matter.GetDisplayNode().SetClipping(1)
skull.GetDisplayNode().SetClipping(1)
@@ -363,30 +363,30 @@ def test_Part2Head(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
clip.SetRedSliceClipState(0)
clip.SetYellowSliceClipState(0)
clip.SetGreenSliceClipState(2)
- self.takeScreenshot('Head-SkullClipping','Turn on clipping for skull model',-1)
+ self.takeScreenshot('Head-SkullClipping', 'Turn on clipping for skull model', -1)
- for offset in range(-20,20,2):
+ for offset in range(-20, 20, 2):
greenController.setSliceOffsetValue(offset)
- self.takeScreenshot('Head-ScrollCoronal','Scroll through coronal slices',-1)
+ self.takeScreenshot('Head-ScrollCoronal', 'Scroll through coronal slices', -1)
skull.GetDisplayNode().SetVisibility(0)
- self.takeScreenshot('Head-HideSkull','Make the skull invisible',-1)
+ self.takeScreenshot('Head-HideSkull', 'Make the skull invisible', -1)
- for offset in range(-40,-20,2):
+ for offset in range(-40, -20, 2):
greenController.setSliceOffsetValue(offset)
- self.takeScreenshot('Head-ScrollCoronalWhiteMatter','Scroll through coronal slices to show white matter',-1)
+ self.takeScreenshot('Head-ScrollCoronalWhiteMatter', 'Scroll through coronal slices to show white matter', -1)
hemispheric_white_matter = slicer.util.getNode(pattern='hemispheric_white_matter.vtk')
hemispheric_white_matter.GetDisplayNode().SetVisibility(0)
- self.takeScreenshot('Head-HideWhiteMatter','Turn off white matter',-1)
+ self.takeScreenshot('Head-HideWhiteMatter', 'Turn off white matter', -1)
self.delayDisplay('Rotate')
slicer.util.clickAndDrag(threeDView)
self.delayDisplay('Zoom')
threeDView = layoutManager.threeDWidget(0).threeDView()
- slicer.util.clickAndDrag(threeDView,button='Right')
- self.takeScreenshot('Head-Zoom','Zoom',-1)
+ slicer.util.clickAndDrag(threeDView, button='Right')
+ self.takeScreenshot('Head-Zoom', 'Zoom', -1)
self.delayDisplay('Test passed!')
except Exception as e:
@@ -394,7 +394,7 @@ def test_Part2Head(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
traceback.print_exc()
self.delayDisplay('Test caused exception!\n' + str(e))
- def test_Part3Liver(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
+ def test_Part3Liver(self, enableScreenshotsFlag=0, screenshotScaleFactor=1):
""" Test using the liver example data
"""
self.enableScreenshots = enableScreenshotsFlag
@@ -411,7 +411,7 @@ def test_Part3Liver(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
uris=TESTING_DATA_URL + 'SHA256/ff797140c13a5988a7b72920adf0d2dab390a9babeab9161d5c52613328249f7',
checksums='SHA256:ff797140c13a5988a7b72920adf0d2dab390a9babeab9161d5c52613328249f7')
- self.takeScreenshot('Liver-Loaded','Loaded Liver scene',-1)
+ self.takeScreenshot('Liver-Loaded', 'Loaded Liver scene', -1)
try:
mainWindow = slicer.util.mainWindow()
@@ -426,31 +426,31 @@ def test_Part3Liver(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
break
mainWindow.moduleSelector().selectModule('Models')
- self.takeScreenshot('Liver-Models','Models module',-1)
+ self.takeScreenshot('Liver-Models', 'Models module', -1)
segmentII = slicer.util.getNode('LiverSegment_II')
segmentII.GetDisplayNode().SetVisibility(0)
- slicer.util.clickAndDrag(threeDView,start=(10,200),end=(10,10))
- self.takeScreenshot('Liver-SegmentII','Segment II invisible',-1)
+ slicer.util.clickAndDrag(threeDView, start=(10, 200), end=(10, 10))
+ self.takeScreenshot('Liver-SegmentII', 'Segment II invisible', -1)
segmentII.GetDisplayNode().SetVisibility(1)
- self.takeScreenshot('Liver-SegmentII','Segment II visible',-1)
+ self.takeScreenshot('Liver-SegmentII', 'Segment II visible', -1)
cameraNode.GetCamera().Azimuth(0)
cameraNode.GetCamera().Elevation(0)
- self.takeScreenshot('Liver-SuperiorView','Superior view',-1)
+ self.takeScreenshot('Liver-SuperiorView', 'Superior view', -1)
segmentII.GetDisplayNode().SetVisibility(0)
cameraNode.GetCamera().Azimuth(180)
cameraNode.GetCamera().Elevation(-30)
redWidget.sliceController().setSliceVisible(True)
- self.takeScreenshot('Liver-ViewAdrenal','View Adrenal',-1)
+ self.takeScreenshot('Liver-ViewAdrenal', 'View Adrenal', -1)
models = slicer.util.getNodes('vtkMRMLModelNode*')
for modelNode in models.values():
modelNode.GetDisplayNode().SetVisibility(0)
- transparentNodes = ('MiddleHepaticVein_and_Branches','LiverSegment_IVb','LiverSegmentV',)
+ transparentNodes = ('MiddleHepaticVein_and_Branches', 'LiverSegment_IVb', 'LiverSegmentV',)
for nodeName in transparentNodes:
modelNode = slicer.util.getNode(nodeName)
modelNode.GetDisplayNode().SetOpacity(0.5)
@@ -458,7 +458,7 @@ def test_Part3Liver(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
cameraNode.GetCamera().Azimuth(30)
cameraNode.GetCamera().Elevation(-20)
redWidget.sliceController().setSliceVisible(True)
- self.takeScreenshot('Liver-MiddleHepatic','Middle Hepatic',-1)
+ self.takeScreenshot('Liver-MiddleHepatic', 'Middle Hepatic', -1)
self.delayDisplay('Test passed!')
except Exception as e:
@@ -466,7 +466,7 @@ def test_Part3Liver(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
traceback.print_exc()
self.delayDisplay('Test caused exception!\n' + str(e))
- def test_Part4Lung(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
+ def test_Part4Lung(self, enableScreenshotsFlag=0, screenshotScaleFactor=1):
""" Test using the lung data
"""
self.enableScreenshots = enableScreenshotsFlag
@@ -483,7 +483,7 @@ def test_Part4Lung(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
uris=TESTING_DATA_URL + 'SHA256/89ffc6cabd76a17dfa6beb404a5901a4b4e4b4f2f4ee46c2d5f4d34459f554a1',
checksums='SHA256:89ffc6cabd76a17dfa6beb404a5901a4b4e4b4f2f4ee46c2d5f4d34459f554a1')
- self.takeScreenshot('Lung-Loaded','Finished with download and loading',-1)
+ self.takeScreenshot('Lung-Loaded', 'Finished with download and loading', -1)
try:
mainWindow = slicer.util.mainWindow()
@@ -498,29 +498,29 @@ def test_Part4Lung(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
break
threeDView.resetFocalPoint()
- self.takeScreenshot('Lung-ResetView','Reset view',-1)
+ self.takeScreenshot('Lung-ResetView', 'Reset view', -1)
mainWindow.moduleSelector().selectModule('Models')
- self.takeScreenshot('Lung-Models','Models module',-1)
+ self.takeScreenshot('Lung-Models', 'Models module', -1)
cameraNode.GetCamera().Azimuth(-100)
cameraNode.GetCamera().Elevation(-40)
redWidget.sliceController().setSliceVisible(True)
lungs = slicer.util.getNode('chestCT_lungs')
lungs.GetDisplayNode().SetVisibility(0)
- self.takeScreenshot('Lung-Question1','View Question 1',-1)
+ self.takeScreenshot('Lung-Question1', 'View Question 1', -1)
cameraNode.GetCamera().Azimuth(-65)
cameraNode.GetCamera().Elevation(-20)
lungs.GetDisplayNode().SetVisibility(1)
lungs.GetDisplayNode().SetOpacity(0.24)
redController.setSliceOffsetValue(-50)
- self.takeScreenshot('Lung-Question2','View Question 2',-1)
+ self.takeScreenshot('Lung-Question2', 'View Question 2', -1)
cameraNode.GetCamera().Azimuth(-165)
cameraNode.GetCamera().Elevation(-10)
redWidget.sliceController().setSliceVisible(False)
- self.takeScreenshot('Lung-Question3','View Question 3',-1)
+ self.takeScreenshot('Lung-Question3', 'View Question 3', -1)
cameraNode.GetCamera().Azimuth(20)
cameraNode.GetCamera().Elevation(-10)
@@ -531,7 +531,7 @@ def test_Part4Lung(self,enableScreenshotsFlag=0,screenshotScaleFactor=1):
displayNode = lowerLobeNodes[node].GetDisplayNode()
if displayNode:
displayNode.SetVisibility(1 if node == showNode else 0)
- self.takeScreenshot('Lung-Question4','View Question 4',-1)
+ self.takeScreenshot('Lung-Question4', 'View Question 4', -1)
self.delayDisplay('Test passed!')
except Exception as e:
diff --git a/Applications/SlicerApp/Testing/Python/ScenePerformance.py b/Applications/SlicerApp/Testing/Python/ScenePerformance.py
index fbf3baa3359..6e6868a071f 100644
--- a/Applications/SlicerApp/Testing/Python/ScenePerformance.py
+++ b/Applications/SlicerApp/Testing/Python/ScenePerformance.py
@@ -59,7 +59,7 @@ def setup(self):
self.RepeatSpinBox = self.findWidget(self.parent, 'RepeatSpinBox')
widget.setMRMLScene(slicer.mrmlScene)
- #self.MRMLNodeComboBox.setMRMLScene(slicer.mrmlScene)
+ # self.MRMLNodeComboBox.setMRMLScene(slicer.mrmlScene)
self.TimePushButton.connect('clicked()', self.timeAction)
self.ActionComboBox.connect('currentIndexChanged(int)', self.updateActionProperties)
@@ -73,7 +73,7 @@ def timeAction(self):
tester = ScenePerformanceTest()
tester.setUp()
tester.setRepeat(self.RepeatSpinBox.value)
- if self.ActionComboBox.currentIndex == 0: # Add Data
+ if self.ActionComboBox.currentIndex == 0: # Add Data
if (self.URLLineEdit.text == ''):
file = self.ActionPathLineEdit.currentPath
else:
@@ -81,20 +81,20 @@ def timeAction(self):
file = logic.downloadFile(self.URLLineEdit.text, self.URLFileNameLineEdit.text)
results = tester.addData(file)
self.ResultsTextEdit.append(results)
- elif self.ActionComboBox.currentIndex == 1: # Restore
+ elif self.ActionComboBox.currentIndex == 1: # Restore
results = tester.restoreSceneView(self.SceneViewSpinBox.value)
self.ResultsTextEdit.append(results)
- elif self.ActionComboBox.currentIndex == 3: # Layout
+ elif self.ActionComboBox.currentIndex == 3: # Layout
results = tester.setLayout(self.LayoutSpinBox.value)
self.ResultsTextEdit.append(results)
- elif self.ActionComboBox.currentIndex == 2: # Close
+ elif self.ActionComboBox.currentIndex == 2: # Close
results = tester.closeScene()
self.ResultsTextEdit.append(results)
- elif self.ActionComboBox.currentIndex == 4: # Add Node
+ elif self.ActionComboBox.currentIndex == 4: # Add Node
node = self.MRMLNodeComboBox.currentNode()
results = tester.addNode(node)
self.ResultsTextEdit.append(results)
- elif self.ActionComboBox.currentIndex == 5: # Modify Node
+ elif self.ActionComboBox.currentIndex == 5: # Modify Node
node = self.MRMLNodeComboBox.currentNode()
results = tester.modifyNode(node)
self.ResultsTextEdit.append(results)
@@ -137,9 +137,9 @@ class ScenePerformanceTest(ScriptedLoadableModuleTest):
def setUp(self):
self.Repeat = 1
self.delayDisplay("Setup")
- #layoutManager = slicer.app.layoutManager()
- #layoutManager.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutConventionalView)
- #slicer.mrmlScene.Clear(0)
+ # layoutManager = slicer.app.layoutManager()
+ # layoutManager.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutConventionalView)
+ # slicer.mrmlScene.Clear(0)
def setRepeat(self, repeat):
self.Repeat = repeat
@@ -156,10 +156,10 @@ def testAll(self):
self.modifyNodeByID('vtkMRMLScalarVolumeNode2')
self.modifyNodeByID('vtkMRMLScalarVolumeNode3')
self.modifyNodeByID('vtkMRMLScalarVolumeDisplayNode2')
- #self.modifyNodeByID('vtkMRMLModelHierarchyNode2')
+ # self.modifyNodeByID('vtkMRMLModelHierarchyNode2')
self.modifyNodeByID('vtkMRMLModelNode4')
self.modifyNodeByID('vtkMRMLModelDisplayNode5')
- #self.modifyNodeByID('vtkMRMLModelHierarchyNode3')
+ # self.modifyNodeByID('vtkMRMLModelHierarchyNode3')
self.modifyNodeByID('vtkMRMLModelStorageNode1')
self.addNodeByID('vtkMRMLModelNode302')
self.setLayout(3)
@@ -175,7 +175,7 @@ def testAll(self):
def reportPerformance(self, action, property, time):
message = self.displayPerformance(action, property, time)
- print ( f'{time}')
+ print(f'{time}')
return message
def displayPerformance(self, action, property, time):
diff --git a/Applications/SlicerApp/Testing/Python/ScriptedModuleCleanupTest.py b/Applications/SlicerApp/Testing/Python/ScriptedModuleCleanupTest.py
index f63a3015233..638a38eb2b1 100644
--- a/Applications/SlicerApp/Testing/Python/ScriptedModuleCleanupTest.py
+++ b/Applications/SlicerApp/Testing/Python/ScriptedModuleCleanupTest.py
@@ -47,13 +47,13 @@ def check_exit_code(slicer_executable, testing_enabled=True, debug=False):
* avoid deleting the created temporary directory
"""
- temporaryModuleDirPath = tempfile.mkdtemp().replace('\\','/')
+ temporaryModuleDirPath = tempfile.mkdtemp().replace('\\', '/')
try:
# Copy helper module that creates a file when startup completed event is received
- currentDirPath = os.path.dirname(__file__).replace('\\','/')
+ currentDirPath = os.path.dirname(__file__).replace('\\', '/')
from shutil import copyfile
- copyfile(currentDirPath+'/ScriptedModuleCleanupTestHelperModule.py',
- temporaryModuleDirPath+'/ModuleCleanup.py')
+ copyfile(currentDirPath + '/ScriptedModuleCleanupTestHelperModule.py',
+ temporaryModuleDirPath + '/ModuleCleanup.py')
common_arguments = [
'--no-splash',
diff --git a/Applications/SlicerApp/Testing/Python/ScriptedModuleCleanupTestHelperModule.py b/Applications/SlicerApp/Testing/Python/ScriptedModuleCleanupTestHelperModule.py
index d29747184bc..20a3f8c707c 100644
--- a/Applications/SlicerApp/Testing/Python/ScriptedModuleCleanupTestHelperModule.py
+++ b/Applications/SlicerApp/Testing/Python/ScriptedModuleCleanupTestHelperModule.py
@@ -8,7 +8,7 @@ def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
self.parent.title = "Module for cleanup test"
self.parent.categories = ["ModuleCleanup"] # Explicitly add a category to work around issue #4698
- self.parent.contributors = ["Jean-Christophe Fillion-Robin (Kitware)",]
+ self.parent.contributors = ["Jean-Christophe Fillion-Robin (Kitware)", ]
self.parent.helpText = """
This module allows to test that exception raised during module cleanup
sets exit code.
diff --git a/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleA.py b/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleA.py
index 0338dc754ee..b610cdfcf0a 100644
--- a/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleA.py
+++ b/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleA.py
@@ -7,7 +7,7 @@ class ModuleA(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
self.parent.title = "Module A"
- self.parent.contributors = ["Jean-Christophe Fillion-Robin (Kitware)",]
+ self.parent.contributors = ["Jean-Christophe Fillion-Robin (Kitware)", ]
self.parent.helpText = """
This module allows to test the scripted module import.
"""
diff --git a/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleB.py b/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleB.py
index 9469aec1b8e..52a79292e2a 100644
--- a/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleB.py
+++ b/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleB.py
@@ -7,7 +7,7 @@ class ModuleB(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
self.parent.title = "Module B"
- self.parent.contributors = ["Jean-Christophe Fillion-Robin (Kitware)",]
+ self.parent.contributors = ["Jean-Christophe Fillion-Robin (Kitware)", ]
self.parent.helpText = """
This module allows to test the scripted module import.
"""
diff --git a/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleC_WithoutWidget.py b/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleC_WithoutWidget.py
index 5eec42e3ac0..4fd5d1f0b2e 100644
--- a/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleC_WithoutWidget.py
+++ b/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleC_WithoutWidget.py
@@ -7,7 +7,7 @@ class ModuleC_WithoutWidget(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
self.parent.title = "Module A"
- self.parent.contributors = ["Jean-Christophe Fillion-Robin (Kitware)",]
+ self.parent.contributors = ["Jean-Christophe Fillion-Robin (Kitware)", ]
self.parent.helpText = """
This module allows to test the scripted module import.
"""
diff --git a/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleD_WithFileDialog_WithoutWidget.py b/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleD_WithFileDialog_WithoutWidget.py
index 51e08c0082f..f7801480854 100644
--- a/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleD_WithFileDialog_WithoutWidget.py
+++ b/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleD_WithFileDialog_WithoutWidget.py
@@ -7,7 +7,7 @@ class ModuleD_WithFileDialog_WithoutWidget(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
self.parent.title = "Module A"
- self.parent.contributors = ["Jean-Christophe Fillion-Robin (Kitware)",]
+ self.parent.contributors = ["Jean-Christophe Fillion-Robin (Kitware)", ]
self.parent.helpText = """
This module allows to test the scripted module import.
"""
@@ -22,7 +22,7 @@ def somevar(self):
class DICOMFileDialog:
- def __init__(self,qSlicerFileDialog):
+ def __init__(self, qSlicerFileDialog):
self.qSlicerFileDialog = qSlicerFileDialog
qSlicerFileDialog.fileType = 'Foo Directory'
qSlicerFileDialog.description = 'Do something awesome with Foo'
diff --git a/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleE_WithFileWriter_WithoutWidget.py b/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleE_WithFileWriter_WithoutWidget.py
index bc585f62f47..28ecab04196 100644
--- a/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleE_WithFileWriter_WithoutWidget.py
+++ b/Applications/SlicerApp/Testing/Python/ScriptedModuleDiscoveryTest/ModuleE_WithFileWriter_WithoutWidget.py
@@ -7,7 +7,7 @@ class ModuleE_WithFileWriter_WithoutWidget(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
self.parent.title = "Module A"
- self.parent.contributors = ["Jean-Christophe Fillion-Robin (Kitware)",]
+ self.parent.contributors = ["Jean-Christophe Fillion-Robin (Kitware)", ]
self.parent.helpText = """
This module allows to test the scripted module import.
"""
diff --git a/Applications/SlicerApp/Testing/Python/ShaderProperties.py b/Applications/SlicerApp/Testing/Python/ShaderProperties.py
index bd29a29efd3..f1b81c5ff9e 100644
--- a/Applications/SlicerApp/Testing/Python/ShaderProperties.py
+++ b/Applications/SlicerApp/Testing/Python/ShaderProperties.py
@@ -40,12 +40,12 @@ def setup(self):
self.sphereTestButton = qt.QPushButton()
self.sphereTestButton.text = "Sphere test"
self.layout.addWidget(self.sphereTestButton)
- self.sphereTestButton.connect("clicked()", lambda : ShaderPropertiesTest().testSphereCut())
+ self.sphereTestButton.connect("clicked()", lambda: ShaderPropertiesTest().testSphereCut())
self.wedgeTestButton = qt.QPushButton()
self.wedgeTestButton.text = "Wedge test"
self.layout.addWidget(self.wedgeTestButton)
- self.wedgeTestButton.connect("clicked()", lambda : ShaderPropertiesTest().testWedgeCut())
+ self.wedgeTestButton.connect("clicked()", lambda: ShaderPropertiesTest().testWedgeCut())
# Add vertical spacer
self.layout.addStretch(1)
@@ -98,34 +98,34 @@ def testWedgeCut(self):
self.delayDisplay('GPU Ray Casting on')
- endpoints = [ [-162.94, 2.32192, -30.1792], [-144.842, 96.867, -36.8726] ]
+ endpoints = [[-162.94, 2.32192, -30.1792], [-144.842, 96.867, -36.8726]]
markupNode = slicer.mrmlScene.AddNode(slicer.vtkMRMLMarkupsLineNode())
for endpoint in endpoints:
markupNode.AddControlPoint(vtk.vtkVector3d(endpoint))
self.delayDisplay('Line added')
- #------------------------------------------------------
+ # ------------------------------------------------------
# Utility functions to get the position of the first
# markup line in the scene and the shader property
# node
- #------------------------------------------------------
+ # ------------------------------------------------------
def GetLineEndpoints():
fn = slicer.util.getNode('vtkMRMLMarkupsLineNode1')
endpoints = []
for n in range(2):
- endpoints.append([0,]*3)
- fn.GetNthControlPointPosition(n,endpoints[n])
+ endpoints.append([0, ] * 3)
+ fn.GetNthControlPointPosition(n, endpoints[n])
return endpoints
def GetShaderPropertyNode():
return slicer.util.getNode('vtkMRMLShaderPropertyNode1')
- #------------------------------------------------------
+ # ------------------------------------------------------
# Get the shader property node which contains every custom
# shader modifications for every mapper associated with
# the first volume rendering display node
- #------------------------------------------------------
+ # ------------------------------------------------------
displayNode = slicer.util.getNodesByClass('vtkMRMLGPURayCastVolumeRenderingDisplayNode')[0]
shaderPropNode = displayNode.GetOrCreateShaderPropertyNode(slicer.mrmlScene)
shaderProp = shaderPropNode.GetShaderProperty()
@@ -135,22 +135,22 @@ def GetShaderPropertyNode():
volumeProperty = volumePropertyNode.GetVolumeProperty()
volumeProperty.ShadeOff()
- #------------------------------------------------------
+ # ------------------------------------------------------
# Declare and initialize custom uniform variables
# used in our shader replacement
- #------------------------------------------------------
+ # ------------------------------------------------------
shaderUniforms = shaderPropNode.GetFragmentUniforms()
shaderUniforms.RemoveAllUniforms()
endpoints = GetLineEndpoints()
- shaderUniforms.SetUniform3f("endpoint0",endpoints[0])
- shaderUniforms.SetUniform3f("endpoint1",endpoints[1])
- shaderUniforms.SetUniformf("coneCutoff",0.8)
+ shaderUniforms.SetUniform3f("endpoint0", endpoints[0])
+ shaderUniforms.SetUniform3f("endpoint1", endpoints[1])
+ shaderUniforms.SetUniformf("coneCutoff", 0.8)
- #------------------------------------------------------
+ # ------------------------------------------------------
# Replace the cropping implementation part of the
# raycasting shader to skip everything in the sphere
# defined by endpoints and radius
- #------------------------------------------------------
+ # ------------------------------------------------------
croppingImplShaderCode = """
vec4 texCoordRAS = in_volumeMatrix[0] * in_textureDatasetMatrix[0] * vec4(g_dataPos, 1.);
vec3 samplePoint = texCoordRAS.xyz;
@@ -162,18 +162,18 @@ def GetShaderPropertyNode():
shaderProp.ClearAllFragmentShaderReplacements()
shaderProp.AddFragmentShaderReplacement("//VTK::Cropping::Impl", True, croppingImplShaderCode, False)
- #------------------------------------------------------
+ # ------------------------------------------------------
# Add a callback when the line moves to adjust
# the endpoints of the carving sphere accordingly
- #------------------------------------------------------
+ # ------------------------------------------------------
def onControlPointMoved():
endpoints = GetLineEndpoints()
propNode = GetShaderPropertyNode()
- propNode.GetFragmentUniforms().SetUniform3f("endpoint0",endpoints[0])
- propNode.GetFragmentUniforms().SetUniform3f("endpoint1",endpoints[1])
+ propNode.GetFragmentUniforms().SetUniform3f("endpoint0", endpoints[0])
+ propNode.GetFragmentUniforms().SetUniform3f("endpoint1", endpoints[1])
fn = slicer.util.getNode('vtkMRMLMarkupsLineNode1')
- fn.AddObserver(fn.PointModifiedEvent, lambda caller,event: onControlPointMoved())
+ fn.AddObserver(fn.PointModifiedEvent, lambda caller, event: onControlPointMoved())
self.delayDisplay("Should be a carved out shoulder now")
@@ -206,11 +206,11 @@ def testSphereCut(self):
self.delayDisplay('Point list added')
- #------------------------------------------------------
+ # ------------------------------------------------------
# Utility functions to get the position of the first
# markups point list in the scene and the shader property
# node
- #------------------------------------------------------
+ # ------------------------------------------------------
def GetPointPosition():
fn = slicer.util.getNode('vtkMRMLMarkupsFiducialNode1')
p = [0.0, 0.0, 0.0]
@@ -220,11 +220,11 @@ def GetPointPosition():
def GetShaderPropertyNode():
return slicer.util.getNode('vtkMRMLShaderPropertyNode1')
- #------------------------------------------------------
+ # ------------------------------------------------------
# Get the shader property node which contains every custom
# shader modifications for every mapper associated with
# the first volume rendering display node
- #------------------------------------------------------
+ # ------------------------------------------------------
displayNode = slicer.util.getNodesByClass('vtkMRMLGPURayCastVolumeRenderingDisplayNode')[0]
shaderPropNode = displayNode.GetOrCreateShaderPropertyNode(slicer.mrmlScene)
shaderProp = shaderPropNode.GetShaderProperty()
@@ -234,21 +234,21 @@ def GetShaderPropertyNode():
volumeProperty = volumePropertyNode.GetVolumeProperty()
volumeProperty.ShadeOff()
- #------------------------------------------------------
+ # ------------------------------------------------------
# Declare and initialize custom uniform variables
# used in our shader replacement
- #------------------------------------------------------
+ # ------------------------------------------------------
shaderUniforms = shaderPropNode.GetFragmentUniforms()
shaderUniforms.RemoveAllUniforms()
pointPos = GetPointPosition()
- shaderUniforms.SetUniform3f("center",pointPos)
- shaderUniforms.SetUniformf("radius",50.)
+ shaderUniforms.SetUniform3f("center", pointPos)
+ shaderUniforms.SetUniformf("radius", 50.)
- #------------------------------------------------------
+ # ------------------------------------------------------
# Replace the cropping implementation part of the
# raycasting shader to skip everything in the sphere
# defined by center and radius
- #------------------------------------------------------
+ # ------------------------------------------------------
croppingImplShaderCode = """
vec4 texCoordRAS = in_volumeMatrix[0] * in_textureDatasetMatrix[0] * vec4(g_dataPos, 1.);
g_skip = length(texCoordRAS.xyz - center) < radius;
@@ -256,16 +256,16 @@ def GetShaderPropertyNode():
shaderProp.ClearAllFragmentShaderReplacements()
shaderProp.AddFragmentShaderReplacement("//VTK::Cropping::Impl", True, croppingImplShaderCode, False)
- #------------------------------------------------------
+ # ------------------------------------------------------
# Add a callback when the point moves to adjust
# the center of the carving sphere accordingly
- #------------------------------------------------------
+ # ------------------------------------------------------
def onPointMoved():
p = GetPointPosition()
propNode = GetShaderPropertyNode()
- propNode.GetFragmentUniforms().SetUniform3f("center",p)
+ propNode.GetFragmentUniforms().SetUniform3f("center", p)
fn = slicer.util.getNode('vtkMRMLMarkupsFiducialNode1')
- fn.AddObserver(fn.PointModifiedEvent, lambda caller,event: onPointMoved())
+ fn.AddObserver(fn.PointModifiedEvent, lambda caller, event: onPointMoved())
self.delayDisplay("Should be a carved out nose now")
diff --git a/Applications/SlicerApp/Testing/Python/SliceLinkLogic.py b/Applications/SlicerApp/Testing/Python/SliceLinkLogic.py
index c703aaebcf0..5dfb2b86dee 100644
--- a/Applications/SlicerApp/Testing/Python/SliceLinkLogic.py
+++ b/Applications/SlicerApp/Testing/Python/SliceLinkLogic.py
@@ -17,16 +17,16 @@ class SliceLinkLogic(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
- parent.title = "SliceLinkLogic" # TODO make this more human readable by adding spaces
+ parent.title = "SliceLinkLogic" # TODO make this more human readable by adding spaces
parent.categories = ["Testing.TestCases"]
parent.dependencies = []
- parent.contributors = ["Jim Miller (GE)"] # replace with "Firstname Lastname (Org)"
+ parent.contributors = ["Jim Miller (GE)"] # replace with "Firstname Lastname (Org)"
parent.helpText = """
This module tests the Slice link logic
"""
parent.acknowledgementText = """
This file was originally developed by Jim Miller, GE and was partially funded by NIH grant U54EB005149.
-""" # replace with organization, grant and thanks.
+""" # replace with organization, grant and thanks.
#
@@ -80,7 +80,7 @@ class SliceLinkLogicLogic(ScriptedLoadableModuleLogic):
https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/ScriptedLoadableModule.py
"""
- def hasImageData(self,volumeNode):
+ def hasImageData(self, volumeNode):
"""This is a dummy logic method that
returns true if the passed in volume
node has valid image data
@@ -139,9 +139,9 @@ def test_SliceLinkLogic1(self):
volumeNode = slicer.util.getNode(pattern="FA")
logic = SliceLinkLogicLogic()
- self.assertIsNotNone( logic.hasImageData(volumeNode) )
+ self.assertIsNotNone(logic.hasImageData(volumeNode))
- eps = 0.02 # on high-DPI screens FOV difference can be up to 1.25%, so set the tolerance to 2%
+ eps = 0.02 # on high-DPI screens FOV difference can be up to 1.25%, so set the tolerance to 2%
print('eps = ' + str(eps) + '\n')
# Change to a CompareView
@@ -163,10 +163,10 @@ def test_SliceLinkLogic1(self):
self.delayDisplay('Linked the viewers (first Compare View)')
# Set the data to be same on all viewers
- logic.StartSliceCompositeNodeInteraction(1) #ForegroundVolumeFlag
+ logic.StartSliceCompositeNodeInteraction(1) # ForegroundVolumeFlag
compareCNode.SetForegroundVolumeID(volumeNode.GetID())
logic.EndSliceCompositeNodeInteraction()
- self.assertEqual( compareCNode.GetForegroundVolumeID(), volumeNode.GetID())
+ self.assertEqual(compareCNode.GetForegroundVolumeID(), volumeNode.GetID())
print('')
# Check that whether the volume was propagated
@@ -180,32 +180,32 @@ def test_SliceLinkLogic1(self):
print('')
# Set the orientation to axial
- logic.StartSliceNodeInteraction(12) #OrientationFlag & ResetFieldOfViewFlag
+ logic.StartSliceNodeInteraction(12) # OrientationFlag & ResetFieldOfViewFlag
compareNode.SetOrientation('Axial')
logic.FitSliceToAll()
compareNode.UpdateMatrices()
logic.EndSliceNodeInteraction()
# Reset the field of view
- logic.StartSliceNodeInteraction(8) #ResetFieldOfViewFlag
+ logic.StartSliceNodeInteraction(8) # ResetFieldOfViewFlag
logic.FitSliceToAll()
compareNode.UpdateMatrices()
logic.EndSliceNodeInteraction()
# Note: we validate on fov[1] when resetting the field of view (fov[0] can
# differ by a few units)
self.delayDisplay('Broadcasted a reset of the field of view to all Compare Views')
- diff = abs(compareNode2.GetFieldOfView()[1]-compareNode.GetFieldOfView()[1]) / compareNode.GetFieldOfView()[1]
+ diff = abs(compareNode2.GetFieldOfView()[1] - compareNode.GetFieldOfView()[1]) / compareNode.GetFieldOfView()[1]
print("Field of view of comparison (y) between compare viewers #1 and #2: " + str(diff))
self.assertLess(diff, eps)
- diff = abs(compareNode3.GetFieldOfView()[1]-compareNode.GetFieldOfView()[1]) / compareNode.GetFieldOfView()[1]
+ diff = abs(compareNode3.GetFieldOfView()[1] - compareNode.GetFieldOfView()[1]) / compareNode.GetFieldOfView()[1]
print("Field of view of comparison (y) between compare viewers #1 and #3: " + str(diff))
self.assertLess(diff, eps)
print('')
# Changed the number of lightboxes
ln.SetNumberOfCompareViewLightboxColumns(6)
- logic.StartSliceNodeInteraction(8) #ResetFieldOfViewFlag
+ logic.StartSliceNodeInteraction(8) # ResetFieldOfViewFlag
logic.FitSliceToAll()
compareNode.UpdateMatrices()
logic.EndSliceNodeInteraction()
@@ -213,64 +213,64 @@ def test_SliceLinkLogic1(self):
# Note: we validate on fov[1] when resetting the field of view (fov[0] can
# differ by a few units)
self.delayDisplay('Changed the number of lightboxes')
- diff = abs(compareNode2.GetFieldOfView()[1]-compareNode.GetFieldOfView()[1]) / compareNode.GetFieldOfView()[1]
+ diff = abs(compareNode2.GetFieldOfView()[1] - compareNode.GetFieldOfView()[1]) / compareNode.GetFieldOfView()[1]
print("Field of view of comparison (y) between compare viewers #1 and #2: " + str(diff))
self.assertLess(diff, eps)
- diff = abs(compareNode3.GetFieldOfView()[1]-compareNode.GetFieldOfView()[1]) / compareNode.GetFieldOfView()[1]
+ diff = abs(compareNode3.GetFieldOfView()[1] - compareNode.GetFieldOfView()[1]) / compareNode.GetFieldOfView()[1]
print("Field of view of comparison between compare viewers #1 and #3: " + str(diff))
self.assertLess(diff, eps)
print('')
# Pan
- logic.StartSliceNodeInteraction(32) #XYZOriginFlag
+ logic.StartSliceNodeInteraction(32) # XYZOriginFlag
xyz = compareNode.GetXYZOrigin()
compareNode.SetSliceOrigin(xyz[0] + 50, xyz[1] + 50, xyz[2])
logic.EndSliceNodeInteraction()
self.delayDisplay('Broadcasted a pan to all Compare Views')
- diff = abs(compareNode2.GetXYZOrigin()[0]-compareNode.GetXYZOrigin()[0])
+ diff = abs(compareNode2.GetXYZOrigin()[0] - compareNode.GetXYZOrigin()[0])
print("Origin comparison (x) between compare viewers #1 and #2: " + str(diff))
self.assertLess(diff, eps)
- diff = abs(compareNode3.GetXYZOrigin()[0]-compareNode.GetXYZOrigin()[0])
+ diff = abs(compareNode3.GetXYZOrigin()[0] - compareNode.GetXYZOrigin()[0])
print("Origin comparison (x) between compare viewers #1 and #3: " + str(diff))
self.assertLess(diff, eps)
print('')
# Zoom
- logic.StartSliceNodeInteraction(2) #FieldOfFlag
+ logic.StartSliceNodeInteraction(2) # FieldOfFlag
fov = compareNode.GetFieldOfView()
compareNode.SetFieldOfView(fov[0] * 0.5, fov[1] * 0.5, fov[2])
logic.EndSliceNodeInteraction()
# Note: we validate on fov[0] when zooming (fov[1] can differ by
# a few units)
self.delayDisplay('Broadcasted a zoom to all Compare Views')
- diff = abs(compareNode2.GetFieldOfView()[0]-compareNode.GetFieldOfView()[0]) / compareNode.GetFieldOfView()[0]
+ diff = abs(compareNode2.GetFieldOfView()[0] - compareNode.GetFieldOfView()[0]) / compareNode.GetFieldOfView()[0]
print("Field of view of comparison (x) between compare viewers #1 and #2: " + str(diff))
self.assertLess(diff, eps)
- diff = abs(compareNode3.GetFieldOfView()[0]-compareNode.GetFieldOfView()[0]) / compareNode.GetFieldOfView()[0]
+ diff = abs(compareNode3.GetFieldOfView()[0] - compareNode.GetFieldOfView()[0]) / compareNode.GetFieldOfView()[0]
print("Field of view of comparison (x) between compare viewers #1 and #3: " + str(diff))
self.assertLess(diff, eps)
print('')
# Change the slice
- logic.StartSliceNodeInteraction(1) #SliceToRAS
+ logic.StartSliceNodeInteraction(1) # SliceToRAS
logic.SetSliceOffset(80)
logic.EndSliceNodeInteraction()
self.delayDisplay('Broadcasted a change in slice offset to all Compare Views')
- diff = abs(compareNode2.GetSliceOffset()-compareNode.GetSliceOffset())
+ diff = abs(compareNode2.GetSliceOffset() - compareNode.GetSliceOffset())
print("Slice offset comparison between compare viewers #1 and #2: " + str(diff))
self.assertLess(diff, eps)
- diff = abs(compareNode3.GetSliceOffset()-compareNode.GetSliceOffset())
+ diff = abs(compareNode3.GetSliceOffset() - compareNode.GetSliceOffset())
print("Slice offset comparison between compare viewers #1 and #3: " + str(diff))
self.assertLess(diff, eps)
print('')
# Change the orientation
- logic.StartSliceNodeInteraction(12) #OrientationFlag & ResetFieldOfViewFlag
+ logic.StartSliceNodeInteraction(12) # OrientationFlag & ResetFieldOfViewFlag
compareNode.SetOrientation('Sagittal')
logic.FitSliceToAll()
compareNode.UpdateMatrices()
diff --git a/Applications/SlicerApp/Testing/Python/Slicer4Minute.py b/Applications/SlicerApp/Testing/Python/Slicer4Minute.py
index 2d5a112d60d..a634c038f95 100644
--- a/Applications/SlicerApp/Testing/Python/Slicer4Minute.py
+++ b/Applications/SlicerApp/Testing/Python/Slicer4Minute.py
@@ -17,16 +17,16 @@ class Slicer4Minute(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
- parent.title = "Slicer4Minute" # TODO make this more human readable by adding spaces
+ parent.title = "Slicer4Minute" # TODO make this more human readable by adding spaces
parent.categories = ["Testing.TestCases"]
parent.dependencies = []
- parent.contributors = ["Jim Miller (GE)"] # replace with "Firstname Lastname (Org)"
+ parent.contributors = ["Jim Miller (GE)"] # replace with "Firstname Lastname (Org)"
parent.helpText = """
Test suite for the Slicer 4 Minute tutorial
"""
parent.acknowledgementText = """
This file was originally developed by Jim Miller, GE and was partially funded by NIH grant U54EB005149.
-""" # replace with organization, grant and thanks.
+""" # replace with organization, grant and thanks.
#
@@ -80,7 +80,7 @@ class Slicer4MinuteLogic(ScriptedLoadableModuleLogic):
https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/ScriptedLoadableModule.py
"""
- def hasImageData(self,volumeNode):
+ def hasImageData(self, volumeNode):
"""This is a dummy logic method that
returns true if the passed in volume
node has valid image data
@@ -139,7 +139,7 @@ def test_Slicer4Minute1(self):
# check volume is loaded out of scene
volumeNode = slicer.util.getNode(pattern="grayscale")
- self.assertIsNotNone( logic.hasImageData(volumeNode) )
+ self.assertIsNotNone(logic.hasImageData(volumeNode))
# check the slice planes
red = slicer.util.getNode(pattern="vtkMRMLSliceNode1")
diff --git a/Applications/SlicerApp/Testing/Python/SlicerAppTesting.py b/Applications/SlicerApp/Testing/Python/SlicerAppTesting.py
index 8cc3c74a188..4134fecaf9a 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerAppTesting.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerAppTesting.py
@@ -36,8 +36,8 @@
__all__ = ['EXIT_FAILURE', 'EXIT_SUCCESS', 'run', 'runSlicer', 'runSlicerAndExit', 'timecall']
-EXIT_FAILURE=1
-EXIT_SUCCESS=0
+EXIT_FAILURE = 1
+EXIT_SUCCESS = 0
def dropcache():
diff --git a/Applications/SlicerApp/Testing/Python/SlicerBoundsTest.py b/Applications/SlicerApp/Testing/Python/SlicerBoundsTest.py
index 5a33914bb3b..7acfbafbdf7 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerBoundsTest.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerBoundsTest.py
@@ -72,7 +72,7 @@ def runTest(self):
def test_Volume(self):
""" Test the GetRASBounds & GetBounds method on a volume.
"""
- #self.delayDisplay("Starting test_Volume")
+ # self.delayDisplay("Starting test_Volume")
import SampleData
volumeNode = SampleData.downloadSample('CTAAbdomenPanoramix')
@@ -98,12 +98,12 @@ def test_Volume(self):
volumeNode.GetBounds(bounds)
self.assertListAlmostEquals(bounds, untransformedBounds)
- #self.delayDisplay('test_Volume passed!')
+ # self.delayDisplay('test_Volume passed!')
def test_Model(self):
""" Test the GetRASBounds & GetBounds method on a model.
"""
- #self.delayDisplay("Starting test_Model")
+ # self.delayDisplay("Starting test_Model")
# Setup
cubeSource = vtk.vtkCubeSource()
cubeSource.SetXLength(500)
@@ -146,12 +146,12 @@ def test_Model(self):
modelNode.GetBounds(bounds)
self.assertListAlmostEquals(bounds, untransformedBounds)
- #self.delayDisplay('test_Model passed!')
+ # self.delayDisplay('test_Model passed!')
def test_Segmentation(self):
""" Test the GetRASBounds & GetBounds method on a segmentation.
"""
- #self.delayDisplay("Starting test_Segmentation")
+ # self.delayDisplay("Starting test_Segmentation")
cubeSource = vtk.vtkCubeSource()
cubeSource.SetXLength(500)
cubeSource.SetYLength(200)
@@ -198,12 +198,12 @@ def test_Segmentation(self):
segmentationNode.GetBounds(bounds)
self.assertListAlmostEquals(bounds, untransformedBounds)
- #self.delayDisplay('test_Segmentation passed!')
+ # self.delayDisplay('test_Segmentation passed!')
def test_Markup(self):
""" Test the GetRASBounds & GetBounds method on a markup.
"""
- #self.delayDisplay("Starting test_Markup")
+ # self.delayDisplay("Starting test_Markup")
markupNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLMarkupsFiducialNode")
markupNode.AddControlPoint([1.0, 0.0, 0.0])
markupNode.AddControlPoint([-45.0, -90.0, -180.0])
@@ -232,12 +232,12 @@ def test_Markup(self):
markupNode.GetBounds(bounds)
self.assertListAlmostEquals(bounds, untransformedBounds)
- #self.delayDisplay('test_Markup passed!')
+ # self.delayDisplay('test_Markup passed!')
def test_ROI(self):
""" Test the GetRASBounds & GetBounds method on a ROI.
"""
- #self.delayDisplay("Starting test_ROI")
+ # self.delayDisplay("Starting test_ROI")
roiNode = slicer.mrmlScene.AddNode(slicer.vtkMRMLAnnotationROINode())
roiNode.SetXYZ(100, 300, -0.689)
roiNode.SetRadiusXYZ(700, 8, 45)
@@ -265,4 +265,4 @@ def test_ROI(self):
roiNode.GetBounds(bounds)
self.assertListAlmostEquals(bounds, untransformedBounds)
- #self.delayDisplay('test_ROI passed!')
+ # self.delayDisplay('test_ROI passed!')
diff --git a/Applications/SlicerApp/Testing/Python/SlicerCreateRulerCrashIssue4199.py b/Applications/SlicerApp/Testing/Python/SlicerCreateRulerCrashIssue4199.py
index c0873b33e1d..d0342a51dbf 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerCreateRulerCrashIssue4199.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerCreateRulerCrashIssue4199.py
@@ -18,7 +18,7 @@ def __init__(self, parent):
self.parent.title = "Create ruler crash (Issue 4199)"
self.parent.categories = ["Testing.TestCases"]
self.parent.dependencies = []
- self.parent.contributors = ["Jean-Christophe Fillion-Robin (Kitware)"] # replace with "Firstname Lastname (Organization)"
+ self.parent.contributors = ["Jean-Christophe Fillion-Robin (Kitware)"] # replace with "Firstname Lastname (Organization)"
self.parent.helpText = """This test has been added to check that
Slicer does not crash after creating a ruler and entering
the Annotations module.
@@ -28,7 +28,7 @@ def __init__(self, parent):
self.parent.acknowledgementText = """
This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
and was partially funded by NIH grant 1U24CA194354-01.
- """ # replace with organization, grant and thanks.
+ """ # replace with organization, grant and thanks.
#
@@ -58,7 +58,7 @@ class SlicerCreateRulerCrashIssue4199Logic(ScriptedLoadableModuleLogic):
https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/ScriptedLoadableModule.py
"""
- def hasImageData(self,volumeNode):
+ def hasImageData(self, volumeNode):
"""This is an example logic method that
returns true if the passed in volume
node has valid image data
diff --git a/Applications/SlicerApp/Testing/Python/SlicerMRBMultipleSaveRestoreLoopTest.py b/Applications/SlicerApp/Testing/Python/SlicerMRBMultipleSaveRestoreLoopTest.py
index ca87884558d..df078f8fb7c 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerMRBMultipleSaveRestoreLoopTest.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerMRBMultipleSaveRestoreLoopTest.py
@@ -127,7 +127,7 @@ def test_SlicerMRBMultipleSaveRestoreLoop(self):
mrbLoaded = ioManager.loadScene(mrbFilePath)
# load can return false even though it succeeded - only fail if in strict mode
- self.assertTrue( not self.strict or mrbLoaded )
+ self.assertTrue(not self.strict or mrbLoaded)
slicer.app.processEvents()
# confirm that MRHead is in the background of the Red slice
@@ -147,11 +147,11 @@ def test_SlicerMRBMultipleSaveRestoreLoop(self):
pointListNode.SetNthControlPointPosition(0, self.pointPosition)
self.delayDisplay("Loop Finished")
- print(('Point position from loop = ',self.pointPosition))
+ print(('Point position from loop = ', self.pointPosition))
pointListNode = slicer.util.getNode('F')
- finalPointPosition = [ 0,0,0 ]
+ finalPointPosition = [0, 0, 0]
pointListNode.GetNthControlPointPosition(0, finalPointPosition)
- print(('Final point scene pos = ',finalPointPosition))
+ print(('Final point scene pos = ', finalPointPosition))
self.assertEqual(self.pointPosition, finalPointPosition)
self.delayDisplay("Test Finished")
diff --git a/Applications/SlicerApp/Testing/Python/SlicerMRBMultipleSaveRestoreTest.py b/Applications/SlicerApp/Testing/Python/SlicerMRBMultipleSaveRestoreTest.py
index d9b2beacca2..cbe51a83c7b 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerMRBMultipleSaveRestoreTest.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerMRBMultipleSaveRestoreTest.py
@@ -49,7 +49,7 @@ class SlicerMRBMultipleSaveRestore(ScriptedLoadableModuleTest):
https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/ScriptedLoadableModule.py
"""
- def __init__(self,methodName='runTest',uniqueDirectory=True,strict=False):
+ def __init__(self, methodName='runTest', uniqueDirectory=True, strict=False):
"""
Tests the use of mrml and mrb save formats with volumes and markups points lists.
Checks that scene views are saved and restored as expected.
@@ -91,7 +91,7 @@ def test_SlicerMRBMultipleSaveRestore(self):
mrHeadVolume = SampleData.downloadSample("MRHead")
# Place a control point
- pointListNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLMarkupsFiducialNode","F")
+ pointListNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLMarkupsFiducialNode", "F")
pointListNode.CreateDefaultDisplayNodes()
eye = [33.4975, 79.4042, -10.2143]
nose = [-2.145, 116.14, -43.31]
@@ -103,7 +103,7 @@ def test_SlicerMRBMultipleSaveRestore(self):
# confirm that MRHead is in the background of the Red slice
redComposite = slicer.util.getNode('vtkMRMLSliceCompositeNodeRed')
mrHead = slicer.util.getNode('MRHead')
- self.assertEqual( redComposite.GetBackgroundVolumeID(), mrHead.GetID() )
+ self.assertEqual(redComposite.GetBackgroundVolumeID(), mrHead.GetID())
self.delayDisplay('The MRHead volume is in the background of the Red viewer')
# turn off visibility save scene view
@@ -126,7 +126,7 @@ def test_SlicerMRBMultipleSaveRestore(self):
)
self.delayDisplay("Finished saving scene")
self.assertTrue(
- applicationLogic.Zip(mrbFilePath,sceneSaveDirectory)
+ applicationLogic.Zip(mrbFilePath, sceneSaveDirectory)
)
self.delayDisplay("Finished saving MRB")
self.delayDisplay("Slicer mrml scene root dir after first save = %s" % slicer.mrmlScene.GetRootDirectory())
@@ -139,14 +139,14 @@ def test_SlicerMRBMultipleSaveRestore(self):
self.delayDisplay('Now, reload the saved MRB')
mrbLoaded = applicationLogic.OpenSlicerDataBundle(mrbFilePath, mrbExtractPath)
# load can return false even though it succeeded - only fail if in strict mode
- self.assertTrue( not self.strict or mrbLoaded )
+ self.assertTrue(not self.strict or mrbLoaded)
slicer.app.processEvents()
# confirm again that MRHead is in the background of the Red slice
self.delayDisplay('Is the MHRead volume AGAIN in the background of the Red viewer?')
redComposite = slicer.util.getNode('vtkMRMLSliceCompositeNodeRed')
mrHead = slicer.util.getNode('MRHead')
- self.assertEqual( redComposite.GetBackgroundVolumeID(), mrHead.GetID() )
+ self.assertEqual(redComposite.GetBackgroundVolumeID(), mrHead.GetID())
self.delayDisplay('The MRHead volume is AGAIN in the background of the Red viewer')
# confirm that the point list exists with two points
@@ -170,14 +170,14 @@ def test_SlicerMRBMultipleSaveRestore(self):
# Save it again
#
sceneSaveDirectory = slicer.util.tempDirectory('__scene2__')
- mrbFilePath= slicer.util.tempDirectory('__mrb__') + '/SlicerMRBMultipleSaveRestore-2.mrb'
+ mrbFilePath = slicer.util.tempDirectory('__mrb__') + '/SlicerMRBMultipleSaveRestore-2.mrb'
self.delayDisplay("Saving scene to: %s\n" % sceneSaveDirectory + "Saving mrb to: %s" % mrbFilePath)
self.assertTrue(
applicationLogic.SaveSceneToSlicerDataBundleDirectory(sceneSaveDirectory, None)
)
self.delayDisplay("Finished saving scene after restoring a scene view")
self.assertTrue(
- applicationLogic.Zip(mrbFilePath,sceneSaveDirectory)
+ applicationLogic.Zip(mrbFilePath, sceneSaveDirectory)
)
self.delayDisplay("Finished saving MRB after restoring a scene view")
@@ -191,14 +191,14 @@ def test_SlicerMRBMultipleSaveRestore(self):
self.delayDisplay('Now, reload the second saved MRB %s' % mrbFilePath)
mrbLoaded = applicationLogic.OpenSlicerDataBundle(mrbFilePath, mrbExtractPath)
# load can return false even though it succeeded - only fail if in strict mode
- self.assertTrue( not self.strict or mrbLoaded )
+ self.assertTrue(not self.strict or mrbLoaded)
slicer.app.processEvents()
# confirm that MRHead is in the background of the Red slice after mrb reload
self.delayDisplay('MRHead volume is the background of the Red viewer after mrb reload?')
redComposite = slicer.util.getNode('vtkMRMLSliceCompositeNodeRed')
fa = slicer.util.getNode('MRHead')
- self.assertEqual( redComposite.GetBackgroundVolumeID(), mrHead.GetID() )
+ self.assertEqual(redComposite.GetBackgroundVolumeID(), mrHead.GetID())
self.delayDisplay('Yes, the MRHead volume is back in the background of the Red viewer')
# confirm that the point list exists with two points
@@ -210,7 +210,7 @@ def test_SlicerMRBMultipleSaveRestore(self):
self.delayDisplay("Test Finished")
- def storeSceneView(self,name,description=""):
+ def storeSceneView(self, name, description=""):
""" Store a scene view into the current scene.
TODO: this might move to slicer.util
"""
diff --git a/Applications/SlicerApp/Testing/Python/SlicerMRBSaveRestoreCheckPathsTest.py b/Applications/SlicerApp/Testing/Python/SlicerMRBSaveRestoreCheckPathsTest.py
index a2fc507914e..a1be31f73a4 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerMRBSaveRestoreCheckPathsTest.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerMRBSaveRestoreCheckPathsTest.py
@@ -72,7 +72,7 @@ def runTest(self):
def getStorableNode(self, storageNode):
numberOfStorableNodes = storageNode.GetScene().GetNumberOfNodesByClass('vtkMRMLStorableNode')
for n in range(numberOfStorableNodes):
- storableNode = storageNode.GetScene().GetNthNodeByClass(n,'vtkMRMLStorableNode')
+ storableNode = storageNode.GetScene().GetNthNodeByClass(n, 'vtkMRMLStorableNode')
if storableNode.GetStorageNodeID() == storageNode.GetID():
return storableNode
return None
@@ -85,22 +85,22 @@ def checkSceneFileNames(self, scene):
# first get the main scene storage nodes
numberOfStorageNodes = scene.GetNumberOfNodesByClass('vtkMRMLStorageNode')
for n in range(numberOfStorageNodes):
- storageNode = scene.GetNthNodeByClass(n,'vtkMRMLStorageNode')
+ storageNode = scene.GetNthNodeByClass(n, 'vtkMRMLStorageNode')
storableNode = self.getStorableNode(storageNode)
if storageNode.GetSaveWithScene() and not storableNode.GetModifiedSinceRead():
- print('Checking storage node: ',storageNode.GetID())
+ print('Checking storage node: ', storageNode.GetID())
fileName = storageNode.GetFileName()
absFileName = storageNode.GetAbsoluteFilePath(fileName)
if not absFileName:
- print('\tUnable to get absolute path for file name ',fileName)
+ print('\tUnable to get absolute path for file name ', fileName)
self.numberOfFilesNotFound += 1
elif not os.path.exists(absFileName):
- print('\tfile does not exist: ',absFileName)
- print('\t\tnon absolute file name = ',fileName)
- print('\t\tscene of the node root dir = ',storageNode.GetScene().GetRootDirectory())
+ print('\tfile does not exist: ', absFileName)
+ print('\t\tnon absolute file name = ', fileName)
+ print('\t\tscene of the node root dir = ', storageNode.GetScene().GetRootDirectory())
if storableNode is not None:
- print('\t\tstorable node name = ',storableNode.GetName())
- print('\t\tmodified since read = ',storableNode.GetModifiedSinceRead())
+ print('\t\tstorable node name = ', storableNode.GetName())
+ print('\t\tmodified since read = ', storableNode.GetModifiedSinceRead())
else:
print('\t\tNo storable node found for this storage node')
# double check that it's not due to the unzipped files being deleted
@@ -109,14 +109,14 @@ def checkSceneFileNames(self, scene):
else:
print('\t\tMRB files were deleted after load, not counting this file as not found for the purposes of this test')
else:
- print('\tfile exists:',absFileName)
+ print('\tfile exists:', absFileName)
# check for the file list
numberOfFileNames = storageNode.GetNumberOfFileNames()
for n in range(numberOfFileNames):
fileName = storageNode.GetNthFileName(n)
absFileName = storageNode.GetAbsoluteFilePath(fileName)
if not os.path.exists(absFileName):
- print('\t',n,'th file list member does not exist: ',absFileName)
+ print('\t', n, 'th file list member does not exist: ', absFileName)
if (not self.mrbDeleteFilesAfterLoad) or ('BundleSaveTemp' in absFileName):
self.numberOfFilesNotFound += 1
else:
@@ -139,7 +139,7 @@ def checkAllFileNames(self, scene):
self.checkSceneFileNames(scene)
self.checkSceneViewFileNames(scene)
if self.numberOfFilesNotFound != 0:
- print('checkAllFilesNames: there are ',self.numberOfFilesNotFound,'files that are missing from disk\n')
+ print('checkAllFilesNames: there are ', self.numberOfFilesNotFound, 'files that are missing from disk\n')
self.assertEqual(self.numberOfFilesNotFound, 0)
def test_SlicerMRBSaveRestoreCheckPaths(self):
@@ -199,7 +199,7 @@ def test_SlicerMRBSaveRestoreCheckPaths(self):
#
# save the mrb
#
- mrbFilePath= slicer.util.tempDirectory('__mrb__') + '/SlicerMRBSaveRestoreCheckPaths-1.mrb'
+ mrbFilePath = slicer.util.tempDirectory('__mrb__') + '/SlicerMRBSaveRestoreCheckPaths-1.mrb'
slicer.util.delayDisplay("\n\n\nSaving mrb to: %s" % mrbFilePath)
self.assertTrue(
ioManager.saveScene(mrbFilePath, screenShot)
@@ -218,7 +218,7 @@ def test_SlicerMRBSaveRestoreCheckPaths(self):
slicer.util.delayDisplay('Now, reload the first saved MRB\n\n\n')
mrbLoaded = ioManager.loadScene(mrbFilePath)
# load can return false even though it succeeded - only fail if in strict mode
- self.assertTrue( not self.strict or mrbLoaded )
+ self.assertTrue(not self.strict or mrbLoaded)
slicer.app.processEvents()
slicer.util.delayDisplay("\n\n\nFinished reloading the first saved MRB\n\n\n")
#
@@ -229,7 +229,7 @@ def test_SlicerMRBSaveRestoreCheckPaths(self):
#
# Save it again
#
- mrbFilePath= slicer.util.tempDirectory('__mrb__') + '/SlicerMRBSaveRestoreCheckPaths-2.mrb'
+ mrbFilePath = slicer.util.tempDirectory('__mrb__') + '/SlicerMRBSaveRestoreCheckPaths-2.mrb'
slicer.util.delayDisplay("Saving second mrb to: %s\n\n\n\n" % mrbFilePath)
self.assertTrue(
ioManager.saveScene(mrbFilePath, screenShot)
diff --git a/Applications/SlicerApp/Testing/Python/SlicerOptionDisableSettingsTest.py b/Applications/SlicerApp/Testing/Python/SlicerOptionDisableSettingsTest.py
index 96f9c797382..3cc52603657 100755
--- a/Applications/SlicerApp/Testing/Python/SlicerOptionDisableSettingsTest.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerOptionDisableSettingsTest.py
@@ -93,7 +93,7 @@ def checkKeepTemporarySettingsWithoutDisableSettingsDisplayWarning(slicer_execut
if __name__ == '__main__':
if len(sys.argv) != 2:
- print(os.path.basename(sys.argv[0]) +" /path/to/Slicer")
+ print(os.path.basename(sys.argv[0]) + " /path/to/Slicer")
exit(EXIT_FAILURE)
slicer_executable = os.path.expanduser(sys.argv[1])
diff --git a/Applications/SlicerApp/Testing/Python/SlicerOptionIgnoreSlicerRCTest.py b/Applications/SlicerApp/Testing/Python/SlicerOptionIgnoreSlicerRCTest.py
index 3d5b4ee3cdf..818db6d0343 100755
--- a/Applications/SlicerApp/Testing/Python/SlicerOptionIgnoreSlicerRCTest.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerOptionIgnoreSlicerRCTest.py
@@ -31,12 +31,12 @@
if __name__ == '__main__':
- debug = False # Set to True to:
+ debug = False # Set to True to:
# * display the path of the created slicerrc file
# * avoid deleting the slicerrc file
if len(sys.argv) != 2:
- print(os.path.basename(sys.argv[0]) +" /path/to/Slicer")
+ print(os.path.basename(sys.argv[0]) + " /path/to/Slicer")
exit(EXIT_FAILURE)
slicer_executable = os.path.expanduser(sys.argv[1])
@@ -48,10 +48,10 @@
# Create a slicerrc file that creates SLICERRCTESTOUTPUT file when executed
with os.fdopen(fd, 'w') as file:
- file.write("# Generated by SlicerOptionIgnoreSlicerRCTest.py\n"+\
- "import os\n"+\
- "fd = os.open(os.environ['SLICERRCTESTOUTPUT'], os.O_RDWR|os.O_CREAT)\n"+\
- "os.write(fd, 'Generated by SlicerOptionIgnoreSlicerRCTest.py test when slicerrc executed'.encode())\n"+\
+ file.write("# Generated by SlicerOptionIgnoreSlicerRCTest.py\n" +\
+ "import os\n" +\
+ "fd = os.open(os.environ['SLICERRCTESTOUTPUT'], os.O_RDWR|os.O_CREAT)\n" +\
+ "os.write(fd, 'Generated by SlicerOptionIgnoreSlicerRCTest.py test when slicerrc executed'.encode())\n" +\
"os.close(fd)\n")
slicerrctestoutput = slicerrc + ".out"
diff --git a/Applications/SlicerApp/Testing/Python/SlicerOptionModulesToIgnoreTest.py b/Applications/SlicerApp/Testing/Python/SlicerOptionModulesToIgnoreTest.py
index 64f5167f6dd..e422f463ce5 100755
--- a/Applications/SlicerApp/Testing/Python/SlicerOptionModulesToIgnoreTest.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerOptionModulesToIgnoreTest.py
@@ -32,12 +32,12 @@
if __name__ == '__main__':
- debug = False # Set to True to:
+ debug = False # Set to True to:
# * display the path of the created extension_dir
# * avoid deleting the extension_dir
if len(sys.argv) != 3:
- print(os.path.basename(sys.argv[0]) +" /path/to/Slicer /path/to/slicerExtensionWizard")
+ print(os.path.basename(sys.argv[0]) + " /path/to/Slicer /path/to/slicerExtensionWizard")
exit(EXIT_FAILURE)
slicer_executable = os.path.expanduser(sys.argv[1])
diff --git a/Applications/SlicerApp/Testing/Python/SlicerOrientationSelectorTest.py b/Applications/SlicerApp/Testing/Python/SlicerOrientationSelectorTest.py
index b92e1a38d5a..045236bdbbb 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerOrientationSelectorTest.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerOrientationSelectorTest.py
@@ -19,14 +19,14 @@ def __init__(self, parent):
self.parent.categories = ["Testing.TestCases"]
self.parent.dependencies = []
self.parent.contributors = ["Jean-Christophe Fillion-Robin (Kitware)",
- "Davide Punzo (Kapteyn astronomical institute)"] # replace with "Firstname Lastname (Organization)"
+ "Davide Punzo (Kapteyn astronomical institute)"] # replace with "Firstname Lastname (Organization)"
self.parent.helpText = """This test has been added to check that
orientation selector is correctly updated when updating the SliceToRAS matrix.
"""
self.parent.acknowledgementText = """
This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
and was partially funded by NIH grant 1U24CA194354-01.
- """ # replace with organization, grant and thanks.
+ """ # replace with organization, grant and thanks.
#
@@ -56,7 +56,7 @@ class SlicerOrientationSelectorTestLogic(ScriptedLoadableModuleLogic):
https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/ScriptedLoadableModule.py
"""
- def hasImageData(self,volumeNode):
+ def hasImageData(self, volumeNode):
"""This is an example logic method that
returns true if the passed in volume
node has valid image data
diff --git a/Applications/SlicerApp/Testing/Python/SlicerRestoreSceneViewCrashIssue3445.py b/Applications/SlicerApp/Testing/Python/SlicerRestoreSceneViewCrashIssue3445.py
index 39d296c8386..bc9f0161ab1 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerRestoreSceneViewCrashIssue3445.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerRestoreSceneViewCrashIssue3445.py
@@ -17,7 +17,7 @@ def __init__(self, parent):
self.parent.title = "SceneView restore crash (Issue 3445)"
self.parent.categories = ["Testing.TestCases"]
self.parent.dependencies = []
- self.parent.contributors = ["Jean-Christophe Fillion-Robin (Kitware)"] # replace with "Firstname Lastname (Organization)"
+ self.parent.contributors = ["Jean-Christophe Fillion-Robin (Kitware)"] # replace with "Firstname Lastname (Organization)"
self.parent.helpText = """This test has been added to check that
Slicer does not crash while restoring scene view associated with BrainAtlas2012.mrb.
@@ -26,7 +26,7 @@ def __init__(self, parent):
self.parent.acknowledgementText = """
This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
and was partially funded by NIH grant 1U24CA194354-01.
- """ # replace with organization, grant and thanks.
+ """ # replace with organization, grant and thanks.
#
diff --git a/Applications/SlicerApp/Testing/Python/SlicerScriptedFileReaderWriterTest.py b/Applications/SlicerApp/Testing/Python/SlicerScriptedFileReaderWriterTest.py
index 9e7e2eb48cb..3ea00df1bb8 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerScriptedFileReaderWriterTest.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerScriptedFileReaderWriterTest.py
@@ -65,7 +65,7 @@ def load(self, properties):
baseName = slicer.mrmlScene.GenerateUniqueName(baseName)
# Read file content
- with open (filePath) as myfile:
+ with open(filePath) as myfile:
data = myfile.readlines()
# Check if file is valid
@@ -81,7 +81,7 @@ def load(self, properties):
# self.parent.userMessages().AddMessage(vtk.vtkCommand.WarningEvent, "This is a warning message")
except Exception as e:
- logging.error('Failed to load file: '+str(e))
+ logging.error('Failed to load file: ' + str(e))
import traceback
traceback.print_exc()
return False
@@ -119,12 +119,12 @@ def write(self, properties):
# Write node content to file
filePath = properties['fileName']
- with open (filePath, 'w') as myfile:
+ with open(filePath, 'w') as myfile:
myfile.write("magic\n")
myfile.write(node.GetText())
except Exception as e:
- logging.error('Failed to write file: '+str(e))
+ logging.error('Failed to write file: ' + str(e))
import traceback
traceback.print_exc()
return False
diff --git a/Applications/SlicerApp/Testing/Python/SlicerStartupCompletedTest.py b/Applications/SlicerApp/Testing/Python/SlicerStartupCompletedTest.py
index 830bf84ae16..72904a7dc86 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerStartupCompletedTest.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerStartupCompletedTest.py
@@ -36,22 +36,22 @@
if __name__ == '__main__':
- debug = False # Set to True to:
+ debug = False # Set to True to:
# * display the path of the expected test output file
# * avoid deleting the created temporary directory
if len(sys.argv) != 2:
- print(os.path.basename(sys.argv[0]) +" /path/to/Slicer")
+ print(os.path.basename(sys.argv[0]) + " /path/to/Slicer")
exit(EXIT_FAILURE)
- temporaryModuleDirPath = tempfile.mkdtemp().replace('\\','/')
+ temporaryModuleDirPath = tempfile.mkdtemp().replace('\\', '/')
try:
# Copy helper module that creates a file when startup completed event is received
- currentDirPath = os.path.dirname(__file__).replace('\\','/')
+ currentDirPath = os.path.dirname(__file__).replace('\\', '/')
from shutil import copyfile
- copyfile(currentDirPath+'/SlicerStartupCompletedTestHelperModule.py',
- temporaryModuleDirPath+'/SlicerStartupCompletedTestHelperModule.py')
+ copyfile(currentDirPath + '/SlicerStartupCompletedTestHelperModule.py',
+ temporaryModuleDirPath + '/SlicerStartupCompletedTestHelperModule.py')
slicer_executable = os.path.expanduser(sys.argv[1])
common_args = [
diff --git a/Applications/SlicerApp/Testing/Python/SlicerStartupCompletedTestHelperModule.py b/Applications/SlicerApp/Testing/Python/SlicerStartupCompletedTestHelperModule.py
index 38e2e3d3d14..fdc92f6f084 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerStartupCompletedTestHelperModule.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerStartupCompletedTestHelperModule.py
@@ -24,7 +24,7 @@ def __init__(self, parent):
def onStartupCompleted(self):
print("StartupCompleted emitted")
import os
- fd = os.open(self.testOutputFileName, os.O_RDWR|os.O_CREAT)
+ fd = os.open(self.testOutputFileName, os.O_RDWR | os.O_CREAT)
os.write(fd, 'SlicerStartupCompletedTestHelperModule.py generated this file')
os.write(fd, 'when slicer.app emitted startupCompleted() signal\n')
os.close(fd)
diff --git a/Applications/SlicerApp/Testing/Python/SlicerTransformInteractionTest1.py b/Applications/SlicerApp/Testing/Python/SlicerTransformInteractionTest1.py
index 6638848eba8..67246b5aecd 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerTransformInteractionTest1.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerTransformInteractionTest1.py
@@ -86,7 +86,7 @@ def assertTransform(self, t, expected):
def assertMatrix(self, m, expected):
for i in range(4):
for j in range(4):
- self.assertAlmostEqual(m.GetElement(i,j), expected[i][j])
+ self.assertAlmostEqual(m.GetElement(i, j), expected[i][j])
def runTest(self):
"""Run as few or as many tests as needed here.
@@ -104,7 +104,7 @@ def test_3D_interactionDefaults(self):
"""
logic = SlicerTransformInteractionTest1Logic()
- #self.delayDisplay("Starting test_3D_interactionDefaults")
+ # self.delayDisplay("Starting test_3D_interactionDefaults")
logic = SlicerTransformInteractionTest1Logic()
tNode, tdNode = logic.addTransform()
self.assertFalse(tdNode.GetEditorVisibility())
@@ -128,14 +128,14 @@ def test_3D_interactionDefaults(self):
representation.GetTransform(defaultTransform)
expectedDefaultTransform = [
- [100.0, 0.0, 0.0, 0.0],
- [0.0, 100.0, 0.0, 0.0],
- [0.0, 0.0, 100.0, 0.0],
- [0.0, 0.0, 0.0, 1.0],
+ [100.0, 0.0, 0.0, 0.0],
+ [0.0, 100.0, 0.0, 0.0],
+ [0.0, 0.0, 100.0, 0.0],
+ [0.0, 0.0, 0.0, 1.0],
]
self.assertTransform(defaultTransform, expectedDefaultTransform)
- #self.delayDisplay('test_3D_interactionDefaults passed!')
+ # self.delayDisplay('test_3D_interactionDefaults passed!')
def test_3D_interactionVolume(self):
""" Test that the interaction widget interacts correctly in the 3D view.
@@ -145,7 +145,7 @@ def test_3D_interactionVolume(self):
import SampleData
volume = SampleData.downloadSample('CTAAbdomenPanoramix')
- #self.delayDisplay("Starting test_3D_interactionVolume")
+ # self.delayDisplay("Starting test_3D_interactionVolume")
logic = SlicerTransformInteractionTest1Logic()
tNode, tdNode = logic.addTransform()
self.assertFalse(tdNode.GetEditorVisibility())
@@ -167,10 +167,10 @@ def test_3D_interactionVolume(self):
transform = vtk.vtkTransform()
expectedDefaultTransform = [
- [100.0, 0.0, 0.0, 0.0],
- [0.0, 100.0, 0.0, 0.0],
- [0.0, 0.0, 100.0, 0.0],
- [0.0, 0.0, 0.0, 1.0],
+ [100.0, 0.0, 0.0, 0.0],
+ [0.0, 100.0, 0.0, 0.0],
+ [0.0, 0.0, 100.0, 0.0],
+ [0.0, 0.0, 0.0, 1.0],
]
representation.GetTransform(transform)
self.assertTransform(transform, expectedDefaultTransform)
@@ -179,10 +179,10 @@ def test_3D_interactionVolume(self):
volume.SetAndObserveTransformNodeID(tNode.GetID())
tdNode.UpdateEditorBounds()
volumeTransform = [
- [654.609375, 0.0, 0.0, -2.030487060546875],
- [0.0, 476.484375, 0.0, 126.66322422027588],
- [0.0, 0.0, 645.0, -186.37799072265625],
- [0.0, 0.0, 0.0, 1.0],
+ [654.609375, 0.0, 0.0, -2.030487060546875],
+ [0.0, 476.484375, 0.0, 126.66322422027588],
+ [0.0, 0.0, 645.0, -186.37799072265625],
+ [0.0, 0.0, 0.0, 1.0],
]
representation.GetTransform(transform)
self.assertTransform(transform, volumeTransform)
@@ -226,7 +226,7 @@ def test_3D_interactionVolume(self):
self.assertTransform(transform, defaultPlusMoveTransform)
##
- ## 1- With rotate transform (and translation)
+ # 1- With rotate transform (and translation)
##
# Add a rotation to the transform
rotation = vtk.vtkTransform()
@@ -235,10 +235,10 @@ def test_3D_interactionVolume(self):
tNode.ApplyTransformMatrix(rotation.GetMatrix())
defaultPlusMovePlusRotationTransform = [
- defaultPlusMoveTransform[2], #[0.0, 0.0, 100.0, 0.2]
- defaultPlusMoveTransform[0], #[100.0, 0.0, 0.0, -42.0]
- defaultPlusMoveTransform[1], #[0.0, 100.0, 0.0, 52.0]
- defaultPlusMoveTransform[3] #[0.0, 0.0, 0.0, 1.0],
+ defaultPlusMoveTransform[2], # [0.0, 0.0, 100.0, 0.2]
+ defaultPlusMoveTransform[0], # [100.0, 0.0, 0.0, -42.0]
+ defaultPlusMoveTransform[1], # [0.0, 100.0, 0.0, 52.0]
+ defaultPlusMoveTransform[3] # [0.0, 0.0, 0.0, 1.0],
]
representation.GetTransform(transform)
self.assertTransform(transform, defaultPlusMovePlusRotationTransform)
@@ -263,10 +263,10 @@ def test_3D_interactionVolume(self):
self.assertTransform(transform, defaultPlusMovePlusRotationTransform)
##
- ## 1- With scaling transform (and rotation and translation)
+ # 1- With scaling transform (and rotation and translation)
##
# Add a rotation to the transform
- scale = [2.0, 3.0, 7.0, 1.0] # nice prime numbers
+ scale = [2.0, 3.0, 7.0, 1.0] # nice prime numbers
scaling = vtk.vtkTransform()
scaling.Scale(scale[0], scale[1], scale[2])
tNode.ApplyTransformMatrix(scaling.GetMatrix())
@@ -274,7 +274,7 @@ def test_3D_interactionVolume(self):
defaultPlusMovePlusRotationPlusScalingTransform = []
for i in range(4):
defaultPlusMovePlusRotationPlusScalingTransform.append(
- [x*scale[i] for x in defaultPlusMovePlusRotationTransform[i]])
+ [x * scale[i] for x in defaultPlusMovePlusRotationTransform[i]])
representation.GetTransform(transform)
self.assertTransform(transform, defaultPlusMovePlusRotationPlusScalingTransform)
@@ -283,7 +283,7 @@ def test_3D_interactionVolume(self):
volumePlusMovePlusRotationPlusScalingTransform = []
for i in range(4):
volumePlusMovePlusRotationPlusScalingTransform.append(
- [x*scale[i] for x in volumePlusMovePlusRotationTransform[i]])
+ [x * scale[i] for x in volumePlusMovePlusRotationTransform[i]])
volume.SetAndObserveTransformNodeID(tNode.GetID())
tdNode.UpdateEditorBounds()
@@ -296,12 +296,12 @@ def test_3D_interactionVolume(self):
representation.GetTransform(transform)
self.assertTransform(transform, defaultPlusMovePlusRotationPlusScalingTransform)
- #self.delayDisplay('test_3D_interactionVolume passed!')
+ # self.delayDisplay('test_3D_interactionVolume passed!')
def test_3D_interaction2Models(self):
""" Test that the interaction widget works with multiple models.
"""
- #self.delayDisplay("Starting test_3D_interaction2Models")
+ # self.delayDisplay("Starting test_3D_interaction2Models")
#
# Setup:
# 1. Create 2 cubes:
@@ -365,10 +365,10 @@ def test_3D_interaction2Models(self):
# Check default widget transform values
expectedDefaultTransform = [
- [100.0, 0.0, 0.0, 0.0],
- [0.0, 100.0, 0.0, 0.0],
- [0.0, 0.0, 100.0, 0.0],
- [0.0, 0.0, 0.0, 1.0],
+ [100.0, 0.0, 0.0, 0.0],
+ [0.0, 100.0, 0.0, 0.0],
+ [0.0, 0.0, 100.0, 0.0],
+ [0.0, 0.0, 0.0, 1.0],
]
representation.GetTransform(transform)
self.assertTransform(transform, expectedDefaultTransform)
@@ -378,7 +378,7 @@ def test_3D_interaction2Models(self):
tdNode.UpdateEditorBounds()
centeredCubeTransform = copy.deepcopy(expectedDefaultTransform)
for i in range(3):
- centeredCubeTransform[i][i] = 2*centeredCubeSize[i]
+ centeredCubeTransform[i][i] = 2 * centeredCubeSize[i]
representation.GetTransform(transform)
self.assertTransform(transform, centeredCubeTransform)
@@ -387,10 +387,10 @@ def test_3D_interaction2Models(self):
movedCubeNode.SetAndObserveTransformNodeID(tNode.GetID())
tdNode.UpdateEditorBounds()
bothCubeTransform = [
- [2452.35424805, 0.0, 0.0, -363.088562012],
- [0.0, 593.0, 0.0, -48.25],
- [0.0, 0.0, 2535.19702148, -483.799255371],
- [0.0, 0.0, 0.0, 1.0],
+ [2452.35424805, 0.0, 0.0, -363.088562012],
+ [0.0, 593.0, 0.0, -48.25],
+ [0.0, 0.0, 2535.19702148, -483.799255371],
+ [0.0, 0.0, 0.0, 1.0],
]
representation.GetTransform(transform)
@@ -400,10 +400,10 @@ def test_3D_interaction2Models(self):
centeredCubeNode.SetAndObserveTransformNodeID(None)
tdNode.UpdateEditorBounds()
movedCubeTransform = [
- [2207.58724976, 0.0, 0.0, -424.280311584],
- [0.0, 466.0, 0.0, -80.0],
- [0.0, 0.0, 2207.58731651, -565.701681614],
- [0.0, 0.0, 0.0, 1.0],
+ [2207.58724976, 0.0, 0.0, -424.280311584],
+ [0.0, 466.0, 0.0, -80.0],
+ [0.0, 0.0, 2207.58731651, -565.701681614],
+ [0.0, 0.0, 0.0, 1.0],
]
representation.GetTransform(transform)
@@ -416,12 +416,12 @@ def test_3D_interaction2Models(self):
representation.GetTransform(transform)
self.assertTransform(transform, expectedDefaultTransform)
- #self.delayDisplay('test_3D_interaction2Models passed!')
+ # self.delayDisplay('test_3D_interaction2Models passed!')
def test_3D_parentTransform(self):
""" Test that the interaction widget works with a parent transform.
"""
- #self.delayDisplay('Starting test_3D_parentTransform')
+ # self.delayDisplay('Starting test_3D_parentTransform')
#
# Setup:
# - Use a markup control points list node
@@ -457,10 +457,10 @@ def test_3D_parentTransform(self):
leafNode.SetAndObserveTransformNodeID(parentNode.GetID())
tdNode.UpdateEditorBounds()
expectedDefaultTransform = [
- [100.0, 0.0, 0.0, 0.0],
- [0.0, 100.0, 0.0, 0.0],
- [0.0, 0.0, 100.0, 0.0],
- [0.0, 0.0, 0.0, 1.0],
+ [100.0, 0.0, 0.0, 0.0],
+ [0.0, 100.0, 0.0, 0.0],
+ [0.0, 0.0, 100.0, 0.0],
+ [0.0, 0.0, 0.0, 1.0],
]
representation.GetTransform(transform)
@@ -477,10 +477,10 @@ def test_3D_parentTransform(self):
parentNode.ApplyTransformMatrix(parentTransform.GetMatrix())
expectedTransformWithParent = [
- [0.0, 0.0, 200.0, 51.0],
- [700.0, 0.0, 0.0, -27.0],
- [0.0, 300.0, 0.0, 3.3],
- [0.0, 0.0, 0.0, 1.0],
+ [0.0, 0.0, 200.0, 51.0],
+ [700.0, 0.0, 0.0, -27.0],
+ [0.0, 300.0, 0.0, 3.3],
+ [0.0, 0.0, 0.0, 1.0],
]
representation.GetTransform(transform)
self.assertTransform(transform, expectedTransformWithParent)
@@ -489,10 +489,10 @@ def test_3D_parentTransform(self):
markupNode.SetAndObserveTransformNodeID(leafNode.GetID())
tdNode.UpdateEditorBounds()
expectedMarkupTransformWithParent = [
- [0.0, 0.0, 1200.0, 151.0],
- [35000.0, 0.0, 0.0, -1777.0],
- [0.0, 12000.0, 0.0, 3.3],
- [0.0, 0.0, 0.0, 1.0],
+ [0.0, 0.0, 1200.0, 151.0],
+ [35000.0, 0.0, 0.0, -1777.0],
+ [0.0, 12000.0, 0.0, 3.3],
+ [0.0, 0.0, 0.0, 1.0],
]
representation.GetTransform(transform)
self.assertTransform(transform, expectedMarkupTransformWithParent)
@@ -500,22 +500,22 @@ def test_3D_parentTransform(self):
# Set the parent transform to identity
parentNode.ApplyTransformMatrix(parentTransform.GetLinearInverse().GetMatrix())
expectedMarkupTransform = [
- [5000.0, 0.0, 0.0, -250.0],
- [0.0, 4000.0, 0.0, 0.0],
- [0.0, 0.0, 600.0, 50.0],
- [0.0, 0.0, 0.0, 1.0],
+ [5000.0, 0.0, 0.0, -250.0],
+ [0.0, 4000.0, 0.0, 0.0],
+ [0.0, 0.0, 600.0, 50.0],
+ [0.0, 0.0, 0.0, 1.0],
]
representation.GetTransform(transform)
self.assertTransform(transform, expectedMarkupTransform)
- #self.delayDisplay('test_3D_parentTransform passed!')
+ # self.delayDisplay('test_3D_parentTransform passed!')
def test_3D_interactionSerialization(self):
""" Test that the serialzation the interaction properties.
"""
logic = SlicerTransformInteractionTest1Logic()
- #self.delayDisplay("Starting test_3D_interactionSerialization")
+ # self.delayDisplay("Starting test_3D_interactionSerialization")
# Setup
tNode, tdNode = logic.addTransform()
tNode.SetMatrixTransformToParent(vtk.vtkMatrix4x4())
@@ -556,7 +556,7 @@ def test_3D_boundsUpdateROI(self):
"""
logic = SlicerTransformInteractionTest1Logic()
- #self.delayDisplay("Starting test_3D_boundsUpdateROI")
+ # self.delayDisplay("Starting test_3D_boundsUpdateROI")
# Setup
roiNode = slicer.mrmlScene.AddNode(slicer.vtkMRMLAnnotationROINode())
roiNode.SetXYZ(100, 300, -0.689)
@@ -577,10 +577,10 @@ def test_3D_boundsUpdateROI(self):
transform = vtk.vtkTransform()
expectedDefaultTransform = [
- [100.0, 0.0, 0.0, 0.0],
- [0.0, 100.0, 0.0, 0.0],
- [0.0, 0.0, 100.0, 0.0],
- [0.0, 0.0, 0.0, 1.0],
+ [100.0, 0.0, 0.0, 0.0],
+ [0.0, 100.0, 0.0, 0.0],
+ [0.0, 0.0, 100.0, 0.0],
+ [0.0, 0.0, 0.0, 1.0],
]
representation.GetTransform(transform)
self.assertTransform(transform, expectedDefaultTransform)
@@ -595,10 +595,10 @@ def test_3D_boundsUpdateROI(self):
tdNode.UpdateEditorBounds()
roiDefaultTransform = [
- [2800.0, 0.0, 0.0, 100.0],
- [0.0, 32.0, 0.0, 300.0],
- [0.0, 0.0, 180.0, -0.689],
- [0.0, 0.0, 0.0, 1.0],
+ [2800.0, 0.0, 0.0, 100.0],
+ [0.0, 32.0, 0.0, 300.0],
+ [0.0, 0.0, 180.0, -0.689],
+ [0.0, 0.0, 0.0, 1.0],
]
representation.GetTransform(transform)
self.assertTransform(transform, roiDefaultTransform)
diff --git a/Applications/SlicerApp/Testing/Python/SlicerUnitTestTest.py b/Applications/SlicerApp/Testing/Python/SlicerUnitTestTest.py
index 24f4e6f9b1f..3b606f356d1 100644
--- a/Applications/SlicerApp/Testing/Python/SlicerUnitTestTest.py
+++ b/Applications/SlicerApp/Testing/Python/SlicerUnitTestTest.py
@@ -16,7 +16,7 @@ def test_shuffle(self):
self.assertEqual(self.seq, list(range(10)))
# Should raise an exception for an immutable sequence
- self.assertRaises(TypeError, random.shuffle, (1,2,3))
+ self.assertRaises(TypeError, random.shuffle, (1, 2, 3))
def test_choice(self):
element = random.choice(self.seq)
diff --git a/Applications/SlicerApp/Testing/Python/TwoCLIsInARowTest.py b/Applications/SlicerApp/Testing/Python/TwoCLIsInARowTest.py
index 091518206b9..0d36e74b7a8 100644
--- a/Applications/SlicerApp/Testing/Python/TwoCLIsInARowTest.py
+++ b/Applications/SlicerApp/Testing/Python/TwoCLIsInARowTest.py
@@ -10,14 +10,14 @@
class TwoCLIsInARowTest(ScriptedLoadableModule):
def __init__(self, parent):
- parent.title = "TwoCLIsInARowTest" # TODO make this more human readable by adding spaces
+ parent.title = "TwoCLIsInARowTest" # TODO make this more human readable by adding spaces
parent.categories = ["Testing.TestCases"]
parent.dependencies = ["CLI4Test"]
parent.contributors = ["Alexis Girault (Kitware), Johan Andruejol (Kitware)"]
parent.helpText = """
This is a self test that tests the piping of two CLIs through python
"""
- parent.acknowledgementText = """""" # replace with organization, grant and thanks.
+ parent.acknowledgementText = """""" # replace with organization, grant and thanks.
self.parent = parent
# Add this test to the SelfTest module's list for discovery when the module
@@ -67,7 +67,7 @@ def runModule1(self):
cliNode = slicer.cli.run(cliModule, cliNode, self.parameters, False)
def onModule1Modified(self, cliNode, event):
- print("--",cliNode.GetStatusString(),":", cliNode.GetName())
+ print("--", cliNode.GetStatusString(), ":", cliNode.GetName())
if not cliNode.IsBusy():
self.removeObservers(cliNode, self.StatusModifiedEvent, self.onModule1Modified)
if cliNode.GetStatusString() == 'Completed':
@@ -81,14 +81,14 @@ def runModule2(self):
cliNode = slicer.cli.run(cliModule, cliNode, self.parameters, False)
def onModule2Modified(self, cliNode, event):
- print("--",cliNode.GetStatusString(),":", cliNode.GetName())
+ print("--", cliNode.GetStatusString(), ":", cliNode.GetName())
if not cliNode.IsBusy():
self.removeObservers(cliNode, self.StatusModifiedEvent, self.onModule2Modified)
self.success = cliNode.GetStatusString() == 'Completed'
- def addObserver(self, object, event, method, group = 'none'):
+ def addObserver(self, object, event, method, group='none'):
if self.hasObserver(object, event, method):
- print(object.GetName(),'already has observer')
+ print(object.GetName(), 'already has observer')
return
tag = object.AddObserver(event, method)
self.Observations.append([object, event, method, group, tag])
diff --git a/Applications/SlicerApp/Testing/Python/TwoCLIsInParallelTest.py b/Applications/SlicerApp/Testing/Python/TwoCLIsInParallelTest.py
index 0df475574b1..42f823ecb1b 100644
--- a/Applications/SlicerApp/Testing/Python/TwoCLIsInParallelTest.py
+++ b/Applications/SlicerApp/Testing/Python/TwoCLIsInParallelTest.py
@@ -10,14 +10,14 @@
class TwoCLIsInParallelTest(ScriptedLoadableModule):
def __init__(self, parent):
- parent.title = "TwoCLIsInParallelTest" # TODO make this more human readable by adding spaces
+ parent.title = "TwoCLIsInParallelTest" # TODO make this more human readable by adding spaces
parent.categories = ["Testing.TestCases"]
parent.dependencies = ["CLI4Test"]
parent.contributors = ["Johan Andruejol (Kitware)"]
parent.helpText = """
This is a self test that tests running two CLIs in parallel through python
"""
- parent.acknowledgementText = """""" # replace with organization, grant and thanks.
+ parent.acknowledgementText = """""" # replace with organization, grant and thanks.
self.parent = parent
# Add this test to the SelfTest module's list for discovery when the module
@@ -64,7 +64,7 @@ def runModule1(self):
cliNode = slicer.cli.run(cliModule, cliNode, self.parameters, False)
def onModule1Modified(self, cliNode, event):
- print("--",cliNode.GetStatusString(),":", cliNode.GetName())
+ print("--", cliNode.GetStatusString(), ":", cliNode.GetName())
if not cliNode.IsBusy():
self.removeObservers(cliNode, self.StatusModifiedEvent, self.onModule1Modified)
@@ -75,9 +75,9 @@ def runModule2(self):
cliNode = slicer.cli.run(cliModule, cliNode, self.parameters, True)
self.success = cliNode.GetStatusString() == 'Completed'
- def addObserver(self, object, event, method, group = 'none'):
+ def addObserver(self, object, event, method, group='none'):
if self.hasObserver(object, event, method):
- print(object.GetName(),'already has observer')
+ print(object.GetName(), 'already has observer')
return
tag = object.AddObserver(event, method)
self.Observations.append([object, event, method, group, tag])
diff --git a/Applications/SlicerApp/Testing/Python/UtilTest.py b/Applications/SlicerApp/Testing/Python/UtilTest.py
index 2eeab66f338..5d0a3bbfce5 100644
--- a/Applications/SlicerApp/Testing/Python/UtilTest.py
+++ b/Applications/SlicerApp/Testing/Python/UtilTest.py
@@ -14,14 +14,14 @@
class UtilTest(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
- parent.title = "UtilTest" # TODO make this more human readable by adding spaces
+ parent.title = "UtilTest" # TODO make this more human readable by adding spaces
parent.categories = ["Testing.TestCases"]
parent.dependencies = []
parent.contributors = ["Johan Andruejol (Kitware)"]
parent.helpText = """
This is a self test that tests the methods of slicer.util
"""
- parent.acknowledgementText = """""" # replace with organization, grant and thanks.
+ parent.acknowledgementText = """""" # replace with organization, grant and thanks.
#
@@ -29,7 +29,7 @@ def __init__(self, parent):
#
class UtilTestWidget(ScriptedLoadableModuleWidget):
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
self.Widget = None
ScriptedLoadableModuleWidget.__init__(self, parent)
@@ -100,7 +100,7 @@ def test_setSliceViewerLayers(self):
foregroundNode.SetName('Foreground')
volumesLogic = slicer.modules.volumes.logic()
- labelmapNode = volumesLogic.CreateAndAddLabelVolume( slicer.mrmlScene, backgroundNode, 'Labelmap' )
+ labelmapNode = volumesLogic.CreateAndAddLabelVolume(slicer.mrmlScene, backgroundNode, 'Labelmap')
thresholder = vtk.vtkImageThreshold()
thresholder.SetInputData(backgroundNode.GetImageData())
@@ -109,18 +109,18 @@ def test_setSliceViewerLayers(self):
labelmapNode.SetAndObserveImageData(thresholder.GetOutput())
# Try with nothing
- slicer.util.setSliceViewerLayers(background = None, foreground = None, label = None)
+ slicer.util.setSliceViewerLayers(background=None, foreground=None, label=None)
self.assertIsNone(redSliceCompositeNode.GetBackgroundVolumeID())
self.assertIsNone(redSliceCompositeNode.GetForegroundVolumeID())
self.assertIsNone(redSliceCompositeNode.GetLabelVolumeID())
# Try with nodes
slicer.util.setSliceViewerLayers(
- background = backgroundNode,
- foreground = foregroundNode,
- label = labelmapNode,
- foregroundOpacity = 0.5,
- labelOpacity = 0.1
+ background=backgroundNode,
+ foreground=foregroundNode,
+ label=labelmapNode,
+ foregroundOpacity=0.5,
+ labelOpacity=0.1
)
self.assertEqual(redSliceCompositeNode.GetBackgroundVolumeID(), backgroundNode.GetID())
self.assertEqual(redSliceCompositeNode.GetForegroundVolumeID(), foregroundNode.GetID())
@@ -133,15 +133,15 @@ def test_setSliceViewerLayers(self):
otherBackgroundNode.SetName('OtherBackground')
otherForegroundNode = SampleData.downloadSample("MRHead")
otherForegroundNode.SetName('OtherForeground')
- otherLabelmapNode = volumesLogic.CreateAndAddLabelVolume( slicer.mrmlScene, backgroundNode, 'OtherLabelmap' )
+ otherLabelmapNode = volumesLogic.CreateAndAddLabelVolume(slicer.mrmlScene, backgroundNode, 'OtherLabelmap')
# Try with node id's
slicer.util.setSliceViewerLayers(
- background = otherBackgroundNode.GetID(),
- foreground = otherForegroundNode.GetID(),
- label = otherLabelmapNode.GetID(),
- foregroundOpacity = 0.0,
- labelOpacity = 1.0
+ background=otherBackgroundNode.GetID(),
+ foreground=otherForegroundNode.GetID(),
+ label=otherLabelmapNode.GetID(),
+ foregroundOpacity=0.0,
+ labelOpacity=1.0
)
self.assertEqual(redSliceCompositeNode.GetBackgroundVolumeID(), otherBackgroundNode.GetID())
self.assertEqual(redSliceCompositeNode.GetForegroundVolumeID(), otherForegroundNode.GetID())
@@ -199,14 +199,14 @@ def test_arrayFromVolume(self):
volumeNode = SampleData.downloadSample("MRHead")
self.delayDisplay('Test voxel value read')
- voxelPos = [120,135,89]
+ voxelPos = [120, 135, 89]
voxelValueVtk = volumeNode.GetImageData().GetScalarComponentAsDouble(voxelPos[0], voxelPos[1], voxelPos[2], 0)
narray = slicer.util.arrayFromVolume(volumeNode)
voxelValueNumpy = narray[voxelPos[2], voxelPos[1], voxelPos[0]]
self.assertEqual(voxelValueVtk, voxelValueNumpy)
self.delayDisplay('Test voxel value write')
- voxelValueNumpy = 155
+ voxelValueNumpy = 155
narray[voxelPos[2], voxelPos[1], voxelPos[0]] = voxelValueNumpy
voxelValueVtk = volumeNode.GetImageData().GetScalarComponentAsDouble(voxelPos[0], voxelPos[1], voxelPos[2], 0)
self.assertEqual(voxelValueVtk, voxelValueNumpy)
@@ -223,9 +223,9 @@ def test_updateVolumeFromArray(self):
import numpy as np
def some_func(x, y, z):
- return 0.1*x*x + 0.03*y*y + 0.05*z*z
+ return 0.1 * x * x + 0.03 * y * y + 0.05 * z * z
- f = np.fromfunction(some_func,(30,20,15))
+ f = np.fromfunction(some_func, (30, 20, 15))
slicer.util.updateVolumeFromArray(volumeNode, f)
@@ -242,7 +242,7 @@ def test_updateTableFromArray(self):
import numpy as np
self.delayDisplay('Test simple 2D array update')
- a=np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12]])
+ a = np.array([[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]])
tableNode1 = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLTableNode")
slicer.util.updateTableFromArray(tableNode1, a)
self.assertEqual(tableNode1.GetNumberOfColumns(), 4)
@@ -276,7 +276,7 @@ def test_arrayFromModelPoints(self):
a = slicer.util.arrayFromModelPoints(modelNode)
self.delayDisplay('Change Y scaling')
- a[:,2] = a[:,2] * 2.5
+ a[:, 2] = a[:, 2] * 2.5
modelNode.GetPolyData().Modified()
self.delayDisplay('Testing slicer.util.test_arrayFromModelPoints passed')
@@ -288,11 +288,11 @@ def test_arrayFromVTKMatrix(self):
self.delayDisplay('Test arrayFromVTKMatrix, vtkMatrixFromArray, and updateVTKMatrixFromArray')
# Test 4x4 matrix
- a = np.array([[1.5,0.5,0,4],[0,2.0,0,11],[0,0,2.5,6],[0,0,0,1]])
+ a = np.array([[1.5, 0.5, 0, 4], [0, 2.0, 0, 11], [0, 0, 2.5, 6], [0, 0, 0, 1]])
vmatrix = slicer.util.vtkMatrixFromArray(a)
- self.assertTrue(isinstance(vmatrix,vtk.vtkMatrix4x4))
- self.assertEqual(vmatrix.GetElement(0,1), 0.5)
- self.assertEqual(vmatrix.GetElement(1,3), 11)
+ self.assertTrue(isinstance(vmatrix, vtk.vtkMatrix4x4))
+ self.assertEqual(vmatrix.GetElement(0, 1), 0.5)
+ self.assertEqual(vmatrix.GetElement(1, 3), 11)
narray = slicer.util.arrayFromVTKMatrix(vmatrix)
np.testing.assert_array_equal(a, narray)
@@ -303,11 +303,11 @@ def test_arrayFromVTKMatrix(self):
np.testing.assert_array_equal(a, narray)
# Test 3x3 matrix
- a = np.array([[1.5,0,0],[0,2.0,0],[0,1.2,2.5]])
+ a = np.array([[1.5, 0, 0], [0, 2.0, 0], [0, 1.2, 2.5]])
vmatrix = slicer.util.vtkMatrixFromArray(a)
- self.assertTrue(isinstance(vmatrix,vtk.vtkMatrix3x3))
- self.assertEqual(vmatrix.GetElement(0,0), 1.5)
- self.assertEqual(vmatrix.GetElement(2,1), 1.2)
+ self.assertTrue(isinstance(vmatrix, vtk.vtkMatrix3x3))
+ self.assertEqual(vmatrix.GetElement(0, 0), 1.5)
+ self.assertEqual(vmatrix.GetElement(2, 1), 1.2)
narray = slicer.util.arrayFromVTKMatrix(vmatrix)
np.testing.assert_array_equal(a, narray)
@@ -320,7 +320,7 @@ def test_arrayFromVTKMatrix(self):
# Test invalid matrix size
caughtException = False
try:
- vmatrix = slicer.util.vtkMatrixFromArray(np.zeros([3,4]))
+ vmatrix = slicer.util.vtkMatrixFromArray(np.zeros([3, 4]))
except RuntimeError:
caughtException = True
self.assertTrue(caughtException)
@@ -333,30 +333,30 @@ def test_arrayFromTransformMatrix(self):
transformNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLTransformNode')
transformMatrix = vtk.vtkMatrix4x4()
- transformMatrix.SetElement(0,0, 5.0)
- transformMatrix.SetElement(0,1, 3.0)
- transformMatrix.SetElement(1,1, 2.3)
- transformMatrix.SetElement(2,2, 1.3)
- transformMatrix.SetElement(0,3, 11.0)
- transformMatrix.SetElement(1,3, 22.0)
- transformMatrix.SetElement(2,3, 44.0)
+ transformMatrix.SetElement(0, 0, 5.0)
+ transformMatrix.SetElement(0, 1, 3.0)
+ transformMatrix.SetElement(1, 1, 2.3)
+ transformMatrix.SetElement(2, 2, 1.3)
+ transformMatrix.SetElement(0, 3, 11.0)
+ transformMatrix.SetElement(1, 3, 22.0)
+ transformMatrix.SetElement(2, 3, 44.0)
transformNode.SetMatrixTransformToParent(transformMatrix)
narray = slicer.util.arrayFromTransformMatrix(transformNode)
self.assertEqual(narray.shape, (4, 4))
- self.assertEqual(narray[0,0], 5.0)
- self.assertEqual(narray[0,1], 3.0)
- self.assertEqual(narray[0,3], 11.0)
- self.assertEqual(narray[2,3], 44.0)
+ self.assertEqual(narray[0, 0], 5.0)
+ self.assertEqual(narray[0, 1], 3.0)
+ self.assertEqual(narray[0, 3], 11.0)
+ self.assertEqual(narray[2, 3], 44.0)
self.delayDisplay('Test arrayFromTransformMatrix with toWorld=True')
parentTransformNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLTransformNode')
parentTransformMatrix = vtk.vtkMatrix4x4()
- parentTransformMatrix.SetElement(1,1, 0.3)
- parentTransformMatrix.SetElement(0,3, 30.0)
- parentTransformMatrix.SetElement(1,3, 20.0)
- parentTransformMatrix.SetElement(2,3, 10.0)
+ parentTransformMatrix.SetElement(1, 1, 0.3)
+ parentTransformMatrix.SetElement(0, 3, 30.0)
+ parentTransformMatrix.SetElement(1, 3, 20.0)
+ parentTransformMatrix.SetElement(2, 3, 10.0)
parentTransformNode.SetMatrixTransformToParent(parentTransformMatrix)
narrayParent = slicer.util.arrayFromTransformMatrix(parentTransformNode)
@@ -367,22 +367,22 @@ def test_arrayFromTransformMatrix(self):
np.testing.assert_array_equal(narrayToWorld, narrayToWorldExpected)
self.delayDisplay('Test updateTransformMatrixFromArray')
- narrayUpdated = np.array([[1.5,0.5,0,4],[0,2.0,0,11],[0,0,2.5,6],[0,0,0,1]])
+ narrayUpdated = np.array([[1.5, 0.5, 0, 4], [0, 2.0, 0, 11], [0, 0, 2.5, 6], [0, 0, 0, 1]])
slicer.util.updateTransformMatrixFromArray(transformNode, narrayUpdated)
transformMatrixUpdated = vtk.vtkMatrix4x4()
transformNode.GetMatrixTransformToParent(transformMatrixUpdated)
for r in range(4):
for c in range(4):
- self.assertEqual(narrayUpdated[r,c], transformMatrixUpdated.GetElement(r,c))
+ self.assertEqual(narrayUpdated[r, c], transformMatrixUpdated.GetElement(r, c))
self.delayDisplay('Test updateTransformMatrixFromArray with toWorld=True')
- narrayUpdated = np.array([[2.5,1.5,0,2],[0,2.0,0,15],[0,1,3.5,6],[0,0,0,1]])
+ narrayUpdated = np.array([[2.5, 1.5, 0, 2], [0, 2.0, 0, 15], [0, 1, 3.5, 6], [0, 0, 0, 1]])
slicer.util.updateTransformMatrixFromArray(transformNode, narrayUpdated, toWorld=True)
transformMatrixUpdated = vtk.vtkMatrix4x4()
transformNode.GetMatrixTransformToWorld(transformMatrixUpdated)
for r in range(4):
for c in range(4):
- self.assertEqual(narrayUpdated[r,c], transformMatrixUpdated.GetElement(r,c))
+ self.assertEqual(narrayUpdated[r, c], transformMatrixUpdated.GetElement(r, c))
def test_arrayFromMarkupsControlPoints(self):
# Test if retrieving markups control coordinates as a numpy array works
@@ -391,51 +391,51 @@ def test_arrayFromMarkupsControlPoints(self):
self.delayDisplay('Test arrayFromMarkupsControlPoints')
markupsNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLMarkupsFiducialNode')
- markupsNode.AddControlPoint(vtk.vtkVector3d(10,20,30))
- markupsNode.AddControlPoint(vtk.vtkVector3d(21,21,31))
- markupsNode.AddControlPoint(vtk.vtkVector3d(32,33,44))
- markupsNode.AddControlPoint(vtk.vtkVector3d(45,45,55))
- markupsNode.AddControlPoint(vtk.vtkVector3d(51,41,59))
+ markupsNode.AddControlPoint(vtk.vtkVector3d(10, 20, 30))
+ markupsNode.AddControlPoint(vtk.vtkVector3d(21, 21, 31))
+ markupsNode.AddControlPoint(vtk.vtkVector3d(32, 33, 44))
+ markupsNode.AddControlPoint(vtk.vtkVector3d(45, 45, 55))
+ markupsNode.AddControlPoint(vtk.vtkVector3d(51, 41, 59))
translation = [10.0, 30.0, 20.0]
transformNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLTransformNode')
transformMatrix = vtk.vtkMatrix4x4()
- transformMatrix.SetElement(0,3, translation[0])
- transformMatrix.SetElement(1,3, translation[1])
- transformMatrix.SetElement(2,3, translation[2])
+ transformMatrix.SetElement(0, 3, translation[0])
+ transformMatrix.SetElement(1, 3, translation[1])
+ transformMatrix.SetElement(2, 3, translation[2])
transformNode.SetMatrixTransformToParent(transformMatrix)
markupsNode.SetAndObserveTransformNodeID(transformNode.GetID())
narray = slicer.util.arrayFromMarkupsControlPoints(markupsNode)
self.assertEqual(narray.shape, (5, 3))
- self.assertEqual(narray[0,0], 10)
- self.assertEqual(narray[1,2], 31)
- self.assertEqual(narray[4,2], 59)
+ self.assertEqual(narray[0, 0], 10)
+ self.assertEqual(narray[1, 2], 31)
+ self.assertEqual(narray[4, 2], 59)
self.delayDisplay('Test arrayFromMarkupsControlPoints with world=True')
narray = slicer.util.arrayFromMarkupsControlPoints(markupsNode, world=True)
self.assertEqual(narray.shape, (5, 3))
- self.assertEqual(narray[0,0], 10+translation[0])
- self.assertEqual(narray[1,2], 31+translation[2])
- self.assertEqual(narray[4,2], 59+translation[2])
+ self.assertEqual(narray[0, 0], 10 + translation[0])
+ self.assertEqual(narray[1, 2], 31 + translation[2])
+ self.assertEqual(narray[4, 2], 59 + translation[2])
self.delayDisplay('Test updateMarkupsControlPointsFromArray')
- narray = np.array([[2,3,4],[6,7,8]])
+ narray = np.array([[2, 3, 4], [6, 7, 8]])
slicer.util.updateMarkupsControlPointsFromArray(markupsNode, narray)
self.assertEqual(markupsNode.GetNumberOfControlPoints(), 2)
- position = [0]*3
- markupsNode.GetNthControlPointPosition(1,position)
- np.testing.assert_array_equal(position,narray[1,:])
+ position = [0] * 3
+ markupsNode.GetNthControlPointPosition(1, position)
+ np.testing.assert_array_equal(position, narray[1, :])
self.delayDisplay('Test updateMarkupsControlPointsFromArray with world=True')
- narray = np.array([[2,3,4],[6,7,8]])
+ narray = np.array([[2, 3, 4], [6, 7, 8]])
slicer.util.updateMarkupsControlPointsFromArray(markupsNode, narray, world=True)
self.assertEqual(markupsNode.GetNumberOfControlPoints(), 2)
- markupsNode.GetNthControlPointPositionWorld(1,position)
- np.testing.assert_array_equal(position,narray[1,:])
+ markupsNode.GetNthControlPointPositionWorld(1, position)
+ np.testing.assert_array_equal(position, narray[1, :])
def test_array(self):
# Test if convenience function of getting numpy array from various nodes works
@@ -443,7 +443,7 @@ def test_array(self):
self.delayDisplay('Test array with scalar image')
import SampleData
volumeNode = SampleData.downloadSample("MRHead")
- voxelPos = [120,135,89]
+ voxelPos = [120, 135, 89]
voxelValueVtk = volumeNode.GetImageData().GetScalarComponentAsDouble(voxelPos[0], voxelPos[1], voxelPos[2], 0)
narray = slicer.util.arrayFromVolume(volumeNode)
voxelValueNumpy = narray[voxelPos[2], voxelPos[1], voxelPos[0]]
@@ -463,21 +463,21 @@ def test_array(self):
self.delayDisplay('Test array with markups fiducials')
markupsNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLMarkupsFiducialNode')
- markupsNode.AddControlPoint(vtk.vtkVector3d(10,20,30))
- markupsNode.AddControlPoint(vtk.vtkVector3d(21,21,31))
- markupsNode.AddControlPoint(vtk.vtkVector3d(32,33,44))
- markupsNode.AddControlPoint(vtk.vtkVector3d(45,45,55))
- markupsNode.AddControlPoint(vtk.vtkVector3d(51,41,59))
+ markupsNode.AddControlPoint(vtk.vtkVector3d(10, 20, 30))
+ markupsNode.AddControlPoint(vtk.vtkVector3d(21, 21, 31))
+ markupsNode.AddControlPoint(vtk.vtkVector3d(32, 33, 44))
+ markupsNode.AddControlPoint(vtk.vtkVector3d(45, 45, 55))
+ markupsNode.AddControlPoint(vtk.vtkVector3d(51, 41, 59))
narray = slicer.util.array(markupsNode.GetName())
self.assertEqual(narray.shape, (5, 3))
self.delayDisplay('Test array with transforms')
transformNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLTransformNode')
transformMatrix = vtk.vtkMatrix4x4()
- transformMatrix.SetElement(0,0, 2.0)
- transformMatrix.SetElement(0,3, 11.0)
- transformMatrix.SetElement(1,3, 22.0)
- transformMatrix.SetElement(2,3, 44.0)
+ transformMatrix.SetElement(0, 0, 2.0)
+ transformMatrix.SetElement(0, 3, 11.0)
+ transformMatrix.SetElement(1, 3, 22.0)
+ transformMatrix.SetElement(2, 3, 44.0)
transformNode.SetMatrixTransformToParent(transformMatrix)
narray = slicer.util.array(transformNode.GetName())
self.assertEqual(narray.shape, (4, 4))
diff --git a/Applications/SlicerApp/Testing/Python/ViewControllersSliceInterpolationBug1926.py b/Applications/SlicerApp/Testing/Python/ViewControllersSliceInterpolationBug1926.py
index 1a835caf61c..4658aa1b057 100644
--- a/Applications/SlicerApp/Testing/Python/ViewControllersSliceInterpolationBug1926.py
+++ b/Applications/SlicerApp/Testing/Python/ViewControllersSliceInterpolationBug1926.py
@@ -16,16 +16,16 @@ class ViewControllersSliceInterpolationBug1926(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
- parent.title = "ViewControllers Slice Interpolation Bug 1926" # TODO make this more human readable by adding spaces
+ parent.title = "ViewControllers Slice Interpolation Bug 1926" # TODO make this more human readable by adding spaces
parent.categories = ["Testing.TestCases"]
parent.dependencies = []
- parent.contributors = ["Jim Miller (GE)"] # replace with "Firstname Lastname (Org)"
+ parent.contributors = ["Jim Miller (GE)"] # replace with "Firstname Lastname (Org)"
parent.helpText = """
Test case for the interaction between the ViewControllers module, linking, slice interpolation, and the selection of background, foreground, and label images. When entering the ViewControllers module, extra View Controllers are created and configured. If linking is on, then foreground, background, and label selection can be propagated to the other views incorrectly. If the node selectors are bocked from emitting signals, then the viewers maintain their proper volumes. However the slice interpolation widget is then not managed properly.
"""
parent.acknowledgementText = """
This file was originally developed by Jim Miller, GE. and was partially funded by NIH grant U54EB005149.
-""" # replace with organization, grant and thanks.
+""" # replace with organization, grant and thanks.
#
@@ -122,10 +122,10 @@ def test_ViewControllersSliceInterpolationBug19261(self):
self.delayDisplay('Linked the viewers (first Compare View)')
# Set the data to be same on all viewers
- logic.StartSliceCompositeNodeInteraction(2) #BackgroundVolumeFlag
+ logic.StartSliceCompositeNodeInteraction(2) # BackgroundVolumeFlag
compareCNode.SetBackgroundVolumeID(tumor.GetID())
logic.EndSliceCompositeNodeInteraction()
- self.assertEqual( compareCNode.GetBackgroundVolumeID(), tumor.GetID())
+ self.assertEqual(compareCNode.GetBackgroundVolumeID(), tumor.GetID())
self.delayDisplay('Compare views configured')
# Get handles to the Red viewer
@@ -135,7 +135,7 @@ def test_ViewControllersSliceInterpolationBug19261(self):
# Configure the red viewer with a different dataset
redCNode.SetLinkedControl(0)
- redLogic.StartSliceCompositeNodeInteraction(2) #BackgroundVolumeFlag
+ redLogic.StartSliceCompositeNodeInteraction(2) # BackgroundVolumeFlag
redCNode.SetBackgroundVolumeID(head.GetID())
redLogic.EndSliceCompositeNodeInteraction()
redCNode.SetLinkedControl(1)
@@ -146,9 +146,9 @@ def test_ViewControllersSliceInterpolationBug19261(self):
compareCNode2 = slicer.util.getNode('vtkMRMLSliceCompositeNodeCompare2')
# Check whether the viewers have the proper data initially
- self.assertEqual( redCNode.GetBackgroundVolumeID(), head.GetID())
- self.assertEqual( compareCNode.GetBackgroundVolumeID(), tumor.GetID())
- self.assertEqual( compareCNode2.GetBackgroundVolumeID(), tumor.GetID())
+ self.assertEqual(redCNode.GetBackgroundVolumeID(), head.GetID())
+ self.assertEqual(compareCNode.GetBackgroundVolumeID(), tumor.GetID())
+ self.assertEqual(compareCNode2.GetBackgroundVolumeID(), tumor.GetID())
self.delayDisplay('All viewers configured properly')
# Switch to the View Controllers module
@@ -157,9 +157,9 @@ def test_ViewControllersSliceInterpolationBug19261(self):
self.delayDisplay("Entered View Controllers module")
# Check the volume selectors
- self.assertTrue( redCNode.GetBackgroundVolumeID() == head.GetID())
- self.assertTrue( compareCNode.GetBackgroundVolumeID() == tumor.GetID())
- self.assertTrue( compareCNode2.GetBackgroundVolumeID() == tumor.GetID())
+ self.assertTrue(redCNode.GetBackgroundVolumeID() == head.GetID())
+ self.assertTrue(compareCNode.GetBackgroundVolumeID() == tumor.GetID())
+ self.assertTrue(compareCNode2.GetBackgroundVolumeID() == tumor.GetID())
self.delayDisplay('All viewers still configured properly')
# Check whether we can change the interpolation (needs to check gui)
diff --git a/Applications/SlicerApp/Testing/Python/WebEngine.py b/Applications/SlicerApp/Testing/Python/WebEngine.py
index 33a0326aeae..5f51ead04a2 100644
--- a/Applications/SlicerApp/Testing/Python/WebEngine.py
+++ b/Applications/SlicerApp/Testing/Python/WebEngine.py
@@ -25,7 +25,7 @@ def __init__(self, parent):
"""
parent.acknowledgementText = """
This file was originally developed by Steve Pieper and was partially funded by NSF grant 1759883
-""" # replace with organization, grant and thanks.
+""" # replace with organization, grant and thanks.
#
@@ -39,7 +39,7 @@ class WebEngineWidget(ScriptedLoadableModuleWidget):
def __init__(self, parent):
ScriptedLoadableModuleWidget.__init__(self, parent)
- self.webWidgets = [] # hold references so windows persist
+ self.webWidgets = [] # hold references so windows persist
def setup(self):
ScriptedLoadableModuleWidget.setup(self)
@@ -94,7 +94,7 @@ def setup(self):
def onSiteButtonClicked(self, site):
webWidget = slicer.qSlicerWebWidget()
slicerGeometry = slicer.util.mainWindow().geometry
- webWidget.size = qt.QSize(1536,1024)
+ webWidget.size = qt.QSize(1536, 1024)
webWidget.pos = qt.QPoint(slicerGeometry.x() + 256, slicerGeometry.y() + 128)
webWidget.url = site["url"]
webWidget.show()
@@ -143,7 +143,7 @@ def test_WebEngine1(self):
self.delayDisplay("Starting the test")
webWidget = slicer.qSlicerWebWidget()
- webWidget.size = qt.QSize(1024,512)
+ webWidget.size = qt.QSize(1024, 512)
webWidget.webView().url = qt.QUrl("")
webWidget.show()
self.delayDisplay('Showing widget')
diff --git a/Applications/SlicerApp/Testing/Python/sceneImport2428.py b/Applications/SlicerApp/Testing/Python/sceneImport2428.py
index ccae97ee153..9f69b72eda8 100644
--- a/Applications/SlicerApp/Testing/Python/sceneImport2428.py
+++ b/Applications/SlicerApp/Testing/Python/sceneImport2428.py
@@ -17,17 +17,17 @@ class sceneImport2428(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
- parent.title = "Scene Import (Issue 2428)" # make this more human readable by adding spaces
+ parent.title = "Scene Import (Issue 2428)" # make this more human readable by adding spaces
parent.categories = ["Testing.TestCases"]
parent.dependencies = []
- parent.contributors = ["Steve Pieper (Isomics)"] # replace with "Firstname Lastname (Org)"
+ parent.contributors = ["Steve Pieper (Isomics)"] # replace with "Firstname Lastname (Org)"
parent.helpText = """
This is an example of scripted loadable module bundled in an extension.
"""
parent.acknowledgementText = """
This file was originally developed by Steve Pieper, Isomics, Inc. and was partially funded by NIH grant 3P41RR013218-12S1.
This is a module to support testing of https://mantisarchive.slicer.org/view.php?id=2428
-""" # replace with organization, grant and thanks.
+""" # replace with organization, grant and thanks.
#
# qsceneImport2428Widget
@@ -108,15 +108,15 @@ def test_sceneImport24281(self):
# Create segmentation
segmentationNode = slicer.vtkMRMLSegmentationNode()
slicer.mrmlScene.AddNode(segmentationNode)
- segmentationNode.CreateDefaultDisplayNodes() # only needed for display
+ segmentationNode.CreateDefaultDisplayNodes() # only needed for display
segmentationNode.SetReferenceImageGeometryParameterFromVolumeNode(head)
# Add a few segments
segments = [
- ["Segment A", [0,65,32], 25, [1.0,0.0,0.0]],
- ["Segment B", [1, -14, 30], 30, [1.0,1.0,0.0]],
- ["Segment C", [0, 28, -7], 15, [0.0,1.0,1.0]],
- ["Segment D", [31, 33, 27], 25, [0.0,0.0,1.0]] ]
+ ["Segment A", [0, 65, 32], 25, [1.0, 0.0, 0.0]],
+ ["Segment B", [1, -14, 30], 30, [1.0, 1.0, 0.0]],
+ ["Segment C", [0, 28, -7], 15, [0.0, 1.0, 1.0]],
+ ["Segment D", [31, 33, 27], 25, [0.0, 0.0, 1.0]]]
for [name, position, radius, color] in segments:
seed = vtk.vtkSphereSource()
seed.SetCenter(position)
@@ -129,8 +129,8 @@ def test_sceneImport24281(self):
slicer.modules.segmentations.logic().ExportVisibleSegmentsToLabelmapNode(segmentationNode, headLabel, head)
selectionNode = slicer.app.applicationLogic().GetSelectionNode()
- selectionNode.SetActiveVolumeID( head.GetID() )
- selectionNode.SetActiveLabelVolumeID( headLabel.GetID() )
+ selectionNode.SetActiveVolumeID(head.GetID())
+ selectionNode.SetActiveLabelVolumeID(headLabel.GetID())
slicer.app.applicationLogic().PropagateVolumeSelection(0)
#
@@ -140,7 +140,7 @@ def test_sceneImport24281(self):
# - make a new hierarchy node
#
- self.delayDisplay( "Building..." )
+ self.delayDisplay("Building...")
parameters = {}
parameters["InputVolume"] = headLabel.GetID()
@@ -149,9 +149,9 @@ def test_sceneImport24281(self):
parameters["StartLabel"] = -1
parameters["EndLabel"] = -1
outHierarchy = slicer.vtkMRMLModelHierarchyNode()
- outHierarchy.SetScene( slicer.mrmlScene )
- outHierarchy.SetName( "sceneImport2428Hierachy" )
- slicer.mrmlScene.AddNode( outHierarchy )
+ outHierarchy.SetScene(slicer.mrmlScene)
+ outHierarchy.SetName("sceneImport2428Hierachy")
+ slicer.mrmlScene.AddNode(outHierarchy)
parameters["ModelSceneFile"] = outHierarchy
modelMaker = slicer.modules.modelmaker
@@ -162,7 +162,7 @@ def test_sceneImport24281(self):
success = self.verifyModels()
- success = success and (slicer.mrmlScene.GetNumberOfNodesByClass( "vtkMRMLModelNode" ) > 3)
+ success = success and (slicer.mrmlScene.GetNumberOfNodesByClass("vtkMRMLModelNode") > 3)
self.delayDisplay("Test finished")
@@ -197,28 +197,28 @@ def verifyModels():
polyDataInScene = []
fileNamesInScene = []
success = True
- numModels = slicer.mrmlScene.GetNumberOfNodesByClass( "vtkMRMLModelNode" )
+ numModels = slicer.mrmlScene.GetNumberOfNodesByClass("vtkMRMLModelNode")
for n in range(numModels):
- modelNode = slicer.mrmlScene.GetNthNodeByClass( n, "vtkMRMLModelNode" )
+ modelNode = slicer.mrmlScene.GetNthNodeByClass(n, "vtkMRMLModelNode")
polyDataInScene.append(modelNode.GetPolyData())
for dn in range(modelNode.GetNumberOfDisplayNodes()):
displayNode = modelNode.GetNthDisplayNode(dn)
if modelNode.GetPolyData() != displayNode.GetInputPolyData():
- self.delayDisplay("Model %d does not match its display node %d! (name: %s, ids: %s and %s)" % (n,dn,modelNode.GetName(), modelNode.GetID(),displayNode.GetID()))
+ self.delayDisplay("Model %d does not match its display node %d! (name: %s, ids: %s and %s)" % (n, dn, modelNode.GetName(), modelNode.GetID(), displayNode.GetID()))
success = False
for sn in range(modelNode.GetNumberOfStorageNodes()):
storageNode = modelNode.GetNthStorageNode(sn)
fileName = storageNode.GetFileName()
fileNamesInScene.append(fileName)
if fileName in fileNamesInScene:
- self.delayDisplay("Model %d has duplicate file name %s! (ids: %s and %s)" % (n,fileName,modelNode.GetID(),storageNode.GetID()))
+ self.delayDisplay("Model %d has duplicate file name %s! (ids: %s and %s)" % (n, fileName, modelNode.GetID(), storageNode.GetID()))
success = False
#
# now check that each model has a unique polydata
#
for n in range(numModels):
- modelNode = slicer.mrmlScene.GetNthNodeByClass( n, "vtkMRMLModelNode" )
+ modelNode = slicer.mrmlScene.GetNthNodeByClass(n, "vtkMRMLModelNode")
if polyDataInScene.count(modelNode.GetPolyData()) > 1:
self.delayDisplay(f"Polydata for Model is duplicated! (id: {n} and {modelNode.GetID()})")
success = False
diff --git a/Base/Python/sitkUtils.py b/Base/Python/sitkUtils.py
index 07438d2e69e..3aded71c3ff 100644
--- a/Base/Python/sitkUtils.py
+++ b/Base/Python/sitkUtils.py
@@ -42,7 +42,7 @@ def GetSlicerITKReadWriteAddress(nodeObjectOrName):
so that the image can be read directly from the MRML scene
"""
myNode = nodeObjectOrName if isinstance(nodeObjectOrName, slicer.vtkMRMLNode) else slicer.util.getNode(nodeObjectOrName)
- myNodeSceneAddress = myNode.GetScene().GetAddressAsString("").replace('Addr=','')
+ myNodeSceneAddress = myNode.GetScene().GetAddressAsString("").replace('Addr=', '')
myNodeSceneID = myNode.GetID()
myNodeFullITKAddress = 'slicer:' + myNodeSceneAddress + '#' + myNodeSceneID
return myNodeFullITKAddress
@@ -63,5 +63,5 @@ def EnsureRegistration():
if __sitk__MRMLIDImageIO_Registered__:
return
vl = slicer.modules.volumes.logic()
- volumeNode = vl.AddArchetypeVolume('_DUMMY_DOES_NOT_EXIST__','invalidRead')
+ volumeNode = vl.AddArchetypeVolume('_DUMMY_DOES_NOT_EXIST__', 'invalidRead')
__sitk__MRMLIDImageIO_Registered__ = True
diff --git a/Base/Python/slicer/ScriptedLoadableModule.py b/Base/Python/slicer/ScriptedLoadableModule.py
index 9dc8f6a034c..24f2efe2ffd 100644
--- a/Base/Python/slicer/ScriptedLoadableModule.py
+++ b/Base/Python/slicer/ScriptedLoadableModule.py
@@ -35,7 +35,7 @@ def __init__(self, parent):
# Set module icon from Resources/Icons/.png
moduleDir = os.path.dirname(self.parent.path)
for iconExtension in ['.svg', '.png']:
- iconPath = os.path.join(moduleDir, 'Resources/Icons', self.moduleName+iconExtension)
+ iconPath = os.path.join(moduleDir, 'Resources/Icons', self.moduleName + iconExtension)
if os.path.isfile(iconPath):
parent.icon = qt.QIcon(iconPath)
break
@@ -81,7 +81,7 @@ def runTest(self, msec=100, **kwargs):
class ScriptedLoadableModuleWidget:
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
"""If parent widget is not specified: a top-level widget is created automatically;
the application has to delete this widget (by calling widget.parent.deleteLater() to avoid memory leaks.
"""
@@ -200,7 +200,7 @@ def onReload(self):
# from old ones.
print('\n' * 2)
print('-' * 30)
- print('Reloading module: '+self.moduleName)
+ print('Reloading module: ' + self.moduleName)
print('-' * 30)
print('\n' * 2)
@@ -217,11 +217,11 @@ def onReloadAndTest(self, **kwargs):
def onEditSource(self):
filePath = slicer.util.modulePath(self.moduleName)
- qt.QDesktopServices.openUrl(qt.QUrl("file:///"+filePath, qt.QUrl.TolerantMode))
+ qt.QDesktopServices.openUrl(qt.QUrl("file:///" + filePath, qt.QUrl.TolerantMode))
class ScriptedLoadableModuleLogic:
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
super().__init__()
# Get module name by stripping 'Logic' from the class name
self.moduleName = self.__class__.__name__
@@ -247,9 +247,9 @@ def getParameterNode(self):
parameterNode.SetAttribute("ModuleName", self.moduleName)
return parameterNode
else:
- numberOfScriptedModuleNodes = slicer.mrmlScene.GetNumberOfNodesByClass("vtkMRMLScriptedModuleNode")
+ numberOfScriptedModuleNodes = slicer.mrmlScene.GetNumberOfNodesByClass("vtkMRMLScriptedModuleNode")
for nodeIndex in range(numberOfScriptedModuleNodes):
- parameterNode = slicer.mrmlScene.GetNthNodeByClass( nodeIndex, "vtkMRMLScriptedModuleNode" )
+ parameterNode = slicer.mrmlScene.GetNthNodeByClass(nodeIndex, "vtkMRMLScriptedModuleNode")
if parameterNode.GetAttribute("ModuleName") == self.moduleName:
return parameterNode
# no parameter node was found for this module, therefore we add a new one now
@@ -262,9 +262,9 @@ def getAllParameterNodes(self):
Multiple parameter nodes are useful for storing multiple parameter sets in a single scene.
"""
foundParameterNodes = []
- numberOfScriptedModuleNodes = slicer.mrmlScene.GetNumberOfNodesByClass("vtkMRMLScriptedModuleNode")
+ numberOfScriptedModuleNodes = slicer.mrmlScene.GetNumberOfNodesByClass("vtkMRMLScriptedModuleNode")
for nodeIndex in range(numberOfScriptedModuleNodes):
- parameterNode = slicer.mrmlScene.GetNthNodeByClass( nodeIndex, "vtkMRMLScriptedModuleNode" )
+ parameterNode = slicer.mrmlScene.GetNthNodeByClass(nodeIndex, "vtkMRMLScriptedModuleNode")
if parameterNode.GetAttribute("ModuleName") == self.moduleName:
foundParameterNodes.append(parameterNode)
return foundParameterNodes
@@ -281,12 +281,12 @@ def createParameterNode(self):
return
node = slicer.mrmlScene.CreateNodeByClass("vtkMRMLScriptedModuleNode")
- node.UnRegister(None) # object is owned by the Python variable now
+ node.UnRegister(None) # object is owned by the Python variable now
if self.isSingletonParameterNode:
- node.SetSingletonTag( self.moduleName )
+ node.SetSingletonTag(self.moduleName)
# Add module name in an attribute to allow filtering in node selector widgets
# Note that SetModuleName is not used anymore as it would be redundant with the ModuleName attribute.
- node.SetAttribute( "ModuleName", self.moduleName )
+ node.SetAttribute("ModuleName", self.moduleName)
node.SetName(slicer.mrmlScene.GenerateUniqueName(self.moduleName))
return node
@@ -310,7 +310,7 @@ def __init__(self, *args, **kwargs):
self.enableScreenshots = False
self.screenshotScaleFactor = 1.0
- def delayDisplay(self,message,requestedDelay=None,msec=None):
+ def delayDisplay(self, message, requestedDelay=None, msec=None):
"""
Display messages to the user/tester during testing.
@@ -346,7 +346,7 @@ def delayDisplay(self,message,requestedDelay=None,msec=None):
slicer.util.delayDisplay(message, msec)
- def takeScreenshot(self,name,description,type=-1):
+ def takeScreenshot(self, name, description, type=-1):
""" Take a screenshot of the selected viewport and store as and
annotation snapshot node. Convenience method for automated testing.
@@ -394,7 +394,7 @@ def takeScreenshot(self,name,description,type=-1):
# grab and convert to vtk image data
qimage = ctk.ctkWidgetsUtils.grabWidget(widget)
imageData = vtk.vtkImageData()
- slicer.qMRMLUtils().qImageToVtkImageData(qimage,imageData)
+ slicer.qMRMLUtils().qImageToVtkImageData(qimage, imageData)
annotationLogic = slicer.modules.annotations.logic()
annotationLogic.CreateSnapShot(name, description, type, self.screenshotScaleFactor, imageData)
@@ -403,4 +403,4 @@ def runTest(self):
"""
Run a default selection of tests here.
"""
- logging.warning('No test is defined in '+self.__class__.__name__)
+ logging.warning('No test is defined in ' + self.__class__.__name__)
diff --git a/Base/Python/slicer/__init__.py b/Base/Python/slicer/__init__.py
index 7ec0237cc45..cc64ffa055c 100644
--- a/Base/Python/slicer/__init__.py
+++ b/Base/Python/slicer/__init__.py
@@ -1,19 +1,19 @@
""" This module sets up root logging and loads the Slicer library modules into its namespace."""
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def _createModule(name, globals, docstring):
import imp
import sys
moduleName = name.split('.')[-1]
- module = imp.new_module( moduleName )
+ module = imp.new_module(moduleName)
module.__file__ = __file__
module.__doc__ = docstring
sys.modules[name] = module
globals[moduleName] = module
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
# Create slicer.modules and slicer.moduleNames
_createModule('slicer.modules', globals(),
@@ -30,7 +30,7 @@ def _createModule(name, globals, docstring):
value is the module name.
""")
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
# Load modules: Add VTK and PythonQt python module attributes into slicer namespace
try:
@@ -54,7 +54,7 @@ def _createModule(name, globals, docstring):
del kit
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
# Import numpy and scipy early, as a workaround for application hang in import
# of numpy or scipy at application startup on Windows 11 due to output redirection
# (only needed for embedded Python, not for standalone).
@@ -70,7 +70,7 @@ def _createModule(name, globals, docstring):
except ImportError as detail:
print(detail)
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
# Cleanup: Removing things the user shouldn't have to see.
del _createModule
diff --git a/Base/Python/slicer/cli.py b/Base/Python/slicer/cli.py
index 25da1846221..2f2ecfb4b10 100644
--- a/Base/Python/slicer/cli.py
+++ b/Base/Python/slicer/cli.py
@@ -1,7 +1,7 @@
""" This module is a place holder for convenient functions allowing to interact with CLI."""
-def createNode(cliModule, parameters = None):
+def createNode(cliModule, parameters=None):
"""Creates a new vtkMRMLCommandLineModuleNode for a specific module, with
optional parameters"""
if not cliModule:
@@ -41,9 +41,9 @@ def setNodeParameters(node, parameters):
node.SetParameterAsNode(key, value)
elif isinstance(value, list) or isinstance(value, tuple):
commaSeparatedString = str(value)
- commaSeparatedString = commaSeparatedString[1:len(commaSeparatedString)-1]
+ commaSeparatedString = commaSeparatedString[1:len(commaSeparatedString) - 1]
node.SetParameterAsString(key, commaSeparatedString)
- #TODO: file support
+ # TODO: file support
else:
print("parameter ", key, " has unsupported type ", value.__class__.__name__)
@@ -59,7 +59,7 @@ def runSync(module, node=None, parameters=None, delete_temporary_files=True, upd
return run(module, node=node, parameters=parameters, wait_for_completion=True, delete_temporary_files=delete_temporary_files, update_display=update_display)
-def run(module, node = None, parameters = None, wait_for_completion = False, delete_temporary_files = True, update_display=True):
+def run(module, node=None, parameters=None, wait_for_completion=False, delete_temporary_files=True, update_display=True):
"""Runs a CLI, optionally given a node with optional parameters, returning
back the node (or the new one if created)
node: existing parameter node (None by default)
@@ -83,13 +83,13 @@ def run(module, node = None, parameters = None, wait_for_completion = False, del
logic.ApplyAndWait(node, update_display)
else:
logic.Apply(node, update_display)
- #import slicer.util
- #widget = slicer.util.getModuleGui(module)
- #if not widget:
+ # import slicer.util
+ # widget = slicer.util.getModuleGui(module)
+ # if not widget:
# print "Could not find widget representation for module"
# return None
- #widget.setCurrentCommandLineModuleNode(node)
- #widget.apply()
+ # widget.setCurrentCommandLineModuleNode(node)
+ # widget.apply()
return node
diff --git a/Base/Python/slicer/slicerqt.py b/Base/Python/slicer/slicerqt.py
index c67514ca570..3fdc1ce2f1e 100644
--- a/Base/Python/slicer/slicerqt.py
+++ b/Base/Python/slicer/slicerqt.py
@@ -15,7 +15,7 @@
except: pass
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
class _LogReverseLevelFilter(logging.Filter):
"""
Rejects log records that are at or above the specified level
@@ -28,7 +28,7 @@ def filter(self, record):
return record.levelno < self._levelLimit
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
class SlicerApplicationLogHandler(logging.Handler):
"""
Writes logging records to Slicer application log.
@@ -38,10 +38,10 @@ def __init__(self):
logging.Handler.__init__(self)
if hasattr(ctk, 'ctkErrorLogLevel'):
self.pythonToCtkLevelConverter = {
- logging.DEBUG : ctk.ctkErrorLogLevel.Debug,
- logging.INFO : ctk.ctkErrorLogLevel.Info,
- logging.WARNING : ctk.ctkErrorLogLevel.Warning,
- logging.ERROR : ctk.ctkErrorLogLevel.Error }
+ logging.DEBUG: ctk.ctkErrorLogLevel.Debug,
+ logging.INFO: ctk.ctkErrorLogLevel.Info,
+ logging.WARNING: ctk.ctkErrorLogLevel.Warning,
+ logging.ERROR: ctk.ctkErrorLogLevel.Error}
self.origin = "Python"
self.category = "Python"
@@ -61,7 +61,7 @@ def emit(self, record):
self.handleError(record)
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def initLogging(logger):
"""
Initialize logging by creating log handlers and setting default log level.
@@ -94,7 +94,7 @@ def initLogging(logger):
logger.setLevel(logging.DEBUG)
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
# Set up the root logger
#
# We initialize the root logger because if somebody just called logging.debug(),
@@ -112,17 +112,17 @@ def getSlicerRCFileName():
If that environment variable is not specified then .slicerrc.py in the user's home folder
will be used ('~/.slicerrc.py')."""
import os
- rcfile = os.path.join(slicer.app.slicerHome,".slicerrc.py")
+ rcfile = os.path.join(slicer.app.slicerHome, ".slicerrc.py")
if not os.path.exists(rcfile):
if 'SLICERRC' in os.environ:
rcfile = os.environ['SLICERRC']
else:
- rcfile = os.path.expanduser( '~/.slicerrc.py' )
- rcfile = rcfile.replace('\\','/') # make slashed consistent on Windows
+ rcfile = os.path.expanduser('~/.slicerrc.py')
+ rcfile = rcfile.replace('\\', '/') # make slashed consistent on Windows
return rcfile
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
#
# loadSlicerRCFile - Let's not add this function to 'slicer.util' so that
# the global dictionary of the main context is passed to exec().
@@ -132,22 +132,22 @@ def loadSlicerRCFile():
"""If it exists, execute slicer resource script"""
import os
rcfile = getSlicerRCFileName()
- if os.path.isfile( rcfile ):
- print('Loading Slicer RC file [%s]' % ( rcfile ))
+ if os.path.isfile(rcfile):
+ print('Loading Slicer RC file [%s]' % (rcfile))
exec(open(rcfile).read(), globals())
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
#
# Internal
#
class _Internal:
- def __init__( self ):
+ def __init__(self):
# Set attribute 'slicer.app'
- setattr( slicer, 'app', _qSlicerCoreApplicationInstance )
+ setattr(slicer, 'app', _qSlicerCoreApplicationInstance)
# Listen factory and module manager to update slicer.{modules, moduleNames} when appropriate
moduleManager = slicer.app.moduleManager()
@@ -157,51 +157,51 @@ def __init__( self ):
# This would be the case if, for example, a commandline module wants to
# use qSlicerApplication for tcl access but without all the managers.
# Note: This is not the default behavior.
- if hasattr( moduleManager, 'factoryManager' ):
+ if hasattr(moduleManager, 'factoryManager'):
factoryManager = moduleManager.factoryManager()
- factoryManager.connect( 'modulesRegistered(QStringList)', self.setSlicerModuleNames )
- moduleManager.connect( 'moduleLoaded(QString)', self.setSlicerModules )
- moduleManager.connect( 'moduleAboutToBeUnloaded(QString)', self.unsetSlicerModule )
+ factoryManager.connect('modulesRegistered(QStringList)', self.setSlicerModuleNames)
+ moduleManager.connect('moduleLoaded(QString)', self.setSlicerModules)
+ moduleManager.connect('moduleAboutToBeUnloaded(QString)', self.unsetSlicerModule)
# Retrieve current instance of the scene and set 'slicer.mrmlScene'
- setattr( slicer, 'mrmlScene', slicer.app.mrmlScene() )
+ setattr(slicer, 'mrmlScene', slicer.app.mrmlScene())
# HACK - Since qt.QTimer.singleShot is both a property and a static method, the property
# is wrapped in python and prevent the call to the convenient static method having
# the same name. To fix the problem, let's overwrite it's value.
# Ideally this should be fixed in PythonQt itself.
- def _singleShot( msec, receiverOrCallable, member=None ):
+ def _singleShot(msec, receiverOrCallable, member=None):
"""Calls either a python function or a slot after a given time interval."""
# Add 'moduleManager' as parent to prevent the premature destruction of the timer.
# Doing so, we ensure that the QTimer will be deleted before PythonQt is cleanup.
# Indeed, the moduleManager is destroyed before the pythonManager.
- timer = qt.QTimer( slicer.app.moduleManager() )
- timer.setSingleShot( True )
- if callable( receiverOrCallable ):
- timer.connect( "timeout()", receiverOrCallable )
+ timer = qt.QTimer(slicer.app.moduleManager())
+ timer.setSingleShot(True)
+ if callable(receiverOrCallable):
+ timer.connect("timeout()", receiverOrCallable)
else:
- timer.connect( "timeout()", receiverOrCallable, member )
- timer.start( msec )
+ timer.connect("timeout()", receiverOrCallable, member)
+ timer.start(msec)
- qt.QTimer.singleShot = staticmethod( _singleShot )
+ qt.QTimer.singleShot = staticmethod(_singleShot)
- def setSlicerModuleNames( self, moduleNames):
+ def setSlicerModuleNames(self, moduleNames):
"""Add module names as attributes of module slicer.moduleNames"""
for name in moduleNames:
- setattr( slicer.moduleNames, name, name )
+ setattr(slicer.moduleNames, name, name)
# HACK For backward compatibility with ITKv3, map "dwiconvert" module name to "dicomtonrrdconverter"
if name == 'DWIConvert':
- setattr( slicer.moduleNames, 'DicomToNrrdConverter', name )
+ setattr(slicer.moduleNames, 'DicomToNrrdConverter', name)
- def setSlicerModules( self, moduleName ):
+ def setSlicerModules(self, moduleName):
"""Add modules as attributes of module slicer.modules"""
moduleManager = slicer.app.moduleManager()
- setattr( slicer.modules, moduleName.lower(), moduleManager.module(moduleName) )
+ setattr(slicer.modules, moduleName.lower(), moduleManager.module(moduleName))
# HACK For backward compatibility with ITKv3, map "dicomtonrrdconverter" module to "dwiconvert"
if moduleName == 'DWIConvert':
- setattr( slicer.modules, 'dicomtonrrdconverter', moduleManager.module(moduleName) )
+ setattr(slicer.modules, 'dicomtonrrdconverter', moduleManager.module(moduleName))
- def unsetSlicerModule( self, moduleName ):
+ def unsetSlicerModule(self, moduleName):
"""Remove attribute from ``slicer.modules``
"""
if hasattr(slicer.modules, moduleName + "Instance"):
diff --git a/Base/Python/slicer/testing.py b/Base/Python/slicer/testing.py
index 18b88ccfe37..20b3b8d61df 100644
--- a/Base/Python/slicer/testing.py
+++ b/Base/Python/slicer/testing.py
@@ -6,7 +6,7 @@ def exitSuccess():
pass
-def exitFailure(message = ""):
+def exitFailure(message=""):
raise Exception(message)
diff --git a/Base/Python/slicer/tests/test_slicer_mgh.py b/Base/Python/slicer/tests/test_slicer_mgh.py
index da8aef947c6..75059e94480 100644
--- a/Base/Python/slicer/tests/test_slicer_mgh.py
+++ b/Base/Python/slicer/tests/test_slicer_mgh.py
@@ -7,12 +7,12 @@
class SlicerUtilLoadSaveMGHTests(unittest.TestCase):
def setUp(self):
- for MGHFileNames in ['MGH_T1.mgz','MGH_T1_longname.mgh.gz','MGH_T1_uncompressed.mgz']:
+ for MGHFileNames in ['MGH_T1.mgz', 'MGH_T1_longname.mgh.gz', 'MGH_T1_uncompressed.mgz']:
try:
os.remove(os.path.join(slicer.app.temporaryPath, MGHFileNames))
except OSError:
pass
- shutil.rmtree(os.path.join(slicer.app.temporaryPath, 'SlicerUtilLoadSaveMGHTests' ), True)
+ shutil.rmtree(os.path.join(slicer.app.temporaryPath, 'SlicerUtilLoadSaveMGHTests'), True)
def test_saveShortCompressedNode(self):
node = slicer.util.getNode('T1')
diff --git a/Base/Python/slicer/tests/test_slicer_minc.py b/Base/Python/slicer/tests/test_slicer_minc.py
index 2ca5cb59bb3..268db0fd7b5 100644
--- a/Base/Python/slicer/tests/test_slicer_minc.py
+++ b/Base/Python/slicer/tests/test_slicer_minc.py
@@ -12,7 +12,7 @@ def setUp(self):
os.remove(os.path.join(slicer.app.temporaryPath, MINCFileNames))
except OSError:
pass
- shutil.rmtree(os.path.join(slicer.app.temporaryPath, 'SlicerUtilLoadSaveMINCTests' ), True)
+ shutil.rmtree(os.path.join(slicer.app.temporaryPath, 'SlicerUtilLoadSaveMINCTests'), True)
def test_saveMINCNode(self):
node = slicer.util.getNode('pd_z-_float_xyz')
diff --git a/Base/Python/slicer/tests/test_slicer_python_sqlite3.py b/Base/Python/slicer/tests/test_slicer_python_sqlite3.py
index 50be2d2fb2c..6200ed60119 100644
--- a/Base/Python/slicer/tests/test_slicer_python_sqlite3.py
+++ b/Base/Python/slicer/tests/test_slicer_python_sqlite3.py
@@ -18,7 +18,7 @@ def test_sqliteDatabase(self):
import sqlite3
database_filename = os.path.join(self.tempDir, 'database.sql')
- print("database_filename="+database_filename)
+ print("database_filename=" + database_filename)
self.connection = sqlite3.connect(database_filename)
print(sqlite3.version)
diff --git a/Base/Python/slicer/tests/test_slicer_util_getNodes.py b/Base/Python/slicer/tests/test_slicer_util_getNodes.py
index ef63bddc82a..5ed126bc049 100644
--- a/Base/Python/slicer/tests/test_slicer_util_getNodes.py
+++ b/Base/Python/slicer/tests/test_slicer_util_getNodes.py
@@ -22,7 +22,7 @@ def _configure_scene(scene):
return nodes
def test_getFirstNodeByName(self):
- self.assertEqual(slicer.util.getFirstNodeByName("Volume", 'vtkMRMLScalarVolumeNode').GetName(), "Volume1" )
+ self.assertEqual(slicer.util.getFirstNodeByName("Volume", 'vtkMRMLScalarVolumeNode').GetName(), "Volume1")
def test_getNode(self):
@@ -60,5 +60,5 @@ def test_getNodesMultipleNodesSharingName(self):
self.assertEqual(list(slicer.util.getNodes("Volume").keys()), ["Volume"])
self.assertIsInstance(slicer.util.getNodes("Volume")["Volume"], vtk.vtkObject)
- self.assertEqual(list(slicer.util.getNodes("Volume",useLists=True).keys()), ["Volume"])
- self.assertIsInstance(slicer.util.getNodes("Volume",useLists=True)["Volume"], list)
+ self.assertEqual(list(slicer.util.getNodes("Volume", useLists=True).keys()), ["Volume"])
+ self.assertIsInstance(slicer.util.getNodes("Volume", useLists=True)["Volume"], list)
diff --git a/Base/Python/slicer/util.py b/Base/Python/slicer/util.py
index 2bedcca9b33..488a438f7ee 100644
--- a/Base/Python/slicer/util.py
+++ b/Base/Python/slicer/util.py
@@ -120,12 +120,12 @@ def startupEnvironment():
# Custom Import
#
-def importVTKClassesFromDirectory(directory, dest_module_name, filematch = '*'):
+def importVTKClassesFromDirectory(directory, dest_module_name, filematch='*'):
from vtk import vtkObjectBase
importClassesFromDirectory(directory, dest_module_name, vtkObjectBase, filematch)
-def importQtClassesFromDirectory(directory, dest_module_name, filematch = '*'):
+def importQtClassesFromDirectory(directory, dest_module_name, filematch='*'):
importClassesFromDirectory(directory, dest_module_name, 'PythonQtClassWrapper', filematch)
@@ -137,7 +137,7 @@ def importQtClassesFromDirectory(directory, dest_module_name, filematch = '*'):
__import_classes_cache = set()
-def importClassesFromDirectory(directory, dest_module_name, type_info, filematch = '*'):
+def importClassesFromDirectory(directory, dest_module_name, type_info, filematch='*'):
# Create entry for __import_classes_cache
cache_key = ",".join([str(arg) for arg in [directory, dest_module_name, type_info, filematch]])
# Check if function has already been called with this set of parameters
@@ -208,7 +208,7 @@ def lookupTopLevelWidget(objectName):
"""
from slicer import app
for w in app.topLevelWidgets():
- if hasattr(w,'objectName'):
+ if hasattr(w, 'objectName'):
if w.objectName == objectName: return w
# not found
raise RuntimeError("Failed to obtain reference to '%s'" % objectName)
@@ -241,7 +241,7 @@ def pythonShell():
return console
-def showStatusMessage(message, duration = 0):
+def showStatusMessage(message, duration=0):
"""Display ``message`` in the status bar.
"""
mw = mainWindow()
@@ -281,7 +281,7 @@ def findChildren(widget=None, name="", text="", title="", className=""):
# sometimes, p is null, f.e. when using --python-script or --python-code
if not p:
continue
- if not hasattr(p,'children'):
+ if not hasattr(p, 'children'):
continue
parents += p.children()
matched_filter_criteria = 0
@@ -338,7 +338,7 @@ def loadUI(path):
return widget
-def startQtDesigner(args = None):
+def startQtDesigner(args=None):
""" Start Qt Designer application to allow editing UI files.
"""
import slicer
@@ -366,7 +366,7 @@ def childWidgetVariables(widget):
self.ui.outputSelector.setMRMLScene(slicer.mrmlScene)
"""
- ui = type('', (), {})() # empty object
+ ui = type('', (), {})() # empty object
childWidgets = findChildren(widget)
for childWidget in childWidgets:
if hasattr(childWidget, "name"):
@@ -411,17 +411,17 @@ def updateParameterNodeFromGUI(self, caller=None, event=None):
for (widget, parameterName) in parameterEditWidgets:
widgetClassName = widget.className()
- if widgetClassName=="QSpinBox":
+ if widgetClassName == "QSpinBox":
widget.connect("valueChanged(int)", updateParameterNodeFromGUI)
- elif widgetClassName=="QCheckBox":
+ elif widgetClassName == "QCheckBox":
widget.connect("clicked()", updateParameterNodeFromGUI)
- elif widgetClassName=="QPushButton":
+ elif widgetClassName == "QPushButton":
widget.connect("toggled(bool)", updateParameterNodeFromGUI)
- elif widgetClassName=="qMRMLNodeComboBox":
+ elif widgetClassName == "qMRMLNodeComboBox":
widget.connect("currentNodeIDChanged(QString)", updateParameterNodeFromGUI)
- elif widgetClassName=="QComboBox":
+ elif widgetClassName == "QComboBox":
widget.connect("currentIndexChanged(int)", updateParameterNodeFromGUI)
- elif widgetClassName=="ctkSliderWidget":
+ elif widgetClassName == "ctkSliderWidget":
widget.connect("valueChanged(double)", updateParameterNodeFromGUI)
@@ -431,15 +431,15 @@ def removeParameterEditWidgetConnections(parameterEditWidgets, updateParameterNo
for (widget, parameterName) in parameterEditWidgets:
widgetClassName = widget.className()
- if widgetClassName=="QSpinBox":
+ if widgetClassName == "QSpinBox":
widget.disconnect("valueChanged(int)", updateParameterNodeFromGUI)
- elif widgetClassName=="QPushButton":
+ elif widgetClassName == "QPushButton":
widget.disconnect("toggled(bool)", updateParameterNodeFromGUI)
- elif widgetClassName=="qMRMLNodeComboBox":
+ elif widgetClassName == "qMRMLNodeComboBox":
widget.disconnect("currentNodeIDChanged(QString)", updateParameterNodeFromGUI)
- elif widgetClassName=="QComboBox":
+ elif widgetClassName == "QComboBox":
widget.disconnect("currentIndexChanged(int)", updateParameterNodeFromGUI)
- elif widgetClassName=="ctkSliderWidget":
+ elif widgetClassName == "ctkSliderWidget":
widget.disconnect("valueChanged(double)", updateParameterNodeFromGUI)
@@ -456,21 +456,21 @@ def updateParameterEditWidgetsFromNode(parameterEditWidgets, parameterNode):
for (widget, parameterName) in parameterEditWidgets:
widgetClassName = widget.className()
parameterValue = parameterNode.GetParameter(parameterName)
- if widgetClassName=="QSpinBox":
+ if widgetClassName == "QSpinBox":
if parameterValue:
widget.value = int(float(parameterValue))
else:
widget.value = 0
- if widgetClassName=="ctkSliderWidget":
+ if widgetClassName == "ctkSliderWidget":
if parameterValue:
widget.value = float(parameterValue)
else:
widget.value = 0.0
- elif widgetClassName=="QCheckBox" or widgetClassName=="QPushButton":
+ elif widgetClassName == "QCheckBox" or widgetClassName == "QPushButton":
widget.checked = (parameterValue == "true")
- elif widgetClassName=="QComboBox":
+ elif widgetClassName == "QComboBox":
widget.setCurrentText(parameterValue)
- elif widgetClassName=="qMRMLNodeComboBox":
+ elif widgetClassName == "qMRMLNodeComboBox":
widget.currentNodeID = parameterNode.GetNodeReferenceID(parameterName)
@@ -486,13 +486,13 @@ def updateNodeFromParameterEditWidgets(parameterEditWidgets, parameterNode):
for (widget, parameterName) in parameterEditWidgets:
widgetClassName = widget.className()
- if widgetClassName=="QSpinBox" or widgetClassName=="ctkSliderWidget":
+ if widgetClassName == "QSpinBox" or widgetClassName == "ctkSliderWidget":
parameterNode.SetParameter(parameterName, str(widget.value))
- elif widgetClassName=="QCheckBox" or widgetClassName=="QPushButton":
+ elif widgetClassName == "QCheckBox" or widgetClassName == "QPushButton":
parameterNode.SetParameter(parameterName, "true" if widget.checked else "false")
- elif widgetClassName=="QComboBox":
+ elif widgetClassName == "QComboBox":
parameterNode.SetParameter(parameterName, widget.currentText)
- elif widgetClassName=="qMRMLNodeComboBox":
+ elif widgetClassName == "qMRMLNodeComboBox":
parameterNode.SetNodeReferenceID(parameterName, widget.currentNodeID)
@@ -821,7 +821,7 @@ def loadScalarOverlay(filename, modelNodeID, returnNode=False):
:return: loaded node (if multiple nodes are loaded then a list of nodes).
If returnNode is True then a status flag and loaded node are returned.
"""
- return loadNodeFromFile(filename, 'ScalarOverlayFile', {'modelNodeId': modelNodeID }, returnNode)
+ return loadNodeFromFile(filename, 'ScalarOverlayFile', {'modelNodeId': modelNodeID}, returnNode)
def loadSegmentation(filename, returnNode=False):
@@ -1260,7 +1260,7 @@ def reloadScriptedModule(moduleName):
p = os.path.dirname(filePath)
if not p in sys.path:
- sys.path.insert(0,p)
+ sys.path.insert(0, p)
with open(filePath, encoding='utf8') as fp:
reloaded_module = imp.load_module(
@@ -1310,7 +1310,7 @@ def setModulePanelTitleVisible(visible):
mw = mainWindow()
if mw is None:
return
- modulePanelDockWidget = mw.findChildren('QDockWidget','PanelDockWidget')[0]
+ modulePanelDockWidget = mw.findChildren('QDockWidget', 'PanelDockWidget')[0]
if visible:
modulePanelDockWidget.setTitleBarWidget(None)
else:
@@ -1542,7 +1542,7 @@ def getSubjectHierarchyItemChildren(parentItem=None, recursive=False):
# MRML-numpy
#
-def array(pattern = "", index = 0):
+def array(pattern="", index=0):
"""Return the array you are "most likely to want" from the indexth
MRML node that matches the pattern.
@@ -1571,7 +1571,7 @@ def array(pattern = "", index = 0):
return arrayFromTransformMatrix(node)
# TODO: accessors for other node types: polydata (verts, polys...), colors
- raise RuntimeError("Cannot get node "+node.GetID()+" as array")
+ raise RuntimeError("Cannot get node " + node.GetID() + " as array")
def arrayFromVolume(volumeNode):
@@ -1607,9 +1607,9 @@ def arrayFromVolume(volumeNode):
nshape = nshape + (components,)
narray = vtk.util.numpy_support.vtk_to_numpy(vimage.GetPointData().GetScalars()).reshape(nshape)
elif volumeNode.GetClassName() in tensorTypes:
- narray = vtk.util.numpy_support.vtk_to_numpy(vimage.GetPointData().GetTensors()).reshape(nshape+(3,3))
+ narray = vtk.util.numpy_support.vtk_to_numpy(vimage.GetPointData().GetTensors()).reshape(nshape + (3, 3))
else:
- raise RuntimeError("Unsupported volume type: "+volumeNode.GetClassName())
+ raise RuntimeError("Unsupported volume type: " + volumeNode.GetClassName())
return narray
@@ -1657,9 +1657,9 @@ def _vtkArrayFromModelData(modelNode, arrayName, location):
:raises ValueError: in case of failure
"""
- if location=='point':
+ if location == 'point':
modelData = modelNode.GetMesh().GetPointData()
- elif location=='cell':
+ elif location == 'cell':
modelData = modelNode.GetMesh().GetCellData()
else:
raise ValueError("Location attribute must be set to 'point' or 'cell'")
@@ -1815,16 +1815,16 @@ def vtkMatrixFromArray(narray):
from vtk import vtkMatrix4x4
from vtk import vtkMatrix3x3
narrayshape = narray.shape
- if narrayshape == (4,4):
+ if narrayshape == (4, 4):
vmatrix = vtkMatrix4x4()
updateVTKMatrixFromArray(vmatrix, narray)
return vmatrix
- elif narrayshape == (3,3):
+ elif narrayshape == (3, 3):
vmatrix = vtkMatrix3x3()
updateVTKMatrixFromArray(vmatrix, narray)
return vmatrix
else:
- raise RuntimeError("Unsupported numpy array shape: "+str(narrayshape)+" expected (4,4)")
+ raise RuntimeError("Unsupported numpy array shape: " + str(narrayshape) + " expected (4,4)")
def updateVTKMatrixFromArray(vmatrix, narray):
@@ -1868,11 +1868,11 @@ def arrayFromTransformMatrix(transformNode, toWorld=False):
else:
success = transformNode.GetMatrixTransformToParent(vmatrix)
if not success:
- raise RuntimeError("Failed to get transformation matrix from node "+transformNode.GetID())
+ raise RuntimeError("Failed to get transformation matrix from node " + transformNode.GetID())
return arrayFromVTKMatrix(vmatrix)
-def updateTransformMatrixFromArray(transformNode, narray, toWorld = False):
+def updateTransformMatrixFromArray(transformNode, narray, toWorld=False):
"""Set transformation matrix from a numpy array of size 4x4 (toParent).
:param world: if set to True then the transform will be set so that transform
@@ -1883,13 +1883,13 @@ def updateTransformMatrixFromArray(transformNode, narray, toWorld = False):
import numpy as np
from vtk import vtkMatrix4x4
narrayshape = narray.shape
- if narrayshape != (4,4):
- raise RuntimeError("Unsupported numpy array shape: "+str(narrayshape)+" expected (4,4)")
+ if narrayshape != (4, 4):
+ raise RuntimeError("Unsupported numpy array shape: " + str(narrayshape) + " expected (4,4)")
if toWorld and transformNode.GetParentTransformNode():
# thisToParent = worldToParent * thisToWorld = inv(parentToWorld) * toWorld
narrayParentToWorld = arrayFromTransformMatrix(transformNode.GetParentTransformNode())
thisToParent = np.dot(np.linalg.inv(narrayParentToWorld), narray)
- updateTransformMatrixFromArray(transformNode, thisToParent, toWorld = False)
+ updateTransformMatrixFromArray(transformNode, thisToParent, toWorld=False)
else:
vmatrix = vtkMatrix4x4()
updateVTKMatrixFromArray(vmatrix, narray)
@@ -2035,7 +2035,7 @@ def updateSegmentBinaryLabelmapFromArray(narray, segmentationNode, segmentId, re
slicer.mrmlScene.RemoveNode(labelmapVolumeNode)
-def arrayFromMarkupsControlPoints(markupsNode, world = False):
+def arrayFromMarkupsControlPoints(markupsNode, world=False):
"""Return control point positions of a markups node as rows in a numpy array (of size Nx3).
:param world: if set to True then the control points coordinates are returned in world coordinate system
@@ -2050,13 +2050,13 @@ def arrayFromMarkupsControlPoints(markupsNode, world = False):
narray = np.zeros([numberOfControlPoints, 3])
for controlPointIndex in range(numberOfControlPoints):
if world:
- markupsNode.GetNthControlPointPositionWorld(controlPointIndex, narray[controlPointIndex,:])
+ markupsNode.GetNthControlPointPositionWorld(controlPointIndex, narray[controlPointIndex, :])
else:
- markupsNode.GetNthControlPointPosition(controlPointIndex, narray[controlPointIndex,:])
+ markupsNode.GetNthControlPointPosition(controlPointIndex, narray[controlPointIndex, :])
return narray
-def updateMarkupsControlPointsFromArray(markupsNode, narray, world = False):
+def updateMarkupsControlPointsFromArray(markupsNode, narray, world=False):
"""Sets control point positions in a markups node from a numpy array of size Nx3.
:param world: if set to True then the control point coordinates are expected in world coordinate system.
@@ -2069,30 +2069,30 @@ def updateMarkupsControlPointsFromArray(markupsNode, narray, world = False):
markupsNode.RemoveAllControlPoints()
return
if len(narrayshape) != 2 or narrayshape[1] != 3:
- raise RuntimeError("Unsupported numpy array shape: "+str(narrayshape)+" expected (N,3)")
+ raise RuntimeError("Unsupported numpy array shape: " + str(narrayshape) + " expected (N,3)")
numberOfControlPoints = narrayshape[0]
oldNumberOfControlPoints = markupsNode.GetNumberOfControlPoints()
# Update existing control points
for controlPointIndex in range(min(numberOfControlPoints, oldNumberOfControlPoints)):
if world:
- markupsNode.SetNthControlPointPositionWorldFromArray(controlPointIndex, narray[controlPointIndex,:])
+ markupsNode.SetNthControlPointPositionWorldFromArray(controlPointIndex, narray[controlPointIndex, :])
else:
- markupsNode.SetNthControlPointPositionFromArray(controlPointIndex, narray[controlPointIndex,:])
+ markupsNode.SetNthControlPointPositionFromArray(controlPointIndex, narray[controlPointIndex, :])
if numberOfControlPoints >= oldNumberOfControlPoints:
# Add new points to the markup node
from vtk import vtkVector3d
for controlPointIndex in range(oldNumberOfControlPoints, numberOfControlPoints):
if world:
- markupsNode.AddControlPointWorld(vtkVector3d(narray[controlPointIndex,:]))
+ markupsNode.AddControlPointWorld(vtkVector3d(narray[controlPointIndex, :]))
else:
- markupsNode.AddControlPoint(vtkVector3d(narray[controlPointIndex,:]))
+ markupsNode.AddControlPoint(vtkVector3d(narray[controlPointIndex, :]))
else:
# Remove extra point from the markup node
for controlPointIndex in range(oldNumberOfControlPoints, numberOfControlPoints, -1):
- markupsNode.RemoveNthControlPoint(controlPointIndex-1)
+ markupsNode.RemoveNthControlPoint(controlPointIndex - 1)
-def arrayFromMarkupsCurvePoints(markupsNode, world = False):
+def arrayFromMarkupsCurvePoints(markupsNode, world=False):
"""Return interpolated curve point positions of a markups node as rows in a numpy array (of size Nx3).
:param world: if set to True then the point coordinates are returned in world coordinate system
@@ -2164,7 +2164,7 @@ def updateVolumeFromArray(volumeNode, narray):
vshape = vshape[1:4]
else:
# TODO: add support for tensor volumes
- raise RuntimeError("Unsupported numpy array shape: "+str(narray.shape))
+ raise RuntimeError("Unsupported numpy array shape: " + str(narray.shape))
vimage = volumeNode.GetImageData()
if not vimage:
@@ -2299,7 +2299,7 @@ def updateTableFromArray(tableNode, narrays, columnNames=None):
if isinstance(columnNames, str):
columnNames = [columnNames]
for columnIndex, ncolumn in enumerate(ncolumns):
- vcolumn = vtk.util.numpy_support.numpy_to_vtk(num_array=ncolumn.ravel(),deep=True,array_type=vtk.VTK_FLOAT)
+ vcolumn = vtk.util.numpy_support.numpy_to_vtk(num_array=ncolumn.ravel(), deep=True, array_type=vtk.VTK_FLOAT)
if (columnNames is not None) and (columnIndex < len(columnNames)):
vcolumn.SetName(columnNames[columnIndex])
tableNode.AddColumn(vcolumn)
@@ -2322,11 +2322,11 @@ def dataframeFromTable(tableNode):
raise ImportError("Failed to convert to pandas dataframe. Please install pandas by running `slicer.util.pip_install('pandas')`")
dataframe = pd.DataFrame()
vtable = tableNode.GetTable()
- for columnIndex in range (vtable.GetNumberOfColumns()):
+ for columnIndex in range(vtable.GetNumberOfColumns()):
vcolumn = vtable.GetColumn(columnIndex)
column = []
numberOfComponents = vcolumn.GetNumberOfComponents()
- if numberOfComponents==1:
+ if numberOfComponents == 1:
# most common, simple case
for rowIndex in range(vcolumn.GetNumberOfValues()):
column.append(vcolumn.GetValue(rowIndex))
@@ -2370,7 +2370,7 @@ def dataframeFromMarkups(markupsNode):
for controlPointIndex in range(numberOfControlPoints):
label.append(markupsNode.GetNthControlPointLabel(controlPointIndex))
description.append(markupsNode.GetNthControlPointDescription(controlPointIndex))
- p=[0,0,0]
+ p = [0, 0, 0]
markupsNode.GetNthControlPointPositionWorld(controlPointIndex, p)
positionWorldR.append(p[0])
positionWorldA.append(p[1])
@@ -2498,7 +2498,7 @@ def toLatin1String(text):
# File Utilities
#
-def tempDirectory(key='__SlicerTemp__',tempDir=None,includeDateTime=True):
+def tempDirectory(key='__SlicerTemp__', tempDir=None, includeDateTime=True):
"""Come up with a unique directory name in the temp dir and make it and return it
Note: this directory is not automatically cleaned up
@@ -2538,7 +2538,7 @@ def delayDisplay(message, autoCloseMsec=1000, parent=None, **kwargs):
setattr(messagePopup, key, value)
layout = qt.QVBoxLayout()
messagePopup.setLayout(layout)
- label = qt.QLabel(message,messagePopup)
+ label = qt.QLabel(message, messagePopup)
layout.addWidget(label)
if autoCloseMsec >= 0:
qt.QTimer.singleShot(autoCloseMsec, messagePopup.close)
@@ -2655,7 +2655,7 @@ def _messageDisplay(logLevel, text, testingReturnValue, mainWindowNeeded=False,
"""
import slicer, logging
logging.log(logLevel, text)
- logLevelString = logging.getLevelName(logLevel).lower() # e.g. this is "error" when logLevel is logging.ERROR
+ logLevelString = logging.getLevelName(logLevel).lower() # e.g. this is "error" when logLevel is logging.ERROR
if not windowTitle:
windowTitle = slicer.app.applicationName + " " + logLevelString
if slicer.app.testingEnabled():
@@ -2938,7 +2938,7 @@ def settingsValue(key, default, converter=lambda v: v, settings=None):
return converter(settings.value(key)) if settings.contains(key) else default
-def clickAndDrag(widget,button='Left',start=(10,10),end=(10,40),steps=20,modifiers=[]):
+def clickAndDrag(widget, button='Left', start=(10, 10), end=(10, 40), steps=20, modifiers=[]):
"""Send synthetic mouse events to the specified widget (qMRMLSliceWidget or qMRMLThreeDView)
:param button: "Left", "Middle", "Right", or "None"
@@ -2973,8 +2973,8 @@ def onClick(caller,event):
down = interactor.MiddleButtonPressEvent
up = interactor.MiddleButtonReleaseEvent
elif button == 'None' or not button:
- down = lambda : None
- up = lambda : None
+ down = lambda: None
+ up = lambda: None
else:
raise RuntimeError("Bad button - should be Left or Right, not %s" % button)
if 'Shift' in modifiers:
@@ -2983,15 +2983,15 @@ def onClick(caller,event):
interactor.SetControlKey(1)
interactor.SetEventPosition(*start)
down()
- if (steps<2):
+ if (steps < 2):
interactor.SetEventPosition(end[0], end[1])
interactor.MouseMoveEvent()
else:
for step in range(steps):
- frac = float(step)/(steps-1)
- x = int(start[0] + frac*(end[0]-start[0]))
- y = int(start[1] + frac*(end[1]-start[1]))
- interactor.SetEventPosition(x,y)
+ frac = float(step) / (steps - 1)
+ x = int(start[0] + frac * (end[0] - start[0]))
+ y = int(start[1] + frac * (end[1] - start[1]))
+ interactor.SetEventPosition(x, y)
interactor.MouseMoveEvent()
up()
interactor.SetShiftKey(0)
@@ -3068,7 +3068,7 @@ def extractArchive(archiveFilePath, outputDir, expectedNumberOfExtractedFiles=No
return False
fileName, fileExtension = os.path.splitext(archiveFilePath)
if fileExtension.lower() != '.zip':
- #TODO: Support other archive types
+ # TODO: Support other archive types
logging.error('Only zip archives are supported now, got ' + fileExtension)
return False
@@ -3176,11 +3176,11 @@ def _cleanup():
def getFilesInDirectory(directory, absolutePath=True):
"""Collect all files in a directory and its subdirectories in a list."""
import os
- allFiles=[]
+ allFiles = []
for root, subdirs, files in os.walk(directory):
for fileName in files:
if absolutePath:
- fileAbsolutePath = os.path.abspath(os.path.join(root, fileName)).replace('\\','/')
+ fileAbsolutePath = os.path.abspath(os.path.join(root, fileName)).replace('\\', '/')
allFiles.append(fileAbsolutePath)
else:
allFiles.append(fileName)
@@ -3210,7 +3210,7 @@ def __exit__(self, *excinfo):
os.chdir(self._old_cwd.pop())
-def plot(narray, xColumnIndex = -1, columnNames = None, title = None, show = True, nodes = None):
+def plot(narray, xColumnIndex=-1, columnNames=None, title=None, show=True, nodes=None):
"""Create a plot from a numpy array that contains two or more columns.
:param narray: input numpy array containing data series in columns.
@@ -3282,7 +3282,7 @@ def plot(narray, xColumnIndex = -1, columnNames = None, title = None, show = Tru
tableNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLTableNode")
if title is not None:
- tableNode.SetName(title+' table')
+ tableNode.SetName(title + ' table')
updateTableFromArray(tableNode, narray)
# Update column names
numberOfColumns = tableNode.GetTable().GetNumberOfColumns()
@@ -3297,7 +3297,7 @@ def plot(narray, xColumnIndex = -1, columnNames = None, title = None, show = Tru
columnName = "Y"
yColumnIndex += 1
else:
- columnName = "Y"+str(yColumnIndex)
+ columnName = "Y" + str(yColumnIndex)
yColumnIndex += 1
tableNode.GetTable().GetColumn(columnIndex).SetName(columnName)
@@ -3416,7 +3416,7 @@ def logProcessOutput(proc):
pass
proc.wait()
- retcode=proc.returncode
+ retcode = proc.returncode
if retcode != 0:
raise CalledProcessError(retcode, proc.args, output=proc.stdout, stderr=proc.stderr)
@@ -3443,7 +3443,7 @@ def _executePythonModule(module, args):
# Running from console
import os
import sys
- pythonSlicerExecutablePath = os.path.dirname(sys.executable)+"/PythonSlicer"
+ pythonSlicerExecutablePath = os.path.dirname(sys.executable) + "/PythonSlicer"
if os.name == 'nt':
pythonSlicerExecutablePath += ".exe"
diff --git a/Base/Python/tests/test_PythonManager.py b/Base/Python/tests/test_PythonManager.py
index 5309b377c60..b0660818e22 100644
--- a/Base/Python/tests/test_PythonManager.py
+++ b/Base/Python/tests/test_PythonManager.py
@@ -21,12 +21,12 @@ def test_toPythonStringLiteral(self):
'test with both single \' and double " quotes',
'test backslash \\ and \'single\' and "double" quotes'
"'test string in single quotes'"
- '"test string in double quotes"' ]
+ '"test string in double quotes"']
for test_string in test_strings:
test_string_literal = slicer.app.pythonManager().toPythonStringLiteral(test_string)
- exec("test_string_literal_value = "+test_string_literal, globals())
- print("Test: "+test_string+" -> "+test_string_literal+" -> "+test_string_literal_value)
+ exec("test_string_literal_value = " + test_string_literal, globals())
+ print("Test: " + test_string + " -> " + test_string_literal + " -> " + test_string_literal_value)
self.assertEqual(test_string, test_string_literal_value)
def tearDown(self):
diff --git a/Base/Python/tests/test_sitkUtils.py b/Base/Python/tests/test_sitkUtils.py
index cc5680f2cf2..11574fd31d6 100644
--- a/Base/Python/tests/test_sitkUtils.py
+++ b/Base/Python/tests/test_sitkUtils.py
@@ -39,10 +39,10 @@ def test_SimpleITK_SlicerPushPull(self):
""" Few pixel changed """
size = sitkimage.GetSize()
- for x in range(0,size[0],int(size[0]/10)):
- for y in range(0,size[1],int(size[1]/10)):
- for z in range(0,size[2],int(size[2]/10)):
- sitkimage.SetPixel(x,y,z,0)
+ for x in range(0, size[0], int(size[0] / 10)):
+ for y in range(0, size[1], int(size[1] / 10)):
+ for z in range(0, size[2], int(size[2] / 10)):
+ sitkimage.SetPixel(x, y, z, 0)
volumeNode1Modified = su.PushVolumeToSlicer(sitkimage, name="ImageChanged", className="vtkMRMLScalarVolumeNode")
self.assertEqual(volumeNode1Modified.GetName(), "ImageChanged",
@@ -54,7 +54,7 @@ def test_SimpleITK_SlicerPushPull(self):
"""
tmp = volumeNode1Modified.GetOrigin()
valToCompare = (-tmp[0], -tmp[1], tmp[2])
- self.assertEqual(valToCompare,sitkimage.GetOrigin(),
+ self.assertEqual(valToCompare, sitkimage.GetOrigin(),
'Modified origin mismatch')
""" Test push with all parameter combinations """
@@ -62,12 +62,12 @@ def test_SimpleITK_SlicerPushPull(self):
volumeNodeTested = None
volumeNodeNew = None
for pushToNewNode in [True, False]:
- print("volumeClassName : %s" % volumeClassName )
- print("pushToNewNode : %s " % pushToNewNode )
+ print("volumeClassName : %s" % volumeClassName)
+ print("pushToNewNode : %s " % pushToNewNode)
if pushToNewNode:
volumeNodeTested = su.PushVolumeToSlicer(sitkimage,
- name='volumeNode-'+volumeClassName+"-"+str(pushToNewNode),
+ name='volumeNode-' + volumeClassName + "-" + str(pushToNewNode),
className=volumeClassName)
existingVolumeNode = volumeNodeTested
else:
diff --git a/Base/QTGUI/Testing/Data/Input/qSlicerScriptedLoadableModuleNewStyleTestWidget.py b/Base/QTGUI/Testing/Data/Input/qSlicerScriptedLoadableModuleNewStyleTestWidget.py
index 5e636bfa350..acb8587cd0e 100644
--- a/Base/QTGUI/Testing/Data/Input/qSlicerScriptedLoadableModuleNewStyleTestWidget.py
+++ b/Base/QTGUI/Testing/Data/Input/qSlicerScriptedLoadableModuleNewStyleTestWidget.py
@@ -11,7 +11,7 @@ def enter(self):
def exit(self):
self.parent.setProperty('exit_called_within_Python', True)
- def setEditedNode(self, node, role = '', context = ''):
+ def setEditedNode(self, node, role='', context=''):
self.parent.setProperty('editedNodeName', node.GetName() if node is not None else "")
self.parent.setProperty('editedNodeRole', role)
self.parent.setProperty('editedNodeContext', context)
diff --git a/Base/QTGUI/Testing/Data/Input/qSlicerScriptedLoadableModuleTestWidget.py b/Base/QTGUI/Testing/Data/Input/qSlicerScriptedLoadableModuleTestWidget.py
index 241ec751c65..72e89524bc3 100644
--- a/Base/QTGUI/Testing/Data/Input/qSlicerScriptedLoadableModuleTestWidget.py
+++ b/Base/QTGUI/Testing/Data/Input/qSlicerScriptedLoadableModuleTestWidget.py
@@ -11,7 +11,7 @@ def enter(self):
def exit(self):
self.parent.setProperty('exit_called_within_Python', True)
- def setEditedNode(self, node, role = '', context = ''):
+ def setEditedNode(self, node, role='', context=''):
self.parent.setProperty('editedNodeName', node.GetName() if node is not None else "")
self.parent.setProperty('editedNodeRole', role)
self.parent.setProperty('editedNodeContext', context)
diff --git a/Docs/conf.py b/Docs/conf.py
index 84c77fc56cc..56efdc592cc 100644
--- a/Docs/conf.py
+++ b/Docs/conf.py
@@ -264,7 +264,7 @@ def _generatemd(dom, docsfolder, outpath, xslt, suffix):
xsltpath = os.path.join(docsfolder, xslt)
transform = ET.XSLT(ET.parse(xsltpath))
content = str(transform(dom))
- with open(os.path.join(outpath, os.path.splitext(name)[0]+suffix+'.md'), 'w', encoding='utf8') as outfile:
+ with open(os.path.join(outpath, os.path.splitext(name)[0] + suffix + '.md'), 'w', encoding='utf8') as outfile:
outfile.write(content)
diff --git a/Extensions/Testing/ScriptedLoadableExtensionTemplate/ScriptedLoadableModuleTemplate/ScriptedLoadableModuleTemplate.py b/Extensions/Testing/ScriptedLoadableExtensionTemplate/ScriptedLoadableModuleTemplate/ScriptedLoadableModuleTemplate.py
index 338c6891acb..9efe4ee299d 100644
--- a/Extensions/Testing/ScriptedLoadableExtensionTemplate/ScriptedLoadableModuleTemplate/ScriptedLoadableModuleTemplate.py
+++ b/Extensions/Testing/ScriptedLoadableExtensionTemplate/ScriptedLoadableModuleTemplate/ScriptedLoadableModuleTemplate.py
@@ -19,10 +19,10 @@ class ScriptedLoadableModuleTemplate(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
- self.parent.title = "ScriptedLoadableModuleTemplate" # TODO make this more human readable by adding spaces
+ self.parent.title = "ScriptedLoadableModuleTemplate" # TODO make this more human readable by adding spaces
self.parent.categories = ["Examples"]
self.parent.dependencies = []
- self.parent.contributors = ["John Doe (AnyWare Corp.)"] # replace with "Firstname Lastname (Organization)"
+ self.parent.contributors = ["John Doe (AnyWare Corp.)"] # replace with "Firstname Lastname (Organization)"
self.parent.helpText = """
This is an example of scripted loadable module bundled in an extension.
It performs a simple thresholding on the input volume and optionally captures a screenshot.
@@ -31,7 +31,7 @@ def __init__(self, parent):
self.parent.acknowledgementText = """
This file was originally developed by Jean-Christophe Fillion-Robin, Kitware Inc.
and Steve Pieper, Isomics, Inc. and was partially funded by NIH grant 3P41RR013218-12S1.
-""" # replace with organization, grant and thanks.
+""" # replace with organization, grant and thanks.
#
# ScriptedLoadableModuleTemplateWidget
@@ -69,8 +69,8 @@ def setup(self):
self.inputSelector.noneEnabled = False
self.inputSelector.showHidden = False
self.inputSelector.showChildNodeTypes = False
- self.inputSelector.setMRMLScene( slicer.mrmlScene )
- self.inputSelector.setToolTip( "Pick the input to the algorithm." )
+ self.inputSelector.setMRMLScene(slicer.mrmlScene)
+ self.inputSelector.setToolTip("Pick the input to the algorithm.")
parametersFormLayout.addRow("Input Volume: ", self.inputSelector)
#
@@ -84,8 +84,8 @@ def setup(self):
self.outputSelector.noneEnabled = True
self.outputSelector.showHidden = False
self.outputSelector.showChildNodeTypes = False
- self.outputSelector.setMRMLScene( slicer.mrmlScene )
- self.outputSelector.setToolTip( "Pick the output to the algorithm." )
+ self.outputSelector.setMRMLScene(slicer.mrmlScene)
+ self.outputSelector.setToolTip("Pick the output to the algorithm.")
parametersFormLayout.addRow("Output Volume: ", self.outputSelector)
#
@@ -153,7 +153,7 @@ class ScriptedLoadableModuleTemplateLogic(ScriptedLoadableModuleLogic):
https://github.com/Slicer/Slicer/blob/master/Base/Python/slicer/ScriptedLoadableModule.py
"""
- def hasImageData(self,volumeNode):
+ def hasImageData(self, volumeNode):
"""This is an example logic method that
returns true if the passed in volume
node has valid image data
@@ -175,7 +175,7 @@ def isValidInputOutputData(self, inputVolumeNode, outputVolumeNode):
if not outputVolumeNode:
logging.debug('isValidInputOutputData failed: no output volume node defined')
return False
- if inputVolumeNode.GetID()==outputVolumeNode.GetID():
+ if inputVolumeNode.GetID() == outputVolumeNode.GetID():
logging.debug('isValidInputOutputData failed: input and output volume is the same. Create a new volume for output to avoid this error.')
return False
return True
@@ -192,7 +192,7 @@ def run(self, inputVolume, outputVolume, imageThreshold):
logging.info('Processing started')
# Compute the thresholded output volume using the Threshold Scalar Volume CLI module
- cliParams = {'InputVolume': inputVolume.GetID(), 'OutputVolume': outputVolume.GetID(), 'ThresholdValue' : imageThreshold, 'ThresholdType' : 'Above'}
+ cliParams = {'InputVolume': inputVolume.GetID(), 'OutputVolume': outputVolume.GetID(), 'ThresholdValue': imageThreshold, 'ThresholdType': 'Above'}
cliNode = slicer.cli.run(slicer.modules.thresholdscalarvolume, None, cliParams, wait_for_completion=True)
logging.info('Processing completed')
@@ -243,6 +243,6 @@ def test_ScriptedLoadableModuleTemplate1(self):
self.delayDisplay('Finished with download and loading')
logic = ScriptedLoadableModuleTemplateLogic()
- self.assertIsNotNone( logic.hasImageData(volumeNode) )
- self.takeScreenshot('ScriptedLoadableModuleTemplateTest-Start','MyScreenshot',-1)
+ self.assertIsNotNone(logic.hasImageData(volumeNode))
+ self.takeScreenshot('ScriptedLoadableModuleTemplateTest-Start', 'MyScreenshot', -1)
self.delayDisplay('Test passed!')
diff --git a/Extensions/Testing/ScriptedSegmentEditorEffectExtensionTemplate/ScriptedSegmentEditorEffectModuleTemplate/SegmentEditorScriptedSegmentEditorEffectModuleTemplate.py b/Extensions/Testing/ScriptedSegmentEditorEffectExtensionTemplate/ScriptedSegmentEditorEffectModuleTemplate/SegmentEditorScriptedSegmentEditorEffectModuleTemplate.py
index ea7de2a680d..c75bdfb0e31 100644
--- a/Extensions/Testing/ScriptedSegmentEditorEffectExtensionTemplate/ScriptedSegmentEditorEffectModuleTemplate/SegmentEditorScriptedSegmentEditorEffectModuleTemplate.py
+++ b/Extensions/Testing/ScriptedSegmentEditorEffectExtensionTemplate/ScriptedSegmentEditorEffectModuleTemplate/SegmentEditorScriptedSegmentEditorEffectModuleTemplate.py
@@ -25,8 +25,8 @@ def __init__(self, parent):
def registerEditorEffect(self):
import qSlicerSegmentationsEditorEffectsPythonQt as qSlicerSegmentationsEditorEffects
instance = qSlicerSegmentationsEditorEffects.qSlicerSegmentEditorScriptedEffect(None)
- effectFilename = os.path.join(os.path.dirname(__file__), self.__class__.__name__+'Lib/SegmentEditorEffect.py')
- instance.setPythonSource(effectFilename.replace('\\','/'))
+ effectFilename = os.path.join(os.path.dirname(__file__), self.__class__.__name__ + 'Lib/SegmentEditorEffect.py')
+ instance.setPythonSource(effectFilename.replace('\\', '/'))
instance.self().register()
@@ -77,9 +77,9 @@ def test_ScriptedSegmentEditorEffectModuleTemplate1(self):
# Segments are defined by a list of: name and a list of sphere [radius, posX, posY, posZ]
segmentGeometries = [
- ['Tumor', [[10, -6,30,28]]],
- ['Background', [[10, 0,65,22], [15, 1, -14, 30], [12, 0, 28, -7], [5, 0,30,54], [12, 31, 33, 27], [17, -42, 30, 27], [6, -2,-17,71]]],
- ['Air', [[10, 76,73,0], [15, -70,74,0]]] ]
+ ['Tumor', [[10, -6, 30, 28]]],
+ ['Background', [[10, 0, 65, 22], [15, 1, -14, 30], [12, 0, 28, -7], [5, 0, 30, 54], [12, 31, 33, 27], [17, -42, 30, 27], [6, -2, -17, 71]]],
+ ['Air', [[10, 76, 73, 0], [15, -70, 74, 0]]]]
for segmentGeometry in segmentGeometries:
segmentName = segmentGeometry[0]
appender = vtk.vtkAppendPolyData()
@@ -117,7 +117,7 @@ def test_ScriptedSegmentEditorEffectModuleTemplate1(self):
self.delayDisplay("Make segmentation results nicely visible in 3D")
segmentationDisplayNode = segmentationNode.GetDisplayNode()
segmentationDisplayNode.SetSegmentVisibility("Air", False)
- segmentationDisplayNode.SetSegmentOpacity3D("Background",0.5)
+ segmentationDisplayNode.SetSegmentOpacity3D("Background", 0.5)
##################################
self.delayDisplay("Compute statistics")
@@ -132,7 +132,7 @@ def test_ScriptedSegmentEditorEffectModuleTemplate1(self):
segStatLogic.showTable(resultsTableNode)
self.delayDisplay("Check a few numerical results")
- self.assertEqual( round(segStatLogic.statistics["Tumor","LM volume cc"]), 16)
- self.assertEqual( round(segStatLogic.statistics["Background","LM volume cc"]), 3010)
+ self.assertEqual(round(segStatLogic.statistics["Tumor", "LM volume cc"]), 16)
+ self.assertEqual(round(segStatLogic.statistics["Background", "LM volume cc"]), 3010)
self.delayDisplay('test_ScriptedSegmentEditorEffectModuleTemplate1 passed')
diff --git a/Extensions/Testing/ScriptedSegmentEditorEffectExtensionTemplate/ScriptedSegmentEditorEffectModuleTemplate/SegmentEditorScriptedSegmentEditorEffectModuleTemplateLib/SegmentEditorEffect.py b/Extensions/Testing/ScriptedSegmentEditorEffectExtensionTemplate/ScriptedSegmentEditorEffectModuleTemplate/SegmentEditorScriptedSegmentEditorEffectModuleTemplateLib/SegmentEditorEffect.py
index a3b4b54ce48..6ba16c89780 100644
--- a/Extensions/Testing/ScriptedSegmentEditorEffectExtensionTemplate/ScriptedSegmentEditorEffectModuleTemplate/SegmentEditorScriptedSegmentEditorEffectModuleTemplateLib/SegmentEditorEffect.py
+++ b/Extensions/Testing/ScriptedSegmentEditorEffectExtensionTemplate/ScriptedSegmentEditorEffectModuleTemplate/SegmentEditorScriptedSegmentEditorEffectModuleTemplateLib/SegmentEditorEffect.py
@@ -14,15 +14,15 @@ class SegmentEditorEffect(AbstractScriptedSegmentEditorEffect):
def __init__(self, scriptedEffect):
scriptedEffect.name = 'ScriptedSegmentEditorEffectModuleTemplate'
- scriptedEffect.perSegment = False # this effect operates on all segments at once (not on a single selected segment)
- scriptedEffect.requireSegments = True # this effect requires segment(s) existing in the segmentation
+ scriptedEffect.perSegment = False # this effect operates on all segments at once (not on a single selected segment)
+ scriptedEffect.requireSegments = True # this effect requires segment(s) existing in the segmentation
AbstractScriptedSegmentEditorEffect.__init__(self, scriptedEffect)
def clone(self):
# It should not be necessary to modify this method
import qSlicerSegmentationsEditorEffectsPythonQt as effects
clonedEffect = effects.qSlicerSegmentEditorScriptedEffect(None)
- clonedEffect.setPythonSource(__file__.replace('\\','/'))
+ clonedEffect.setPythonSource(__file__.replace('\\', '/'))
return clonedEffect
def icon(self):
@@ -43,7 +43,7 @@ def setupOptionsFrame(self):
# Object scale slider
self.objectScaleMmSlider = slicer.qMRMLSliderWidget()
self.objectScaleMmSlider.setMRMLScene(slicer.mrmlScene)
- self.objectScaleMmSlider.quantity = "length" # get unit, precision, etc. from MRML unit node
+ self.objectScaleMmSlider.quantity = "length" # get unit, precision, etc. from MRML unit node
self.objectScaleMmSlider.minimum = 0
self.objectScaleMmSlider.maximum = 10
self.objectScaleMmSlider.value = 2.0
diff --git a/Libs/MRML/Core/Documentation/generate_default_color_node_property_table.py b/Libs/MRML/Core/Documentation/generate_default_color_node_property_table.py
index e73ee8525bf..ea0b52e3f60 100644
--- a/Libs/MRML/Core/Documentation/generate_default_color_node_property_table.py
+++ b/Libs/MRML/Core/Documentation/generate_default_color_node_property_table.py
@@ -59,8 +59,8 @@
print(template.format(**titles))
# Print separator
-print(template.format(**{column_name: '-'*column_width for column_name, column_width in max_row_widths.items()}))
+print(template.format(**{column_name: '-' * column_width for column_name, column_width in max_row_widths.items()}))
# Print content
for row in table:
- print(template.format(**row) )
+ print(template.format(**row))
diff --git a/Libs/vtkITK/Testing/vtkITKArchetypeDiffusionTensorReaderFile.py b/Libs/vtkITK/Testing/vtkITKArchetypeDiffusionTensorReaderFile.py
index 8f5dfa4048b..afb77d2d83e 100644
--- a/Libs/vtkITK/Testing/vtkITKArchetypeDiffusionTensorReaderFile.py
+++ b/Libs/vtkITK/Testing/vtkITKArchetypeDiffusionTensorReaderFile.py
@@ -1,4 +1,4 @@
-#Testing against the NRRD reader
+# Testing against the NRRD reader
import unittest
import numpy
@@ -69,7 +69,7 @@ def runTest(self):
def compare_vtk_matrix(m1, m2, n=4):
- for i in range(0,n):
- for j in range(0,n):
- assert m1.GetElement(i,j) == m2.GetElement(i,j)
+ for i in range(0, n):
+ for j in range(0, n):
+ assert m1.GetElement(i, j) == m2.GetElement(i, j)
return True
diff --git a/Libs/vtkITK/Testing/vtkITKArchetypeScalarReaderFile.py b/Libs/vtkITK/Testing/vtkITKArchetypeScalarReaderFile.py
index 747ea357f51..88fd51cc65f 100644
--- a/Libs/vtkITK/Testing/vtkITKArchetypeScalarReaderFile.py
+++ b/Libs/vtkITK/Testing/vtkITKArchetypeScalarReaderFile.py
@@ -1,4 +1,4 @@
-#Testing against the NRRD reader
+# Testing against the NRRD reader
import unittest
import numpy
@@ -53,7 +53,7 @@ def runTest(self):
def compare_vtk_matrix(m1, m2, n=4):
- for i in range(0,n):
- for j in range(0,n):
- assert m1.GetElement(i,j) == m2.GetElement(i,j)
+ for i in range(0, n):
+ for j in range(0, n):
+ assert m1.GetElement(i, j) == m2.GetElement(i, j)
return True
diff --git a/Modules/Loadable/Annotations/Testing/Python/AnnotationsTestingFiducialWithSceneViewRestore.py b/Modules/Loadable/Annotations/Testing/Python/AnnotationsTestingFiducialWithSceneViewRestore.py
index dd07484bf2a..c1d4378bd87 100644
--- a/Modules/Loadable/Annotations/Testing/Python/AnnotationsTestingFiducialWithSceneViewRestore.py
+++ b/Modules/Loadable/Annotations/Testing/Python/AnnotationsTestingFiducialWithSceneViewRestore.py
@@ -9,26 +9,26 @@
fid.CreateAnnotationPointDisplayNode()
startCoords = [1.0, 2.0, 3.0]
-fid.AddControlPoint(startCoords,0,1)
+fid.AddControlPoint(startCoords, 0, 1)
slicer.mrmlScene.AddNode(fid)
fid.GetFiducialCoordinates(startCoords)
-print("Starting fiducial coordinates = ",startCoords)
+print("Starting fiducial coordinates = ", startCoords)
sv = slicer.mrmlScene.AddNode(slicer.vtkMRMLSceneViewNode())
sv.StoreScene()
fid.SetFiducialCoordinates(11.1, 22.2, 33.3)
-afterStoreSceneCoords = [0,0,0]
+afterStoreSceneCoords = [0, 0, 0]
fid.GetFiducialCoordinates(afterStoreSceneCoords)
-print("After storing the scene, set fiducial coords to ",afterStoreSceneCoords)
+print("After storing the scene, set fiducial coords to ", afterStoreSceneCoords)
sv.RestoreScene()
-fidAfterRestore = slicer.mrmlScene.GetNodeByID("vtkMRMLAnnotationFiducialNode1")
+fidAfterRestore = slicer.mrmlScene.GetNodeByID("vtkMRMLAnnotationFiducialNode1")
-coords = [0,0,0]
+coords = [0, 0, 0]
fidAfterRestore.GetFiducialCoordinates(coords)
print("After restoring the scene, fiducial coordinates = ", coords)
diff --git a/Modules/Loadable/Annotations/Testing/Python/LoadAnnotationRulerScene.py b/Modules/Loadable/Annotations/Testing/Python/LoadAnnotationRulerScene.py
index 1e29a91052c..0cd8783f8f0 100644
--- a/Modules/Loadable/Annotations/Testing/Python/LoadAnnotationRulerScene.py
+++ b/Modules/Loadable/Annotations/Testing/Python/LoadAnnotationRulerScene.py
@@ -10,7 +10,7 @@
scenePath = sys.argv[1]
else:
# set the url as best guess from SLICER_HOME
- scenePath = os.path.join(os.environ['SLICER_HOME'], "../../Slicer4/Modules/Loadable/Annotations/Testing/Data/Input/ruler.mrml")
+ scenePath = os.path.join(os.environ['SLICER_HOME'], "../../Slicer4/Modules/Loadable/Annotations/Testing/Data/Input/ruler.mrml")
scenePath = os.path.normpath(scenePath)
print("Trying to load ruler mrml file", scenePath)
diff --git a/Modules/Loadable/Colors/Testing/Python/ColorLegendSelfTest.py b/Modules/Loadable/Colors/Testing/Python/ColorLegendSelfTest.py
index f30a44c77c3..e803e1bcc33 100644
--- a/Modules/Loadable/Colors/Testing/Python/ColorLegendSelfTest.py
+++ b/Modules/Loadable/Colors/Testing/Python/ColorLegendSelfTest.py
@@ -23,7 +23,7 @@ def __init__(self, parent):
"""
self.parent.acknowledgementText = """
This file was originally developed by Kevin Wang, PMH and was funded by CCO and OCAIRO.
-""" # replace with organization, grant and thanks.
+""" # replace with organization, grant and thanks.
#
# ColorLegendSelfTestWidget
@@ -95,7 +95,7 @@ def test_ColorLegendSelfTest1(self):
import SampleData
sampleDataLogic = SampleData.SampleDataLogic()
ctVolumeNode = sampleDataLogic.downloadCTChest()
- self.assertIsNotNone( ctVolumeNode )
+ self.assertIsNotNone(ctVolumeNode)
self.delayDisplay('Switch to Colors module')
m = slicer.util.mainWindow()
@@ -154,9 +154,9 @@ def test_ColorLegendSelfTest1(self):
# Test showing color legend only in a single slice node
sliceNameColor = {
- 'Red': [ 1., 0., 0. ],
- 'Green': [ 0., 1., 0. ],
- 'Yellow': [ 1., 1., 0.]
+ 'Red': [1., 0., 0.],
+ 'Green': [0., 1., 0.],
+ 'Yellow': [1., 1., 0.]
}
for sliceName, titleColor in sliceNameColor.items():
self.delayDisplay('Test color legend on the ' + sliceName + ' slice view', self.delayMs)
@@ -164,7 +164,7 @@ def test_ColorLegendSelfTest1(self):
colorLegend.SetViewNodeIDs([sliceNode.GetID()])
colorLegend.SetTitleText(sliceName)
colorLegend.GetTitleTextProperty().SetColor(titleColor)
- self.delayDisplay('Test color legend on the ' + sliceName + ' slice view finished!',self.delayMs*2)
+ self.delayDisplay('Test color legend on the ' + sliceName + ' slice view finished!', self.delayMs * 2)
colorLegend.SetVisibility(False)
diff --git a/Modules/Loadable/Colors/Testing/Python/CustomColorTableSceneViewRestoreTestBug3992.py b/Modules/Loadable/Colors/Testing/Python/CustomColorTableSceneViewRestoreTestBug3992.py
index aeadf19e74e..0a3e971bb18 100644
--- a/Modules/Loadable/Colors/Testing/Python/CustomColorTableSceneViewRestoreTestBug3992.py
+++ b/Modules/Loadable/Colors/Testing/Python/CustomColorTableSceneViewRestoreTestBug3992.py
@@ -12,7 +12,7 @@
colorNode.NamesInitialisedOff()
colorNode.SetNumberOfColors(3)
if colorNode.GetLookupTable() is not None:
- colorNode.GetLookupTable().SetTableRange(0,2)
+ colorNode.GetLookupTable().SetTableRange(0, 2)
colorNode.SetColor(0, 'zero', 0.0, 0.0, 0.0, 0.0)
colorNode.SetColor(1, 'one', 1.0, 1.0, 1.0, 1.0)
@@ -32,9 +32,9 @@
slicer.mrmlScene.AddNode(colorStorageNode)
colorNode.SetAndObserveStorageNodeID(colorStorageNode.GetID())
-startCol2 = [0.,0.,0.,0.]
+startCol2 = [0., 0., 0., 0.]
colorNode.GetColor(2, startCol2)
-print("Starting color 2 =\n\t",startCol2)
+print("Starting color 2 =\n\t", startCol2)
sv = slicer.mrmlScene.AddNode(slicer.vtkMRMLSceneViewNode())
sv.SetName('Scene View Custom Color Test')
@@ -43,16 +43,16 @@
mainSceneCol2 = [0.3, 0.3, 0.3, 1.0]
colorNode.SetColor(2, mainSceneCol2[0], mainSceneCol2[1], mainSceneCol2[2], mainSceneCol2[3])
colorNode.GetColor(2, mainSceneCol2)
-print('After saving the scene view, set the main scene color 2 to\n\t',mainSceneCol2)
+print('After saving the scene view, set the main scene color 2 to\n\t', mainSceneCol2)
url = slicer.app.temporaryPath + "/customColorTableSceneViewRestore.mrml"
slicer.mrmlScene.SetURL(url)
slicer.mrmlScene.Commit()
-print("Saved to ",url)
+print("Saved to ", url)
# make sure it writes the color table
writeFlag = colorStorageNode.WriteData(colorNode)
if writeFlag == 0:
- print("Error writing out file ",colorStorageNode.GetFileName())
+ print("Error writing out file ", colorStorageNode.GetFileName())
# clear out the scene and re-read from disk
@@ -65,14 +65,14 @@
afterReadSceneCol2 = [0., 0., 0., 0.]
readColorNode.GetColor(2, afterReadSceneCol2)
-print('After reading in the scene again, have color 2 =\n\t',afterReadSceneCol2)
+print('After reading in the scene again, have color 2 =\n\t', afterReadSceneCol2)
readSceneView = slicer.util.getFirstNodeByName('Scene View Custom Color Test')
# Current implementation is a hack to not delete the whole color table on restore, but it also won't restore the color value to the original as it's bypassing the copy since the color table in the scene view is empty.
readSceneView.RestoreScene()
-colorNodeAfterRestore = slicer.util.getFirstNodeByName('CustomTest')
+colorNodeAfterRestore = slicer.util.getFirstNodeByName('CustomTest')
# mrmlScene.GetNodeByID("vtkMRMLColorTableNode1")
if colorNodeAfterRestore is None:
diff --git a/Modules/Loadable/CropVolume/Testing/Python/CropVolumeSelfTest.py b/Modules/Loadable/CropVolume/Testing/Python/CropVolumeSelfTest.py
index f741eaf3b1e..f10798f66bc 100644
--- a/Modules/Loadable/CropVolume/Testing/Python/CropVolumeSelfTest.py
+++ b/Modules/Loadable/CropVolume/Testing/Python/CropVolumeSelfTest.py
@@ -9,15 +9,15 @@
class CropVolumeSelfTest(ScriptedLoadableModule):
def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
- parent.title = "CropVolumeSelfTest" # TODO make this more human readable by adding spaces
+ parent.title = "CropVolumeSelfTest" # TODO make this more human readable by adding spaces
parent.categories = ["Testing.TestCases"]
parent.dependencies = []
- parent.contributors = ["Andrey Fedorov (BWH)"] # replace with "Firstname Lastname (Org)"
+ parent.contributors = ["Andrey Fedorov (BWH)"] # replace with "Firstname Lastname (Org)"
parent.helpText = """
This module was developed as a self test to perform the operations needed for crop volume.
"""
parent.acknowledgementText = """
-""" # replace with organization, grant and thanks.
+""" # replace with organization, grant and thanks.
#
diff --git a/Modules/Loadable/Markups/Testing/Python/AddManyMarkupsFiducialTest.py b/Modules/Loadable/Markups/Testing/Python/AddManyMarkupsFiducialTest.py
index 21712d1e9e2..ebb57f1d1af 100644
--- a/Modules/Loadable/Markups/Testing/Python/AddManyMarkupsFiducialTest.py
+++ b/Modules/Loadable/Markups/Testing/Python/AddManyMarkupsFiducialTest.py
@@ -24,7 +24,7 @@ def __init__(self, parent):
"""
parent.acknowledgementText = """
This file was originally developed by Nicole Aucoin, BWH and was partially funded by NIH grant 3P41RR013218-12S1.
-""" # replace with organization, grant and thanks.
+""" # replace with organization, grant and thanks.
#
@@ -136,7 +136,7 @@ def onApplyButton(self):
labelsHiddenFlag = self.labelsHiddenFlagCheckBox.checked
locked = self.lockedFlagCheckBox.checked
print(f"Run the logic method to add {numberOfNodes} nodes with {numberOfControlPoints} control points each")
- logic.run(nodeType, numberOfNodes, numberOfControlPoints,0, fewerModifyFlag, locked, labelsHiddenFlag)
+ logic.run(nodeType, numberOfNodes, numberOfControlPoints, 0, fewerModifyFlag, locked, labelsHiddenFlag)
#
@@ -145,7 +145,7 @@ def onApplyButton(self):
class AddManyMarkupsFiducialTestLogic(ScriptedLoadableModuleLogic):
- def run(self, nodeType, numberOfNodes = 10, numberOfControlPoints=10, rOffset=0,usefewerModifyCalls=False,locked=False, labelsHidden=False):
+ def run(self, nodeType, numberOfNodes=10, numberOfControlPoints=10, rOffset=0, usefewerModifyCalls=False, locked=False, labelsHidden=False):
"""
Run the actual algorithm
"""
@@ -188,13 +188,13 @@ def run(self, nodeType, numberOfNodes = 10, numberOfControlPoints=10, rOffset=0,
for controlPointIndex in range(numberOfControlPoints):
# print "controlPointIndex = ", controlPointIndex, "/", numberOfControlPoints, ", r = ", r, ", a = ", a, ", s = ", s
t1 = time.process_time()
- markupsNode.AddControlPoint(vtk.vtkVector3d(r,a,s))
+ markupsNode.AddControlPoint(vtk.vtkVector3d(r, a, s))
t2 = time.process_time()
timeToAddThisFid = t2 - t1
dt = timeToAddThisFid - timeToAddLastFid
- #print '%(index)04d\t' % {'index': controlPointIndex}, timeToAddThisFid, "\t", dt
- r = float(controlPointIndex)/numberOfControlPoints * 100.0 - 50.0 + random.uniform(-20.0, 20.0)
- a = float(controlPointIndex)/numberOfControlPoints * 100.0 - 50.0 + random.uniform(-20.0, 20.0)
+ # print '%(index)04d\t' % {'index': controlPointIndex}, timeToAddThisFid, "\t", dt
+ r = float(controlPointIndex) / numberOfControlPoints * 100.0 - 50.0 + random.uniform(-20.0, 20.0)
+ a = float(controlPointIndex) / numberOfControlPoints * 100.0 - 50.0 + random.uniform(-20.0, 20.0)
s = random.uniform(-20.0, 20.0)
timeToAddLastFid = timeToAddThisFid
@@ -207,7 +207,7 @@ def run(self, nodeType, numberOfNodes = 10, numberOfControlPoints=10, rOffset=0,
testEndTime = time.process_time()
testTime = testEndTime - testStartTime
- print("Total time to add ",numberOfControlPoints," = ", testTime)
+ print("Total time to add ", numberOfControlPoints, " = ", testTime)
return True
@@ -239,10 +239,10 @@ def test_AddManyMarkupsFiducialTest1(self):
m.moduleSelector().selectModule('Welcome')
logic = AddManyMarkupsFiducialTestLogic()
- logic.run('vtkMRMLMarkupsFiducialNode', numberOfNodes = 1, numberOfControlPoints=100, rOffset=0)
+ logic.run('vtkMRMLMarkupsFiducialNode', numberOfNodes=1, numberOfControlPoints=100, rOffset=0)
self.delayDisplay("Now running it while the Markups Module is open")
m.moduleSelector().selectModule('Markups')
- logic.run('vtkMRMLMarkupsFiducialNode', numberOfNodes = 1, numberOfControlPoints=100, rOffset=100)
+ logic.run('vtkMRMLMarkupsFiducialNode', numberOfNodes=1, numberOfControlPoints=100, rOffset=100)
self.delayDisplay('Test passed!')
diff --git a/Modules/Loadable/Markups/Testing/Python/MarkupsCurveCoordinateFrameTest.py b/Modules/Loadable/Markups/Testing/Python/MarkupsCurveCoordinateFrameTest.py
index d861efcea76..303a98d14c7 100644
--- a/Modules/Loadable/Markups/Testing/Python/MarkupsCurveCoordinateFrameTest.py
+++ b/Modules/Loadable/Markups/Testing/Python/MarkupsCurveCoordinateFrameTest.py
@@ -35,13 +35,13 @@ def createCoordinateSystemsModel(curve, axisLength=5):
# Create coordinate system polydata
axisAppender = vtk.vtkAppendPolyData()
xAxis = vtk.vtkLineSource()
- xAxis.SetPoint1(0,0,0)
+ xAxis.SetPoint1(0, 0, 0)
xAxis.SetPoint2(axisLength * 2, 0, 0)
yAxis = vtk.vtkLineSource()
- yAxis.SetPoint1(0,0,0)
+ yAxis.SetPoint1(0, 0, 0)
yAxis.SetPoint2(0, axisLength, 0)
zAxis = vtk.vtkLineSource()
- zAxis.SetPoint1(0,0,0)
+ zAxis.SetPoint1(0, 0, 0)
zAxis.SetPoint2(0, 0, axisLength)
axisAppender.AddInputConnection(xAxis.GetOutputPort())
axisAppender.AddInputConnection(yAxis.GetOutputPort())
@@ -54,7 +54,7 @@ def createCoordinateSystemsModel(curve, axisLength=5):
transformer.SetInputConnection(axisAppender.GetOutputPort())
# Create model appender that assembles the model that contains all the coordinate systems
coordinateSystemAppender = vtk.vtkAppendPolyData()
- #model = slicer.modules.models.logic().AddModel(coordinateSystemAppender.GetOutputPort())
+ # model = slicer.modules.models.logic().AddModel(coordinateSystemAppender.GetOutputPort())
model = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLModelNode')
model.CreateDefaultDisplayNodes()
# prevent picking by markups so that the control points can be moved without sticking to the generated model
@@ -111,12 +111,12 @@ def removeCoordinateSystemUpdaters(curveObservations):
if not planarCurveNode.GetCurvePointToWorldTransformAtPointIndex(6, curvePointToWorldTransform):
raise Exception("Test1 GetCurvePointToWorldTransformAtPointIndex failed")
-curvePointToWorldMatrix= slicer.util.arrayFromVTKMatrix(curvePointToWorldTransform)
+curvePointToWorldMatrix = slicer.util.arrayFromVTKMatrix(curvePointToWorldTransform)
expectedCurvePointToWorldMatrix = np.array(
- [[ 2.15191499e-01, 0.00000000e+00, -9.76571871e-01, -3.03394470e+01],
- [ 0.00000000e+00, -1.00000000e+00, 0.00000000e+00, 3.63797881e-09],
- [-9.76571871e-01, 0.00000000e+00, -2.15191499e-01, 8.10291061e+01],
- [ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 1.00000000e+00]])
+ [[2.15191499e-01, 0.00000000e+00, -9.76571871e-01, -3.03394470e+01],
+ [0.00000000e+00, -1.00000000e+00, 0.00000000e+00, 3.63797881e-09],
+ [-9.76571871e-01, 0.00000000e+00, -2.15191499e-01, 8.10291061e+01],
+ [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 1.00000000e+00]])
if not np.isclose(curvePointToWorldMatrix, expectedCurvePointToWorldMatrix).all():
raise Exception(f"Test1 CurvePointToWorldTransformAtPointIndex value incorrect: got {curvePointToWorldMatrix}, expected {expectedCurvePointToWorldMatrix}.")
@@ -141,12 +141,12 @@ def removeCoordinateSystemUpdaters(curveObservations):
if not closedCurveNode.GetCurvePointToWorldTransformAtPointIndex(6, curvePointToWorldTransform):
raise Exception("Test2 GetCurvePointToWorldTransformAtPointIndex failed")
-curvePointToWorldMatrix= slicer.util.arrayFromVTKMatrix(curvePointToWorldTransform)
+curvePointToWorldMatrix = slicer.util.arrayFromVTKMatrix(curvePointToWorldTransform)
expectedCurvePointToWorldMatrix = np.array(
- [[-3.85813409e-01, 0.00000000e+00, -9.22576833e-01, -3.71780586e+01],
- [ 0.00000000e+00, 1.00000000e+00, 0.00000000e+00, 3.63797881e-09],
- [ 9.22576833e-01, 0.00000000e+00, -3.85813409e-01, 8.78303909e+01],
- [ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 1.00000000e+00]])
+ [[-3.85813409e-01, 0.00000000e+00, -9.22576833e-01, -3.71780586e+01],
+ [0.00000000e+00, 1.00000000e+00, 0.00000000e+00, 3.63797881e-09],
+ [9.22576833e-01, 0.00000000e+00, -3.85813409e-01, 8.78303909e+01],
+ [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 1.00000000e+00]])
if not np.isclose(curvePointToWorldMatrix, expectedCurvePointToWorldMatrix).all():
raise Exception(f"Test2 CurvePointToWorldTransformAtPointIndex value incorrect: got {curvePointToWorldMatrix}, expected {expectedCurvePointToWorldMatrix}.")
@@ -196,12 +196,12 @@ def removeCoordinateSystemUpdaters(curveObservations):
if not centerlineCurve.GetCurvePointToWorldTransformAtPointIndex(6, curvePointToWorldTransform):
raise Exception("Test3 GetCurvePointToWorldTransformAtPointIndex failed")
-curvePointToWorldMatrix= slicer.util.arrayFromVTKMatrix(curvePointToWorldTransform)
+curvePointToWorldMatrix = slicer.util.arrayFromVTKMatrix(curvePointToWorldTransform)
expectedCurvePointToWorldMatrix = np.array(
- [[ 9.85648052e-01, 8.80625424e-03, -1.68583415e-01, -3.08991909e+00],
- [-6.35257659e-02, 9.44581803e-01, -3.22070946e-01, 2.22146526e-01],
- [ 1.56404587e-01, 3.28157991e-01, 9.31584638e-01, -7.34501495e+01],
- [ 0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 1.00000000e+00]])
+ [[9.85648052e-01, 8.80625424e-03, -1.68583415e-01, -3.08991909e+00],
+ [-6.35257659e-02, 9.44581803e-01, -3.22070946e-01, 2.22146526e-01],
+ [1.56404587e-01, 3.28157991e-01, 9.31584638e-01, -7.34501495e+01],
+ [0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 1.00000000e+00]])
if not np.isclose(curvePointToWorldMatrix, expectedCurvePointToWorldMatrix).all():
raise Exception(f"Test3 CurvePointToWorldTransformAtPointIndex value incorrect: got {curvePointToWorldMatrix}, expected {expectedCurvePointToWorldMatrix}.")
@@ -215,7 +215,7 @@ def removeCoordinateSystemUpdaters(curveObservations):
import math
circleCurveNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLMarkupsClosedCurveNode")
for controlPointIndex in range(numberOfControlPoints):
- angle = 2.0*math.pi * controlPointIndex/numberOfControlPoints
+ angle = 2.0 * math.pi * controlPointIndex / numberOfControlPoints
pointIndex = circleCurveNode.AddControlPoint(vtk.vtkVector3d(radius * math.sin(angle), radius * math.cos(angle), 0.0))
# Visualize
@@ -228,12 +228,12 @@ def removeCoordinateSystemUpdaters(curveObservations):
if not circleCurveNode.GetCurvePointToWorldTransformAtPointIndex(6, curvePointToWorldTransform):
raise Exception("Test4. GetCurvePointToWorldTransformAtPointIndex failed")
-curvePointToWorldMatrix= slicer.util.arrayFromVTKMatrix(curvePointToWorldTransform)
+curvePointToWorldMatrix = slicer.util.arrayFromVTKMatrix(curvePointToWorldTransform)
expectedCurvePointToWorldMatrix = np.array(
- [[ 0.10190135, 0. , 0.99479451, 3.29378772],
- [ 0.99479451, 0. , -0.10190135, 34.84461594],
- [ 0. , 1. , 0. , 0. ],
- [ 0. , 0. , 0. , 1. ]])
+ [[0.10190135, 0., 0.99479451, 3.29378772],
+ [0.99479451, 0., -0.10190135, 34.84461594],
+ [0., 1., 0., 0.],
+ [0., 0., 0., 1.]])
if not np.isclose(curvePointToWorldMatrix, expectedCurvePointToWorldMatrix).all():
raise Exception(f"Test4. CurvePointToWorldTransformAtPointIndex value incorrect: got {curvePointToWorldMatrix}, expected {expectedCurvePointToWorldMatrix}.")
diff --git a/Modules/Loadable/Markups/Testing/Python/MarkupsCurveMeasurementsTest.py b/Modules/Loadable/Markups/Testing/Python/MarkupsCurveMeasurementsTest.py
index 1cd5e1110f9..f2f8640c172 100644
--- a/Modules/Loadable/Markups/Testing/Python/MarkupsCurveMeasurementsTest.py
+++ b/Modules/Loadable/Markups/Testing/Python/MarkupsCurveMeasurementsTest.py
@@ -43,8 +43,8 @@
raise Exception(exceptionMessage)
curvatureArray = curvePointData.GetArray(1)
-if curvatureArray.GetMaxId() != curvePointData.GetNumberOfTuples()-1:
- exceptionMessage = "Unexpected number of values in curvature data array: %d (expected %d)" % (curvatureArray.GetMaxId(), curvePointData.GetNumberOfTuples()-1)
+if curvatureArray.GetMaxId() != curvePointData.GetNumberOfTuples() - 1:
+ exceptionMessage = "Unexpected number of values in curvature data array: %d (expected %d)" % (curvatureArray.GetMaxId(), curvePointData.GetNumberOfTuples() - 1)
raise Exception(exceptionMessage)
if abs(curvatureArray.GetRange()[0] - 0.0) > 0.0001:
@@ -84,8 +84,8 @@
raise Exception(exceptionMessage)
curvatureArray = curvePointData.GetArray(1)
-if curvatureArray.GetMaxId() != curvePointData.GetNumberOfTuples()-1:
- exceptionMessage = "Unexpected number of values in curvature data array: %d (expected %d)" % (curvatureArray.GetMaxId(), curvePointData.GetNumberOfTuples()-1)
+if curvatureArray.GetMaxId() != curvePointData.GetNumberOfTuples() - 1:
+ exceptionMessage = "Unexpected number of values in curvature data array: %d (expected %d)" % (curvatureArray.GetMaxId(), curvePointData.GetNumberOfTuples() - 1)
raise Exception(exceptionMessage)
if abs(curvatureArray.GetRange()[0] - 0.0) > 0.0001:
@@ -180,7 +180,7 @@
import math
closedCurveNode = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLMarkupsClosedCurveNode")
for controlPointIndex in range(numberOfControlPoints):
- angle = 2.0*math.pi * controlPointIndex/numberOfControlPoints
+ angle = 2.0 * math.pi * controlPointIndex / numberOfControlPoints
closedCurveNode.AddControlPoint(vtk.vtkVector3d(radius * math.sin(angle), radius * math.cos(angle), 0.0))
# Turn on curvature calculation in curve node
@@ -191,19 +191,19 @@
exceptionMessage = "Many values are expected in the curvature array, instead found just %d" % curvatureArray.GetNumberOfValues()
raise Exception(exceptionMessage)
-if abs(curvatureArray.GetRange()[0] - 1/radius) > 1e-4:
+if abs(curvatureArray.GetRange()[0] - 1 / radius) > 1e-4:
exceptionMessage = "Unexpected minimum in curvature data array: " + str(curvatureArray.GetRange()[0])
raise Exception(exceptionMessage)
-if abs(curvatureArray.GetRange()[1] - 1/radius) > 1e-4:
+if abs(curvatureArray.GetRange()[1] - 1 / radius) > 1e-4:
exceptionMessage = "Unexpected maximum in curvature data array: " + str(curvatureArray.GetRange()[1])
raise Exception(exceptionMessage)
-if abs(curvatureArray.GetRange()[1] - 1/radius) > 1e-4:
+if abs(curvatureArray.GetRange()[1] - 1 / radius) > 1e-4:
exceptionMessage = "Unexpected maximum in curvature data array: " + str(curvatureArray.GetRange()[1])
raise Exception(exceptionMessage)
-if abs(closedCurveNode.GetMeasurement("curvature mean").GetValue() - 1/radius) > 1e-4:
+if abs(closedCurveNode.GetMeasurement("curvature mean").GetValue() - 1 / radius) > 1e-4:
exceptionMessage = "Unexpected curvature mean value: " + str(closedCurveNode.GetMeasurement("curvature mean").GetValue())
raise Exception(exceptionMessage)
-if abs(closedCurveNode.GetMeasurement("curvature max").GetValue() - 1/radius) > 1e-4:
+if abs(closedCurveNode.GetMeasurement("curvature max").GetValue() - 1 / radius) > 1e-4:
exceptionMessage = "Unexpected curvature max value: " + str(closedCurveNode.GetMeasurement("curvature max").GetValue())
raise Exception(exceptionMessage)
diff --git a/Modules/Loadable/Markups/Testing/Python/MarkupsInCompareViewersSelfTest.py b/Modules/Loadable/Markups/Testing/Python/MarkupsInCompareViewersSelfTest.py
index bcdee8bf05a..29dbe8204bb 100644
--- a/Modules/Loadable/Markups/Testing/Python/MarkupsInCompareViewersSelfTest.py
+++ b/Modules/Loadable/Markups/Testing/Python/MarkupsInCompareViewersSelfTest.py
@@ -163,7 +163,7 @@ def run(self):
compareLogic1.SetSliceOffset(offset)
compareLogic1.EndSliceOffsetInteraction()
msg = "Scrolled to " + str(offset)
- slicer.util.delayDisplay(msg,250)
+ slicer.util.delayDisplay(msg, 250)
offset += 1.0
# switch back to conventional
diff --git a/Modules/Loadable/Markups/Testing/Python/MarkupsInViewsSelfTest.py b/Modules/Loadable/Markups/Testing/Python/MarkupsInViewsSelfTest.py
index 9e1c2f25141..c47984fade6 100644
--- a/Modules/Loadable/Markups/Testing/Python/MarkupsInViewsSelfTest.py
+++ b/Modules/Loadable/Markups/Testing/Python/MarkupsInViewsSelfTest.py
@@ -115,9 +115,9 @@ def controlPointVisibleSlice(self, fidNode, sliceNodeID, controlPointIndex):
def printViewNodeIDs(self, displayNode):
numIDs = displayNode.GetNumberOfViewNodeIDs()
if numIDs == 0:
- print('No view node ids for display node',displayNode.GetID())
+ print('No view node ids for display node', displayNode.GetID())
return
- print('View node ids for display node',displayNode.GetID())
+ print('View node ids for display node', displayNode.GetID())
for i in range(numIDs):
id = displayNode.GetNthViewNodeID(i)
print(id)
@@ -127,13 +127,13 @@ def printViewAndSliceNodes(self):
print('Number of view nodes = ', numViewNodes)
for vn in range(numViewNodes):
viewNode = slicer.mrmlScene.GetNthNodeByClass(vn, 'vtkMRMLViewNode')
- print('\t',viewNode.GetName(),"id =",viewNode.GetID())
+ print('\t', viewNode.GetName(), "id =", viewNode.GetID())
numSliceNodes = slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLSliceNode')
print('Number of slice nodes = ', numSliceNodes)
for sn in range(numSliceNodes):
sliceNode = slicer.mrmlScene.GetNthNodeByClass(sn, 'vtkMRMLSliceNode')
- print('\t',sliceNode.GetName(),"id =",sliceNode.GetID())
+ print('\t', sliceNode.GetName(), "id =", sliceNode.GetID())
def onRecordNodeEvent(self, caller, event, eventId):
self.nodeEvents.append(eventId)
@@ -186,7 +186,7 @@ def run(self):
self.nodeEvents = []
observedEvents = [
slicer.vtkMRMLMarkupsNode.PointPositionDefinedEvent,
- slicer.vtkMRMLMarkupsNode.PointPositionUndefinedEvent ]
+ slicer.vtkMRMLMarkupsNode.PointPositionUndefinedEvent]
for eventId in observedEvents:
fidNodeObserverTags.append(fidNode.AddObserver(eventId, lambda caller, event, eventId=eventId: self.onRecordNodeEvent(caller, event, eventId)))
@@ -290,7 +290,7 @@ def run(self):
# show only in red
displayNode.AddViewNodeID('vtkMRMLSliceNodeRed')
slicer.util.delayDisplay("Show only in red slice")
- if not self.controlPointVisibleSlice(fidNode,'vtkMRMLSliceNodeRed', controlPointIndex):
+ if not self.controlPointVisibleSlice(fidNode, 'vtkMRMLSliceNodeRed', controlPointIndex):
slicer.util.delayDisplay("Test failed: widget not displayed on red slice")
# self.printViewNodeIDs(displayNode)
return False
@@ -303,11 +303,11 @@ def run(self):
# self.printViewNodeIDs(displayNode)
displayNode.AddViewNodeID('vtkMRMLSliceNodeGreen')
slicer.util.delayDisplay('Show only in green slice')
- if (self.controlPointVisibleSlice(fidNode,'vtkMRMLSliceNodeRed', controlPointIndex)
- or not self.controlPointVisibleSlice(fidNode,'vtkMRMLSliceNodeGreen', controlPointIndex)):
+ if (self.controlPointVisibleSlice(fidNode, 'vtkMRMLSliceNodeRed', controlPointIndex)
+ or not self.controlPointVisibleSlice(fidNode, 'vtkMRMLSliceNodeGreen', controlPointIndex)):
slicer.util.delayDisplay("Test failed: widget not displayed only on green slice")
- print('\tred = ',self.controlPointVisibleSlice(fidNode,'vtkMRMLSliceNodeRed', controlPointIndex))
- print('\tgreen =',self.controlPointVisibleSlice(fidNode,'vtkMRMLSliceNodeGreen', controlPointIndex))
+ print('\tred = ', self.controlPointVisibleSlice(fidNode, 'vtkMRMLSliceNodeRed', controlPointIndex))
+ print('\tgreen =', self.controlPointVisibleSlice(fidNode, 'vtkMRMLSliceNodeGreen', controlPointIndex))
self.printViewNodeIDs(displayNode)
return False
diff --git a/Modules/Loadable/Markups/Testing/Python/MarkupsMeasurementsTest.py b/Modules/Loadable/Markups/Testing/Python/MarkupsMeasurementsTest.py
index f870770a10e..b8729769676 100644
--- a/Modules/Loadable/Markups/Testing/Python/MarkupsMeasurementsTest.py
+++ b/Modules/Loadable/Markups/Testing/Python/MarkupsMeasurementsTest.py
@@ -27,7 +27,7 @@
length = 34.12
direction = np.array([0.3, -0.4, 0.8])
pos1 = np.array([20, -12.4, 3.8])
-pos2 = pos1 + direction/np.linalg.norm(direction) * length
+pos2 = pos1 + direction / np.linalg.norm(direction) * length
markupsNode.AddControlPoint(vtk.vtkVector3d(pos1))
markupsNode.AddControlPoint(vtk.vtkVector3d(pos2))
@@ -38,7 +38,7 @@
if measurement.GetValueWithUnitsAsPrintableString() != '34.12mm':
raise Exception("Unexpected length measurement result: " + measurement.GetValueWithUnitsAsPrintableString())
-markupsFilename = markupsMeasurementsTestDir+'/line.mkp.json'
+markupsFilename = markupsMeasurementsTestDir + '/line.mkp.json'
slicer.util.saveNode(markupsNode, markupsFilename)
with open(markupsFilename) as f:
@@ -67,7 +67,7 @@
if measurement.GetValueWithUnitsAsPrintableString() != '117.4deg':
raise Exception("Unexpected angle measurement result: " + measurement.GetValueWithUnitsAsPrintableString())
-markupsFilename = markupsMeasurementsTestDir+'/angle.mkp.json'
+markupsFilename = markupsMeasurementsTestDir + '/angle.mkp.json'
slicer.util.saveNode(markupsNode, markupsFilename)
with open(markupsFilename) as f:
@@ -105,7 +105,7 @@
if measurement.GetValueWithUnitsAsPrintableString() != '32.00cm2':
raise Exception("Unexpected area measurement result: " + measurement.GetValueWithUnitsAsPrintableString())
-markupsFilename = markupsMeasurementsTestDir+'/plane.mkp.json'
+markupsFilename = markupsMeasurementsTestDir + '/plane.mkp.json'
slicer.util.saveNode(markupsNode, markupsFilename)
with open(markupsFilename) as f:
@@ -124,14 +124,14 @@
markupsNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLMarkupsROINode')
markupsNode.AddControlPoint(vtk.vtkVector3d(61, -12.4, 13.8))
-markupsNode.SetSize(20,30,40)
+markupsNode.SetSize(20, 30, 40)
measurement = markupsNode.GetMeasurement("volume")
measurement.SetEnabled(True)
if measurement.GetValueWithUnitsAsPrintableString() != '24.000cm3':
raise Exception("Unexpected volume measurement result: " + measurement.GetValueWithUnitsAsPrintableString())
-markupsFilename = markupsMeasurementsTestDir+'/roi.mkp.json'
+markupsFilename = markupsMeasurementsTestDir + '/roi.mkp.json'
slicer.util.saveNode(markupsNode, markupsFilename)
with open(markupsFilename) as f:
diff --git a/Modules/Loadable/Markups/Testing/Python/MarkupsSceneViewRestoreTestManyLists.py b/Modules/Loadable/Markups/Testing/Python/MarkupsSceneViewRestoreTestManyLists.py
index 5d410e2f959..23977fa9f6f 100644
--- a/Modules/Loadable/Markups/Testing/Python/MarkupsSceneViewRestoreTestManyLists.py
+++ b/Modules/Loadable/Markups/Testing/Python/MarkupsSceneViewRestoreTestManyLists.py
@@ -71,7 +71,7 @@
td = lm.threeDWidget(0)
mfm = td.threeDView().displayableManagerByClassName("vtkMRMLMarkupsDisplayableManager")
h = mfm.GetHelper()
-print('Helper = ',h)
+print('Helper = ', h)
for markupsNode in [fid1AfterRestore, fid2AfterRestore]:
markupsWidget = h.GetWidget(markupsNode)
@@ -87,9 +87,9 @@
# check positions
for s in range(markupsNode.GetNumberOfControlPoints()):
worldPos = controlPointsPoly.GetPoint(s)
- print("control point ",s," world position = ",worldPos)
- fidPos = [0.0,0.0,0.0]
- markupsNode.GetNthControlPointPosition(s,fidPos)
+ print("control point ", s, " world position = ", worldPos)
+ fidPos = [0.0, 0.0, 0.0]
+ markupsNode.GetNthControlPointPosition(s, fidPos)
xdiff = fidPos[0] - worldPos[0]
ydiff = fidPos[1] - worldPos[1]
zdiff = fidPos[2] - worldPos[2]
diff --git a/Modules/Loadable/Markups/Testing/Python/MarkupsSceneViewRestoreTestSimple.py b/Modules/Loadable/Markups/Testing/Python/MarkupsSceneViewRestoreTestSimple.py
index 57152ca669d..8ef954996d2 100644
--- a/Modules/Loadable/Markups/Testing/Python/MarkupsSceneViewRestoreTestSimple.py
+++ b/Modules/Loadable/Markups/Testing/Python/MarkupsSceneViewRestoreTestSimple.py
@@ -12,25 +12,25 @@
startCoords = [1.0, 2.0, 3.0]
fid.AddControlPoint(startCoords)
-fid.GetNthControlPointPosition(0,startCoords)
+fid.GetNthControlPointPosition(0, startCoords)
print(f"Starting control point coordinates = {startCoords}")
sv = slicer.mrmlScene.AddNode(slicer.vtkMRMLSceneViewNode())
sv.StoreScene()
-afterStoreSceneCoords = [11.1,22.2,33.3]
+afterStoreSceneCoords = [11.1, 22.2, 33.3]
fid.SetNthControlPointPosition(0, afterStoreSceneCoords)
-fid.GetNthControlPointPosition(0,afterStoreSceneCoords)
+fid.GetNthControlPointPosition(0, afterStoreSceneCoords)
print(f"After storing the scene, set control point coords to {afterStoreSceneCoords}")
sv.RestoreScene()
-fidAfterRestore = slicer.mrmlScene.GetNodeByID("vtkMRMLMarkupsFiducialNode1")
+fidAfterRestore = slicer.mrmlScene.GetNodeByID("vtkMRMLMarkupsFiducialNode1")
-coords = [0,0,0]
-fidAfterRestore.GetNthControlPointPosition(0,coords)
+coords = [0, 0, 0]
+fidAfterRestore.GetNthControlPointPosition(0, coords)
print("After restoring the scene, control point coordinates = ", coords)
xdiff = coords[0] - startCoords[0]
diff --git a/Modules/Loadable/Markups/Testing/Python/NeurosurgicalPlanningTutorialMarkupsSelfTest.py b/Modules/Loadable/Markups/Testing/Python/NeurosurgicalPlanningTutorialMarkupsSelfTest.py
index 4d765994dcd..db7ee0ff6e6 100644
--- a/Modules/Loadable/Markups/Testing/Python/NeurosurgicalPlanningTutorialMarkupsSelfTest.py
+++ b/Modules/Loadable/Markups/Testing/Python/NeurosurgicalPlanningTutorialMarkupsSelfTest.py
@@ -168,7 +168,7 @@ def test_NeurosurgicalPlanningTutorialMarkupsSelfTest1(self):
# for the tutorial, do it through the welcome module
slicer.util.selectModule('Welcome')
self.delayDisplay("Screenshot")
- self.takeScreenshot('NeurosurgicalPlanning-Welcome','Welcome module')
+ self.takeScreenshot('NeurosurgicalPlanning-Welcome', 'Welcome module')
else:
# otherwise show the sample data module
slicer.util.selectModule('SampleData')
@@ -178,7 +178,7 @@ def test_NeurosurgicalPlanningTutorialMarkupsSelfTest1(self):
import SampleData
baselineVolume = SampleData.downloadSample('BaselineVolume')
- self.takeScreenshot('NeurosurgicalPlanning-Loaded','Data loaded')
+ self.takeScreenshot('NeurosurgicalPlanning-Loaded', 'Data loaded')
#
# link the viewers
@@ -190,7 +190,7 @@ def test_NeurosurgicalPlanningTutorialMarkupsSelfTest1(self):
popupWidget = sliceController.findChild("ctkPopupWidget")
if popupWidget is not None:
popupWidget.pinPopup(1)
- self.takeScreenshot('NeurosurgicalPlanning-Link','Link slice viewers')
+ self.takeScreenshot('NeurosurgicalPlanning-Link', 'Link slice viewers')
popupWidget.pinPopup(0)
sliceLogic = slicer.app.layoutManager().sliceWidget('Red').sliceLogic()
@@ -205,7 +205,7 @@ def test_NeurosurgicalPlanningTutorialMarkupsSelfTest1(self):
slicer.app.processEvents()
sliceLogic.FitSliceToAll()
sliceLogic.EndSliceCompositeNodeInteraction()
- self.takeScreenshot('NeurosurgicalPlanning-Baseline','Baseline in background')
+ self.takeScreenshot('NeurosurgicalPlanning-Baseline', 'Baseline in background')
#
# adjust window level on baseline
@@ -215,7 +215,7 @@ def test_NeurosurgicalPlanningTutorialMarkupsSelfTest1(self):
baselineDisplay.SetAutoWindowLevel(0)
baselineDisplay.SetWindow(2600)
baselineDisplay.SetLevel(1206)
- self.takeScreenshot('NeurosurgicalPlanning-WindowLevel','Set W/L on baseline')
+ self.takeScreenshot('NeurosurgicalPlanning-WindowLevel', 'Set W/L on baseline')
#
# switch to red slice only
@@ -223,7 +223,7 @@ def test_NeurosurgicalPlanningTutorialMarkupsSelfTest1(self):
lm.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutOneUpRedSliceView)
slicer.app.processEvents()
sliceLogic.FitSliceToAll()
- self.takeScreenshot('NeurosurgicalPlanning-RedSliceOnly','Set layout to Red Slice only')
+ self.takeScreenshot('NeurosurgicalPlanning-RedSliceOnly', 'Set layout to Red Slice only')
#
# segmentation of tumor
@@ -252,7 +252,7 @@ def test_NeurosurgicalPlanningTutorialMarkupsSelfTest1(self):
# Make segmentation results visible in 3D
segmentationNode.CreateClosedSurfaceRepresentation()
- self.takeScreenshot('NeurosurgicalPlanning-Editor','Showing Editor Module')
+ self.takeScreenshot('NeurosurgicalPlanning-Editor', 'Showing Editor Module')
# set the slice offset so drawing is right
sliceNode = sliceLogic.GetSliceNode()
@@ -267,7 +267,7 @@ def test_NeurosurgicalPlanningTutorialMarkupsSelfTest1(self):
paintEffect.setParameter("BrushDiameterIsRelative", 0)
paintEffect.setParameter("BrushAbsoluteDiameter", 4.0)
- self.takeScreenshot('NeurosurgicalPlanning-Paint','Paint tool in Editor Module')
+ self.takeScreenshot('NeurosurgicalPlanning-Paint', 'Paint tool in Editor Module')
#
# paint in cystic part of tumor, using conversion from RAS coords to
@@ -288,14 +288,14 @@ def test_NeurosurgicalPlanningTutorialMarkupsSelfTest1(self):
slicer.util.clickAndDrag(sliceWidget, start=logic.rasToDisplay(*currentCoords), end=logic.rasToDisplay(*clickCoords), steps=10)
currentCoords = clickCoords
- self.takeScreenshot('NeurosurgicalPlanning-PaintCystic','Paint cystic part of tumor')
+ self.takeScreenshot('NeurosurgicalPlanning-PaintCystic', 'Paint cystic part of tumor')
#
# paint in solid part of tumor
#
segmentEditorNode.SetSelectedSegmentID(region2SegmentId)
slicer.util.clickAndDrag(sliceWidget, start=logic.rasToDisplay(-0.5, 118.5, sliceOffset), end=logic.rasToDisplay(-7.4, 116, sliceOffset), steps=10)
- self.takeScreenshot('NeurosurgicalPlanning-PaintSolid','Paint solid part of tumor')
+ self.takeScreenshot('NeurosurgicalPlanning-PaintSolid', 'Paint solid part of tumor')
#
# paint around the tumor
@@ -303,8 +303,8 @@ def test_NeurosurgicalPlanningTutorialMarkupsSelfTest1(self):
segmentEditorNode.SetSelectedSegmentID(backgroundSegmentId)
clickCoordsList = [
[-40, 50, sliceOffset],
- [ 30, 50, sliceOffset],
- [ 30, 145, sliceOffset],
+ [30, 50, sliceOffset],
+ [30, 145, sliceOffset],
[-40, 145, sliceOffset],
[-40, 50, sliceOffset]]
sliceWidget = lm.sliceWidget('Red')
@@ -313,7 +313,7 @@ def test_NeurosurgicalPlanningTutorialMarkupsSelfTest1(self):
if currentCoords:
slicer.util.clickAndDrag(sliceWidget, start=logic.rasToDisplay(*currentCoords), end=logic.rasToDisplay(*clickCoords), steps=30)
currentCoords = clickCoords
- self.takeScreenshot('NeurosurgicalPlanning-PaintAround','Paint around tumor')
+ self.takeScreenshot('NeurosurgicalPlanning-PaintAround', 'Paint around tumor')
#
# Grow cut
@@ -322,15 +322,15 @@ def test_NeurosurgicalPlanningTutorialMarkupsSelfTest1(self):
effect = segmentEditorWidget.activeEffect()
effect.self().onPreview()
effect.self().onApply()
- self.takeScreenshot('NeurosurgicalPlanning-Growcut','Growcut')
+ self.takeScreenshot('NeurosurgicalPlanning-Growcut', 'Growcut')
- #segmentationNode.RemoveSegment(backgroundSegmentId)
+ # segmentationNode.RemoveSegment(backgroundSegmentId)
#
# go to the data module
#
slicer.util.selectModule('Data')
- self.takeScreenshot('NeurosurgicalPlanning-GrowCutData','GrowCut segmentation results in Data')
+ self.takeScreenshot('NeurosurgicalPlanning-GrowCutData', 'GrowCut segmentation results in Data')
#
# Ventricles Segmentation
@@ -344,25 +344,25 @@ def test_NeurosurgicalPlanningTutorialMarkupsSelfTest1(self):
# Thresholding
segmentEditorWidget.setActiveEffectByName("Threshold")
effect = segmentEditorWidget.activeEffect()
- effect.setParameter("MinimumThreshold","1700")
- #effect.setParameter("MaximumThreshold","695")
+ effect.setParameter("MinimumThreshold", "1700")
+ # effect.setParameter("MaximumThreshold","695")
effect.self().onApply()
- self.takeScreenshot('NeurosurgicalPlanning-Ventricles','Ventricles segmentation')
+ self.takeScreenshot('NeurosurgicalPlanning-Ventricles', 'Ventricles segmentation')
#
# Save Islands
#
segmentEditorWidget.setActiveEffectByName("Islands")
effect = segmentEditorWidget.activeEffect()
- effect.setParameter("Operation","KEEP_SELECTED_ISLAND")
+ effect.setParameter("Operation", "KEEP_SELECTED_ISLAND")
slicer.util.clickAndDrag(sliceWidget, start=logic.rasToDisplay(25.3, 5.8, sliceOffset), end=logic.rasToDisplay(25.3, 5.8, sliceOffset), steps=1)
- self.takeScreenshot('NeurosurgicalPlanning-SaveIsland','Ventricles save island')
+ self.takeScreenshot('NeurosurgicalPlanning-SaveIsland', 'Ventricles save island')
#
# switch to conventional layout
#
lm.setLayout(slicer.vtkMRMLLayoutNode.SlicerLayoutConventionalView)
- self.takeScreenshot('NeurosurgicalPlanning-MergeAndBuild','Merged and built models')
+ self.takeScreenshot('NeurosurgicalPlanning-MergeAndBuild', 'Merged and built models')
#
# Smoothing
@@ -373,7 +373,7 @@ def test_NeurosurgicalPlanningTutorialMarkupsSelfTest1(self):
effect.setParameter("SmoothingMethod", "MEDIAN")
effect.setParameter("KernelSizeMm", 5)
effect.self().onApply()
- self.takeScreenshot('NeurosurgicalPlanning-Smoothed','Smoothed cystic region')
+ self.takeScreenshot('NeurosurgicalPlanning-Smoothed', 'Smoothed cystic region')
#
# Dilation
@@ -383,6 +383,6 @@ def test_NeurosurgicalPlanningTutorialMarkupsSelfTest1(self):
effect = segmentEditorWidget.activeEffect()
effect.setParameter("MarginSizeMm", 3.0)
effect.self().onApply()
- self.takeScreenshot('NeurosurgicalPlanning-Dilated','Dilated tumor')
+ self.takeScreenshot('NeurosurgicalPlanning-Dilated', 'Dilated tumor')
self.delayDisplay('Test passed!')
diff --git a/Modules/Loadable/Markups/Testing/Python/PluggableMarkupsSelfTest.py b/Modules/Loadable/Markups/Testing/Python/PluggableMarkupsSelfTest.py
index 15140437fd4..a1115d88510 100644
--- a/Modules/Loadable/Markups/Testing/Python/PluggableMarkupsSelfTest.py
+++ b/Modules/Loadable/Markups/Testing/Python/PluggableMarkupsSelfTest.py
@@ -90,7 +90,7 @@ def setUp(self):
markupsNodes = self.markupsNodes()
- #Check Markups module standard nodes are registered
+ # Check Markups module standard nodes are registered
for markupNode in markupsNodes:
markupsLogic.RegisterMarkupsNode(markupNode, markupsNodes[markupNode])
@@ -103,19 +103,19 @@ def setUp(self):
def __checkPushButtonExists(self, widget, name):
pushButtonObjectName = "Create%sPushButton" % name
- #slicer.util.delayDisplay("Checking whether '%s' exists" % pushButtonObjectName)
+ # slicer.util.delayDisplay("Checking whether '%s' exists" % pushButtonObjectName)
if widget.findChild(qt.QPushButton, pushButtonObjectName):
return True
return False
def __checkWidgetExists(self, widget, name):
- #slicer.util.delayDisplay("Checking whether '%s' exists" % name)
+ # slicer.util.delayDisplay("Checking whether '%s' exists" % name)
if widget.findChild(qt.QWidget, name):
return True
return False
def __checkWidgetVisibility(self, widget, name):
- #slicer.util.delayDisplay("Checking whether '%s' is visible" % pushButtonObjectName)
+ # slicer.util.delayDisplay("Checking whether '%s' is visible" % pushButtonObjectName)
w = widget.findChild(qt.QWidget, name)
return w.isVisible()
@@ -149,7 +149,7 @@ def test_unregister_existing_markups(self):
if markupsWidget is None:
raise Exception("Couldn't get the Markups module widget")
- #Check Markups module standard nodes are registered
+ # Check Markups module standard nodes are registered
for markupNode in self.markupsNodes():
if self.__checkPushButtonExists(markupsWidget, markupNode.GetMarkupType()) is None:
raise Exception("Create PushButton for %s is not present" % markupNode.GetMarkupType())
@@ -179,7 +179,7 @@ def test_register_markups(self):
markupsNodes = self.markupsNodes()
- #Check Markups module standard nodes are registered
+ # Check Markups module standard nodes are registered
for markupNode in markupsNodes:
slicer.util.delayDisplay("Registering %s" % markupNode.GetMarkupType())
markupsLogic.RegisterMarkupsNode(markupNode, markupsNodes[markupNode])
@@ -201,7 +201,7 @@ def test_unregister_additional_options_widgets(self):
if not self.__checkWidgetExists(markupsWidget, additionalOptionsWidget.objectName):
raise Exception("%s does not exist" % additionalOptionsWidget.objectName)
- #NOTE: since the widget will get destroyed, we take note of the name for the checking step
+ # NOTE: since the widget will get destroyed, we take note of the name for the checking step
objectName = additionalOptionsWidget.objectName
# Unregister widget
@@ -223,7 +223,7 @@ def test_register_additional_options_widgets(self):
raise Exception("Couldn't get the Markups module widget")
for additionalOptionsWidget in self.additionalOptionsWidgets():
- name = additionalOptionsWidget.objectName
+ name = additionalOptionsWidget.objectName
slicer.util.delayDisplay("Registering %s" % additionalOptionsWidget.objectName)
additionalOptionsWidgetsFactory.registerOptionsWidget(additionalOptionsWidget)
diff --git a/Modules/Loadable/Markups/Widgets/Testing/Python/MarkupsWidgetsSelfTest.py b/Modules/Loadable/Markups/Widgets/Testing/Python/MarkupsWidgetsSelfTest.py
index c1b21bc2e22..e6bc5c0aef2 100644
--- a/Modules/Loadable/Markups/Widgets/Testing/Python/MarkupsWidgetsSelfTest.py
+++ b/Modules/Loadable/Markups/Widgets/Testing/Python/MarkupsWidgetsSelfTest.py
@@ -65,13 +65,13 @@ def runTest(self):
# ------------------------------------------------------------------------------
def test_MarkupsWidgetsSelfTest_FullTest1(self):
# Check for Tables module
- self.assertTrue( slicer.modules.tables )
+ self.assertTrue(slicer.modules.tables)
self.section_SetupPathsAndNames()
self.section_CreateMarkups()
self.section_SimpleMarkupsWidget()
self.section_MarkupsPlaceWidget()
- self.delayDisplay("Test passed",self.delayMs)
+ self.delayDisplay("Test passed", self.delayMs)
# ------------------------------------------------------------------------------
def section_SetupPathsAndNames(self):
@@ -81,7 +81,7 @@ def section_SetupPathsAndNames(self):
# ------------------------------------------------------------------------------
def section_CreateMarkups(self):
- self.delayDisplay("Create markup nodes",self.delayMs)
+ self.delayDisplay("Create markup nodes", self.delayMs)
self.markupsLogic = slicer.modules.markups.logic()
@@ -94,10 +94,10 @@ def section_CreateMarkups(self):
# ------------------------------------------------------------------------------
def section_SimpleMarkupsWidget(self):
- self.delayDisplay("Test SimpleMarkupsWidget",self.delayMs)
+ self.delayDisplay("Test SimpleMarkupsWidget", self.delayMs)
simpleMarkupsWidget = slicer.qSlicerSimpleMarkupsWidget()
- nodeSelector = slicer.util.findChildren(simpleMarkupsWidget,"MarkupsNodeComboBox")[0]
+ nodeSelector = slicer.util.findChildren(simpleMarkupsWidget, "MarkupsNodeComboBox")[0]
self.assertIsNone(simpleMarkupsWidget.interactionNode())
simpleMarkupsWidget.setMRMLScene(slicer.mrmlScene)
simpleMarkupsWidget.show()
@@ -130,20 +130,20 @@ def section_SimpleMarkupsWidget(self):
simpleMarkupsWidget.optionsVisible = True
self.assertTrue(simpleMarkupsWidget.optionsVisible)
- defaultColor = qt.QColor(0,255,0)
+ defaultColor = qt.QColor(0, 255, 0)
simpleMarkupsWidget.defaultNodeColor = defaultColor
self.assertEqual(simpleMarkupsWidget.defaultNodeColor, defaultColor)
self.markupsNode3 = nodeSelector.addNode()
displayNode3 = self.markupsNode3.GetDisplayNode()
color3 = displayNode3.GetColor()
- self.assertEqual(color3[0]*255, defaultColor.red())
- self.assertEqual(color3[1]*255, defaultColor.green())
- self.assertEqual(color3[2]*255, defaultColor.blue())
+ self.assertEqual(color3[0] * 255, defaultColor.red())
+ self.assertEqual(color3[1] * 255, defaultColor.green())
+ self.assertEqual(color3[2] * 255, defaultColor.blue())
numberOfFiducialsAdded = 5
for i in range(numberOfFiducialsAdded):
- self.markupsNode3.AddControlPoint([i*20, i*15, i*5])
+ self.markupsNode3.AddControlPoint([i * 20, i * 15, i * 5])
tableWidget = simpleMarkupsWidget.tableWidget()
self.assertEqual(tableWidget.rowCount, numberOfFiducialsAdded)
@@ -157,7 +157,7 @@ def section_SimpleMarkupsWidget(self):
# ------------------------------------------------------------------------------
def section_MarkupsPlaceWidget(self):
- self.delayDisplay("Test MarkupsPlaceWidget",self.delayMs)
+ self.delayDisplay("Test MarkupsPlaceWidget", self.delayMs)
placeWidget = slicer.qSlicerMarkupsPlaceWidget()
self.assertIsNone(placeWidget.interactionNode())
diff --git a/Modules/Loadable/Plots/Testing/Python/PlotsSelfTest.py b/Modules/Loadable/Plots/Testing/Python/PlotsSelfTest.py
index 449f732bd26..ff6c42dfd3c 100644
--- a/Modules/Loadable/Plots/Testing/Python/PlotsSelfTest.py
+++ b/Modules/Loadable/Plots/Testing/Python/PlotsSelfTest.py
@@ -64,7 +64,7 @@ def runTest(self):
# ------------------------------------------------------------------------------
def test_PlotsSelfTest_FullTest1(self):
# Check for Plots module
- self.assertTrue( slicer.modules.plots )
+ self.assertTrue(slicer.modules.plots)
self.section_SetupPathsAndNames()
self.section_CreateTable()
@@ -114,7 +114,7 @@ def section_CreateTable(self):
inc = 7.5 / (numPoints - 1)
table.SetNumberOfRows(numPoints)
for i in range(numPoints):
- table.SetValue(i, 0, i * inc )
+ table.SetValue(i, 0, i * inc)
table.SetValue(i, 1, math.cos(i * inc))
table.SetValue(i, 2, math.sin(i * inc))
diff --git a/Modules/Loadable/SceneViews/Testing/Python/AddStorableDataAfterSceneViewTest.py b/Modules/Loadable/SceneViews/Testing/Python/AddStorableDataAfterSceneViewTest.py
index f108f38e74f..f3d8df8ddbb 100644
--- a/Modules/Loadable/SceneViews/Testing/Python/AddStorableDataAfterSceneViewTest.py
+++ b/Modules/Loadable/SceneViews/Testing/Python/AddStorableDataAfterSceneViewTest.py
@@ -147,7 +147,7 @@ def test_AddStorableDataAfterSceneViewTest1(self):
#
pointList = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLMarkupsFiducialNode')
- pointList.AddControlPoint([10,20,15])
+ pointList.AddControlPoint([10, 20, 15])
#
# save a scene view
@@ -175,7 +175,7 @@ def test_AddStorableDataAfterSceneViewTest1(self):
restoredData = slicer.mrmlScene.GetNodeByID(mrHeadID)
# for now, the non scene view storable data is removed
- self.assertIsNone( restoredData )
+ self.assertIsNone(restoredData)
slicer.util.delayDisplay('Success: extra storable node removed with scene view restore')
#
@@ -195,7 +195,7 @@ def test_AddStorableDataAfterSceneViewTest1(self):
restoredData = slicer.mrmlScene.GetNodeByID(mrHeadID)
# in this case the non scene view storable data is kept' scene is not changed
- self.assertIsNotNone( restoredData )
+ self.assertIsNotNone(restoredData)
slicer.util.delayDisplay('Success: extra storable node NOT removed with scene view restore')
print('Scene error code = ' + str(slicer.mrmlScene.GetErrorCode()))
diff --git a/Modules/Loadable/Segmentations/EditorEffects/Python/AbstractScriptedSegmentEditorAutoCompleteEffect.py b/Modules/Loadable/Segmentations/EditorEffects/Python/AbstractScriptedSegmentEditorAutoCompleteEffect.py
index 2919277d4a5..9d37a9e21f0 100644
--- a/Modules/Loadable/Segmentations/EditorEffects/Python/AbstractScriptedSegmentEditorAutoCompleteEffect.py
+++ b/Modules/Loadable/Segmentations/EditorEffects/Python/AbstractScriptedSegmentEditorAutoCompleteEffect.py
@@ -37,7 +37,7 @@ def __init__(self, scriptedEffect):
# Stores merged labelmap image geometry (voxel data is not allocated)
self.mergedLabelmapGeometryImage = None
self.selectedSegmentIds = None
- self.selectedSegmentModifiedTimes = {} # map from segment ID to ModifiedTime
+ self.selectedSegmentModifiedTimes = {} # map from segment ID to ModifiedTime
self.clippedMasterImageData = None
self.clippedMaskImageData = None
@@ -58,7 +58,7 @@ def __init__(self, scriptedEffect):
self.previewComputationInProgress = False
def __del__(self, scriptedEffect):
- super(SegmentEditorAutoCompleteEffect,self).__del__()
+ super(SegmentEditorAutoCompleteEffect, self).__del__()
self.delayedAutoUpdateTimer.stop()
self.observeSegmentation(False)
@@ -71,10 +71,10 @@ def isBackgroundLabelmap(labelmapOrientedImageData, label=None):
if extent[0] > extent[1] or extent[2] > extent[3] or extent[4] > extent[5]:
return False
numberOfFilledCorners = 0
- for i in [0,1]:
- for j in [2,3]:
- for k in [4,5]:
- voxelValue = labelmapOrientedImageData.GetScalarComponentAsFloat(extent[i],extent[j],extent[k],0)
+ for i in [0, 1]:
+ for j in [2, 3]:
+ for k in [4, 5]:
+ voxelValue = labelmapOrientedImageData.GetScalarComponentAsFloat(extent[i], extent[j], extent[k], 0)
if label is None:
if voxelValue > 0:
numberOfFilledCorners += 1
@@ -221,7 +221,7 @@ def observeSegmentation(self, observationEnabled):
vtkSegmentationCore.vtkSegmentation.SegmentAdded,
vtkSegmentationCore.vtkSegmentation.SegmentRemoved,
vtkSegmentationCore.vtkSegmentation.SegmentModified,
- vtkSegmentationCore.vtkSegmentation.MasterRepresentationModified ]
+ vtkSegmentationCore.vtkSegmentation.MasterRepresentationModified]
for eventId in observedEvents:
self.segmentationNodeObserverTags.append(self.observedSegmentation.AddObserver(eventId, self.onSegmentationModified))
@@ -331,7 +331,7 @@ def onApply(self):
if segmentationDisplayNode is not None and self.isBackgroundLabelmap(previewSegmentLabelmap):
# Automatically hide result segments that are background (all eight corners are non-zero)
segmentationDisplayNode.SetSegmentVisibility(segmentID, False)
- previewNode.GetSegmentation().RemoveSegment(segmentID) # delete now to limit memory usage
+ previewNode.GetSegmentation().RemoveSegment(segmentID) # delete now to limit memory usage
if previewContainsClosedSurfaceRepresentation:
segmentationNode.CreateClosedSurfaceRepresentation()
@@ -340,7 +340,7 @@ def onApply(self):
def setPreviewOpacity(self, opacity):
segmentationNode = self.scriptedEffect.parameterSetNode().GetSegmentationNode()
- segmentationNode.GetDisplayNode().SetOpacity(1.0-opacity)
+ segmentationNode.GetDisplayNode().SetOpacity(1.0 - opacity)
previewNode = self.getPreviewNode()
if previewNode:
previewNode.GetDisplayNode().SetOpacity(opacity)
@@ -353,7 +353,7 @@ def setPreviewOpacity(self, opacity):
def getPreviewOpacity(self):
previewNode = self.getPreviewNode()
- return previewNode.GetDisplayNode().GetOpacity() if previewNode else 0.6 # default opacity for preview
+ return previewNode.GetDisplayNode().GetOpacity() if previewNode else 0.6 # default opacity for preview
def setPreviewShow3D(self, show):
previewNode = self.getPreviewNode()
@@ -455,19 +455,19 @@ def preview(self):
# Margin size is relative to combined seed region size, but minimum of 3 voxels
print(f"self.extentGrowthRatio = {self.extentGrowthRatio}")
margin = [
- int(max(3, self.extentGrowthRatio * (labelsEffectiveExtent[1]-labelsEffectiveExtent[0]))),
- int(max(3, self.extentGrowthRatio * (labelsEffectiveExtent[3]-labelsEffectiveExtent[2]))),
- int(max(3, self.extentGrowthRatio * (labelsEffectiveExtent[5]-labelsEffectiveExtent[4]))) ]
+ int(max(3, self.extentGrowthRatio * (labelsEffectiveExtent[1] - labelsEffectiveExtent[0]))),
+ int(max(3, self.extentGrowthRatio * (labelsEffectiveExtent[3] - labelsEffectiveExtent[2]))),
+ int(max(3, self.extentGrowthRatio * (labelsEffectiveExtent[5] - labelsEffectiveExtent[4])))]
labelsExpandedExtent = [
- max(masterImageExtent[0], labelsEffectiveExtent[0]-margin[0]),
- min(masterImageExtent[1], labelsEffectiveExtent[1]+margin[0]),
- max(masterImageExtent[2], labelsEffectiveExtent[2]-margin[1]),
- min(masterImageExtent[3], labelsEffectiveExtent[3]+margin[1]),
- max(masterImageExtent[4], labelsEffectiveExtent[4]-margin[2]),
- min(masterImageExtent[5], labelsEffectiveExtent[5]+margin[2]) ]
- print("masterImageExtent = "+repr(masterImageExtent))
- print("labelsEffectiveExtent = "+repr(labelsEffectiveExtent))
- print("labelsExpandedExtent = "+repr(labelsExpandedExtent))
+ max(masterImageExtent[0], labelsEffectiveExtent[0] - margin[0]),
+ min(masterImageExtent[1], labelsEffectiveExtent[1] + margin[0]),
+ max(masterImageExtent[2], labelsEffectiveExtent[2] - margin[1]),
+ min(masterImageExtent[3], labelsEffectiveExtent[3] + margin[1]),
+ max(masterImageExtent[4], labelsEffectiveExtent[4] - margin[2]),
+ min(masterImageExtent[5], labelsEffectiveExtent[5] + margin[2])]
+ print("masterImageExtent = " + repr(masterImageExtent))
+ print("labelsEffectiveExtent = " + repr(labelsEffectiveExtent))
+ print("labelsExpandedExtent = " + repr(labelsExpandedExtent))
self.mergedLabelmapGeometryImage.SetExtent(labelsExpandedExtent)
# Create and setup preview node
@@ -505,8 +505,8 @@ def preview(self):
intensityBasedMasking = self.scriptedEffect.parameterSetNode().GetMasterVolumeIntensityMask()
success = segmentationNode.GenerateEditMask(self.clippedMaskImageData,
self.scriptedEffect.parameterSetNode().GetMaskMode(),
- self.clippedMasterImageData, # reference geometry
- "", # edited segment ID
+ self.clippedMasterImageData, # reference geometry
+ "", # edited segment ID
self.scriptedEffect.parameterSetNode().GetMaskSegmentID() if self.scriptedEffect.parameterSetNode().GetMaskSegmentID() else "",
self.clippedMasterImageData if intensityBasedMasking else None,
self.scriptedEffect.parameterSetNode().GetMasterVolumeIntensityMaskRange() if intensityBasedMasking else None)
@@ -514,8 +514,8 @@ def preview(self):
logging.error("Failed to create edit mask")
self.clippedMaskImageData = None
- previewNode.SetName(segmentationNode.GetName()+" preview")
- previewNode.RemoveClosedSurfaceRepresentation() # Force the closed surface representation to update
+ previewNode.SetName(segmentationNode.GetName() + " preview")
+ previewNode.RemoveClosedSurfaceRepresentation() # Force the closed surface representation to update
# TODO: This will no longer be required when we can use the segment editor to set multiple segments
# as the closed surfaces will be converted as necessary by the segmentation logic.
@@ -542,7 +542,7 @@ def preview(self):
previewSegment.SetColor(inputSegment.GetColor())
previewNode.GetSegmentation().AddSegment(previewSegment, segmentID)
- labelValue = index + 1 # n-th segment label value = n + 1 (background label value is 0)
+ labelValue = index + 1 # n-th segment label value = n + 1 (background label value is 0)
previewSegment.AddRepresentation(vtkSegmentationCore.vtkSegmentationConverter.GetSegmentationBinaryLabelmapRepresentationName(), outputLabelmap)
previewSegment.SetLabelValue(labelValue)
diff --git a/Modules/Loadable/Segmentations/EditorEffects/Python/AbstractScriptedSegmentEditorEffect.py b/Modules/Loadable/Segmentations/EditorEffects/Python/AbstractScriptedSegmentEditorEffect.py
index b8d4d915b1f..00e17e29a1c 100644
--- a/Modules/Loadable/Segmentations/EditorEffects/Python/AbstractScriptedSegmentEditorEffect.py
+++ b/Modules/Loadable/Segmentations/EditorEffects/Python/AbstractScriptedSegmentEditorEffect.py
@@ -85,9 +85,9 @@ def setWidgetMinMaxStepFromImageSpacing(self, spinbox, imageData):
return
import math
spinbox.unitAwareProperties &= ~(slicer.qMRMLSpinBox.MinimumValue | slicer.qMRMLSpinBox.MaximumValue | slicer.qMRMLSpinBox.Precision)
- stepSize = 10**(math.floor(math.log10(min(imageData.GetSpacing())/10.0)))
+ stepSize = 10**(math.floor(math.log10(min(imageData.GetSpacing()) / 10.0)))
spinbox.minimum = stepSize
- spinbox.maximum = 10**(math.ceil(math.log10(max(imageData.GetSpacing())*100.0)))
+ spinbox.maximum = 10**(math.ceil(math.log10(max(imageData.GetSpacing()) * 100.0)))
spinbox.singleStep = stepSize
# number of decimals is set to be able to show the step size (e.g., stepSize = 0.01 => decimals = 2)
- spinbox.decimals = max(int(-math.floor(math.log10(stepSize))),0)
+ spinbox.decimals = max(int(-math.floor(math.log10(stepSize))), 0)
diff --git a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorDrawEffect.py b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorDrawEffect.py
index f11b835c759..9917878ec6c 100644
--- a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorDrawEffect.py
+++ b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorDrawEffect.py
@@ -22,7 +22,7 @@ def __init__(self, scriptedEffect):
def clone(self):
import qSlicerSegmentationsEditorEffectsPythonQt as effects
clonedEffect = effects.qSlicerSegmentEditorScriptedLabelEffect(None)
- clonedEffect.setPythonSource(__file__.replace('\\','/'))
+ clonedEffect.setPythonSource(__file__.replace('\\', '/'))
return clonedEffect
def icon(self):
@@ -86,7 +86,7 @@ def processInteractionEvents(self, callerInteractor, eventId, viewWidget):
sliceNode = viewWidget.sliceLogic().GetSliceNode()
pipeline.lastInsertSliceNodeMTime = sliceNode.GetMTime()
abortEvent = True
- elif (eventId == vtk.vtkCommand.RightButtonReleaseEvent and pipeline.actionState == "finishing") or (eventId==vtk.vtkCommand.LeftButtonDoubleClickEvent and not anyModifierKeyPressed):
+ elif (eventId == vtk.vtkCommand.RightButtonReleaseEvent and pipeline.actionState == "finishing") or (eventId == vtk.vtkCommand.LeftButtonDoubleClickEvent and not anyModifierKeyPressed):
abortEvent = (pipeline.rasPoints.GetNumberOfPoints() > 1)
sliceNode = viewWidget.sliceLogic().GetSliceNode()
if abs(pipeline.lastInsertSliceNodeMTime - sliceNode.GetMTime()) < 2:
@@ -173,7 +173,7 @@ def __init__(self, scriptedEffect, sliceWidget):
self.mapper.SetInputData(self.polyData)
self.actor.SetMapper(self.mapper)
actorProperty = self.actor.GetProperty()
- actorProperty.SetColor(1,1,0)
+ actorProperty.SetColor(1, 1, 0)
actorProperty.SetLineWidth(1)
self.createStippleTexture(0xAAAA, 8)
@@ -223,7 +223,7 @@ def createPolyData(self):
polyData.SetLines(lines)
return polyData
- def addPoint(self,ras):
+ def addPoint(self, ras):
# Add a world space point to the current outline
# Store active slice when first point is added
@@ -244,11 +244,11 @@ def addPoint(self,ras):
p = self.rasPoints.InsertNextPoint(ras)
if p > 0:
idList = vtk.vtkIdList()
- idList.InsertNextId(p-1)
+ idList.InsertNextId(p - 1)
idList.InsertNextId(p)
self.polyData.InsertNextCell(vtk.VTK_LINE, idList)
- def setLineMode(self,mode="solid"):
+ def setLineMode(self, mode="solid"):
actorProperty = self.actor.GetProperty()
if mode == "solid":
self.polyData.GetPointData().SetTCoords(None)
@@ -281,7 +281,7 @@ def apply(self):
if lineExists:
# Close the polyline back to the first point
idList = vtk.vtkIdList()
- idList.InsertNextId(self.polyData.GetNumberOfPoints()-1)
+ idList.InsertNextId(self.polyData.GetNumberOfPoints() - 1)
idList.InsertNextId(0)
self.polyData.InsertNextCell(vtk.VTK_LINE, idList)
diff --git a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorFillBetweenSlicesEffect.py b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorFillBetweenSlicesEffect.py
index 9baeff5044c..62bcee186d1 100644
--- a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorFillBetweenSlicesEffect.py
+++ b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorFillBetweenSlicesEffect.py
@@ -19,7 +19,7 @@ def __init__(self, scriptedEffect):
def clone(self):
import qSlicerSegmentationsEditorEffectsPythonQt as effects
clonedEffect = effects.qSlicerSegmentEditorScriptedEffect(None)
- clonedEffect.setPythonSource(__file__.replace('\\','/'))
+ clonedEffect.setPythonSource(__file__.replace('\\', '/'))
return clonedEffect
def icon(self):
diff --git a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorGrowFromSeedsEffect.py b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorGrowFromSeedsEffect.py
index aa51e910a23..4525bbad9a6 100644
--- a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorGrowFromSeedsEffect.py
+++ b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorGrowFromSeedsEffect.py
@@ -20,14 +20,14 @@ def __init__(self, scriptedEffect):
AbstractScriptedSegmentEditorAutoCompleteEffect.__init__(self, scriptedEffect)
scriptedEffect.name = 'Grow from seeds'
self.minimumNumberOfSegments = 2
- self.clippedMasterImageDataRequired = True # master volume intensities are used by this effect
- self.clippedMaskImageDataRequired = True # masking is used
+ self.clippedMasterImageDataRequired = True # master volume intensities are used by this effect
+ self.clippedMaskImageDataRequired = True # masking is used
self.growCutFilter = None
def clone(self):
import qSlicerSegmentationsEditorEffectsPythonQt as effects
clonedEffect = effects.qSlicerSegmentEditorScriptedEffect(None)
- clonedEffect.setPythonSource(__file__.replace('\\','/'))
+ clonedEffect.setPythonSource(__file__.replace('\\', '/'))
return clonedEffect
def icon(self):
diff --git a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorHollowEffect.py b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorHollowEffect.py
index 2791d9f23d5..03dc36ee0f3 100644
--- a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorHollowEffect.py
+++ b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorHollowEffect.py
@@ -20,7 +20,7 @@ def __init__(self, scriptedEffect):
def clone(self):
import qSlicerSegmentationsEditorEffectsPythonQt as effects
clonedEffect = effects.qSlicerSegmentEditorScriptedEffect(None)
- clonedEffect.setPythonSource(__file__.replace('\\','/'))
+ clonedEffect.setPythonSource(__file__.replace('\\', '/'))
return clonedEffect
def icon(self):
@@ -165,10 +165,10 @@ def getShellThicknessMM(self):
selectedSegmentLabelmapSpacing = selectedSegmentLabelmap.GetSpacing()
shellThicknessPixel = self.getShellThicknessPixel()
- shellThicknessMM = [abs((shellThicknessPixel[i])*selectedSegmentLabelmapSpacing[i]) for i in range(3)]
+ shellThicknessMM = [abs((shellThicknessPixel[i]) * selectedSegmentLabelmapSpacing[i]) for i in range(3)]
for i in range(3):
if shellThicknessMM[i] > 0:
- shellThicknessMM[i] = round(shellThicknessMM[i], max(int(-math.floor(math.log10(shellThicknessMM[i]))),1))
+ shellThicknessMM[i] = round(shellThicknessMM[i], max(int(-math.floor(math.log10(shellThicknessMM[i]))), 1))
return shellThicknessMM
def showStatusMessage(self, msg, timeoutMsec=500):
@@ -199,11 +199,11 @@ def processHollowing(self):
spacing = selectedSegmentLabelmap.GetSpacing()
voxelDiameter = min(selectedSegmentLabelmap.GetSpacing())
if shellMode == MEDIAL_SURFACE:
- margin.SetOuterMarginMM( 0.5 * shellThicknessMM)
- margin.SetInnerMarginMM(-0.5 * shellThicknessMM + 0.5*voxelDiameter)
+ margin.SetOuterMarginMM(0.5 * shellThicknessMM)
+ margin.SetInnerMarginMM(-0.5 * shellThicknessMM + 0.5 * voxelDiameter)
elif shellMode == INSIDE_SURFACE:
- margin.SetOuterMarginMM(shellThicknessMM + 0.1*voxelDiameter)
- margin.SetInnerMarginMM(0.0 + 0.1*voxelDiameter) # Don't include the original border (0.0)
+ margin.SetOuterMarginMM(shellThicknessMM + 0.1 * voxelDiameter)
+ margin.SetInnerMarginMM(0.0 + 0.1 * voxelDiameter) # Don't include the original border (0.0)
elif shellMode == OUTSIDE_SURFACE:
margin.SetOuterMarginMM(0.0)
margin.SetInnerMarginMM(-shellThicknessMM + voxelDiameter)
@@ -226,7 +226,7 @@ def onApply(self):
qt.QApplication.setOverrideCursor(qt.Qt.WaitCursor)
self.scriptedEffect.saveStateForUndo()
- applyToAllVisibleSegments = int(self.scriptedEffect.parameter("ApplyToAllVisibleSegments")) !=0 \
+ applyToAllVisibleSegments = int(self.scriptedEffect.parameter("ApplyToAllVisibleSegments")) != 0 \
if self.scriptedEffect.parameter("ApplyToAllVisibleSegments") else False
if applyToAllVisibleSegments:
diff --git a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorIslandsEffect.py b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorIslandsEffect.py
index e6e2181e62d..10da0ec69b5 100644
--- a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorIslandsEffect.py
+++ b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorIslandsEffect.py
@@ -22,7 +22,7 @@ def __init__(self, scriptedEffect):
def clone(self):
import qSlicerSegmentationsEditorEffectsPythonQt as effects
clonedEffect = effects.qSlicerSegmentEditorScriptedEffect(None)
- clonedEffect.setPythonSource(__file__.replace('\\','/'))
+ clonedEffect.setPythonSource(__file__.replace('\\', '/'))
return clonedEffect
def icon(self):
@@ -70,18 +70,18 @@ def setupOptionsFrame(self):
self.splitAllOptionRadioButton = qt.QRadioButton("Split islands to segments")
self.splitAllOptionRadioButton.setToolTip(
- "Create a new segment for each island of selected segment. Islands smaller than minimum size will be removed. "+
+ "Create a new segment for each island of selected segment. Islands smaller than minimum size will be removed. " +
"Segments will be ordered by island size.")
self.operationRadioButtons.append(self.splitAllOptionRadioButton)
self.widgetToOperationNameMap[self.splitAllOptionRadioButton] = SPLIT_ISLANDS_TO_SEGMENTS
operationLayout = qt.QGridLayout()
- operationLayout.addWidget(self.keepLargestOptionRadioButton,0,0)
- operationLayout.addWidget(self.removeSmallOptionRadioButton,1,0)
- operationLayout.addWidget(self.splitAllOptionRadioButton,2,0)
- operationLayout.addWidget(self.keepSelectedOptionRadioButton,0,1)
- operationLayout.addWidget(self.removeSelectedOptionRadioButton,1,1)
- operationLayout.addWidget(self.addSelectedOptionRadioButton,2,1)
+ operationLayout.addWidget(self.keepLargestOptionRadioButton, 0, 0)
+ operationLayout.addWidget(self.removeSmallOptionRadioButton, 1, 0)
+ operationLayout.addWidget(self.splitAllOptionRadioButton, 2, 0)
+ operationLayout.addWidget(self.keepSelectedOptionRadioButton, 0, 1)
+ operationLayout.addWidget(self.removeSelectedOptionRadioButton, 1, 1)
+ operationLayout.addWidget(self.addSelectedOptionRadioButton, 2, 1)
self.operationRadioButtons[0].setChecked(True)
self.scriptedEffect.addOptionsWidget(operationLayout)
@@ -122,13 +122,13 @@ def onApply(self):
operationName = self.scriptedEffect.parameter("Operation")
minimumSize = self.scriptedEffect.integerParameter("MinimumSize")
if operationName == KEEP_LARGEST_ISLAND:
- self.splitSegments(minimumSize = minimumSize, maxNumberOfSegments = 1)
+ self.splitSegments(minimumSize=minimumSize, maxNumberOfSegments=1)
elif operationName == REMOVE_SMALL_ISLANDS:
- self.splitSegments(minimumSize = minimumSize, split = False)
+ self.splitSegments(minimumSize=minimumSize, split=False)
elif operationName == SPLIT_ISLANDS_TO_SEGMENTS:
- self.splitSegments(minimumSize = minimumSize)
+ self.splitSegments(minimumSize=minimumSize)
- def splitSegments(self, minimumSize = 0, maxNumberOfSegments = 0, split = True):
+ def splitSegments(self, minimumSize=0, maxNumberOfSegments=0, split=True):
"""
minimumSize: if 0 then it means that all islands are kept, regardless of size
maxNumberOfSegments: if 0 then it means that all islands are kept, regardless of how many
@@ -162,7 +162,7 @@ def splitSegments(self, minimumSize = 0, maxNumberOfSegments = 0, split = True):
islandCount = islandMath.GetNumberOfIslands()
islandOrigCount = islandMath.GetOriginalNumberOfIslands()
ignoredIslands = islandOrigCount - islandCount
- logging.info( "%d islands created (%d ignored)" % (islandCount, ignoredIslands) )
+ logging.info("%d islands created (%d ignored)" % (islandCount, ignoredIslands))
baseSegmentName = "Label"
selectedSegmentID = self.scriptedEffect.parameterSetNode().GetSelectedSegmentID()
@@ -202,7 +202,7 @@ def splitSegments(self, minimumSize = 0, maxNumberOfSegments = 0, split = True):
segmentID = selectedSegmentID
if i != 0 and split:
segment = slicer.vtkSegment()
- name = baseSegmentName + "_" + str(i+1)
+ name = baseSegmentName + "_" + str(i + 1)
segment.SetName(name)
segment.AddRepresentation(slicer.vtkSegmentationConverter.GetSegmentationBinaryLabelmapRepresentationName(),
selectedSegment.GetRepresentation(slicer.vtkSegmentationConverter.GetSegmentationBinaryLabelmapRepresentationName()))
@@ -320,7 +320,7 @@ def processInteractionEvents(self, callerInteractor, eventId, viewWidget):
seedPoints = vtk.vtkPoints()
origin = inputLabelImage.GetOrigin()
spacing = inputLabelImage.GetSpacing()
- seedPoints.InsertNextPoint(origin[0]+ijk[0]*spacing[0], origin[1]+ijk[1]*spacing[1], origin[2]+ijk[2]*spacing[2])
+ seedPoints.InsertNextPoint(origin[0] + ijk[0] * spacing[0], origin[1] + ijk[1] * spacing[1], origin[2] + ijk[2] * spacing[2])
floodFillingFilter.SetSeedPoints(seedPoints)
floodFillingFilter.ThresholdBetween(pixelValue, pixelValue)
@@ -332,12 +332,12 @@ def processInteractionEvents(self, callerInteractor, eventId, viewWidget):
modifierLabelmap.DeepCopy(floodFillingFilter.GetOutput())
self.scriptedEffect.modifySelectedSegmentByLabelmap(modifierLabelmap, slicer.qSlicerSegmentEditorAbstractEffect.ModificationModeAdd)
- elif pixelValue != 0: # if clicked on empty part then there is nothing to remove or keep
+ elif pixelValue != 0: # if clicked on empty part then there is nothing to remove or keep
if operationName == KEEP_SELECTED_ISLAND:
floodFillingFilter.SetInValue(1)
floodFillingFilter.SetOutValue(0)
- else: # operationName == REMOVE_SELECTED_ISLAND:
+ else: # operationName == REMOVE_SELECTED_ISLAND:
floodFillingFilter.SetInValue(1)
floodFillingFilter.SetOutValue(0)
@@ -347,7 +347,7 @@ def processInteractionEvents(self, callerInteractor, eventId, viewWidget):
if operationName == KEEP_SELECTED_ISLAND:
self.scriptedEffect.modifySelectedSegmentByLabelmap(modifierLabelmap, slicer.qSlicerSegmentEditorAbstractEffect.ModificationModeSet)
- else: # operationName == REMOVE_SELECTED_ISLAND:
+ else: # operationName == REMOVE_SELECTED_ISLAND:
self.scriptedEffect.modifySelectedSegmentByLabelmap(modifierLabelmap, slicer.qSlicerSegmentEditorAbstractEffect.ModificationModeRemove)
except IndexError:
@@ -358,7 +358,7 @@ def processInteractionEvents(self, callerInteractor, eventId, viewWidget):
return abortEvent
def processViewNodeEvents(self, callerViewNode, eventId, viewWidget):
- pass # For the sake of example
+ pass # For the sake of example
def setMRMLDefaults(self):
self.scriptedEffect.setParameterDefault("Operation", KEEP_LARGEST_ISLAND)
diff --git a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorLevelTracingEffect.py b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorLevelTracingEffect.py
index 6f0912cfc4a..3be183096e4 100644
--- a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorLevelTracingEffect.py
+++ b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorLevelTracingEffect.py
@@ -26,7 +26,7 @@ def __init__(self, scriptedEffect):
def clone(self):
import qSlicerSegmentationsEditorEffectsPythonQt as effects
clonedEffect = effects.qSlicerSegmentEditorScriptedLabelEffect(None)
- clonedEffect.setPythonSource(__file__.replace('\\','/'))
+ clonedEffect.setPythonSource(__file__.replace('\\', '/'))
return clonedEffect
def icon(self):
@@ -160,15 +160,15 @@ def __init__(self, effect, sliceWidget):
self.mapper = vtk.vtkPolyDataMapper2D()
self.actor = vtk.vtkActor2D()
actorProperty = self.actor.GetProperty()
- actorProperty.SetColor( 107/255., 190/255., 99/255. )
- actorProperty.SetLineWidth( 1 )
+ actorProperty.SetColor(107 / 255., 190 / 255., 99 / 255.)
+ actorProperty.SetLineWidth(1)
self.mapper.SetInputData(self.polyData)
self.actor.SetMapper(self.mapper)
actorProperty = self.actor.GetProperty()
- actorProperty.SetColor(1,1,0)
+ actorProperty.SetColor(1, 1, 0)
actorProperty.SetLineWidth(1)
- def preview(self,xy):
+ def preview(self, xy):
"""Calculate the current level trace view if the mouse is inside the volume extent
Returns False if slice views are rotated.
"""
@@ -193,8 +193,8 @@ def preview(self,xy):
sliceNode = self.effect.scriptedEffect.viewNode(self.sliceWidget)
offset = max(sliceNode.GetDimensions())
- i0,j0,k0 = self.effect.xyToIjk((0,0), self.sliceWidget, masterImageData, parentTransformNode)
- i1,j1,k1 = self.effect.xyToIjk((offset,offset), self.sliceWidget, masterImageData, parentTransformNode)
+ i0, j0, k0 = self.effect.xyToIjk((0, 0), self.sliceWidget, masterImageData, parentTransformNode)
+ i1, j1, k1 = self.effect.xyToIjk((offset, offset), self.sliceWidget, masterImageData, parentTransformNode)
if i0 == i1:
self.tracingFilter.SetPlaneToJK()
elif j0 == j1:
diff --git a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorLogicalEffect.py b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorLogicalEffect.py
index 383853527b9..a898fe27f12 100644
--- a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorLogicalEffect.py
+++ b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorLogicalEffect.py
@@ -21,7 +21,7 @@ def __init__(self, scriptedEffect):
def clone(self):
import qSlicerSegmentationsEditorEffectsPythonQt as effects
clonedEffect = effects.qSlicerSegmentEditorScriptedEffect(None)
- clonedEffect.setPythonSource(__file__.replace('\\','/'))
+ clonedEffect.setPythonSource(__file__.replace('\\', '/'))
return clonedEffect
def icon(self):
@@ -157,7 +157,7 @@ def updateMRMLFromGUI(self):
bypassMasking = 1 if self.bypassMaskingCheckBox.isChecked() else 0
self.scriptedEffect.setParameter("BypassMasking", bypassMasking)
- modifierSegmentIDs = ';'.join(self.modifierSegmentSelector.selectedSegmentIDs()) # semicolon-separated list of segment IDs
+ modifierSegmentIDs = ';'.join(self.modifierSegmentSelector.selectedSegmentIDs()) # semicolon-separated list of segment IDs
self.scriptedEffect.setParameter("ModifierSegmentID", modifierSegmentIDs)
def getInvertedBinaryLabelmap(self, modifierLabelmap):
@@ -191,7 +191,7 @@ def onApply(self):
# Get modifier labelmap and parameters
operation = self.scriptedEffect.parameter("Operation")
- bypassMasking = (self.scriptedEffect.integerParameter("BypassMasking") != 0)
+ bypassMasking = (self.scriptedEffect.integerParameter("BypassMasking") != 0)
selectedSegmentID = self.scriptedEffect.parameterSetNode().GetSelectedSegmentID()
@@ -224,8 +224,8 @@ def onApply(self):
modifierSegmentLabelmap_CommonGeometry = slicer.vtkOrientedImageData()
vtkSegmentationCore.vtkOrientedImageDataResample.ResampleOrientedImageToReferenceOrientedImage(
modifierSegmentLabelmap, commonGeometryImage, modifierSegmentLabelmap_CommonGeometry,
- False, # nearest neighbor interpolation,
- True # make sure resampled modifier segment is not cropped
+ False, # nearest neighbor interpolation,
+ True # make sure resampled modifier segment is not cropped
)
modifierSegmentLabelmap = modifierSegmentLabelmap_CommonGeometry
diff --git a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorMarginEffect.py b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorMarginEffect.py
index 2e1cc134106..c430cb8eb7b 100644
--- a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorMarginEffect.py
+++ b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorMarginEffect.py
@@ -21,7 +21,7 @@ def __init__(self, scriptedEffect):
def clone(self):
import qSlicerSegmentationsEditorEffectsPythonQt as effects
clonedEffect = effects.qSlicerSegmentEditorScriptedEffect(None)
- clonedEffect.setPythonSource(__file__.replace('\\','/'))
+ clonedEffect.setPythonSource(__file__.replace('\\', '/'))
return clonedEffect
def icon(self):
@@ -152,10 +152,10 @@ def getMarginSizeMM(self):
selectedSegmentLabelmapSpacing = selectedSegmentLabelmap.GetSpacing()
marginSizePixel = self.getMarginSizePixel()
- marginSizeMM = [abs((marginSizePixel[i])*selectedSegmentLabelmapSpacing[i]) for i in range(3)]
+ marginSizeMM = [abs((marginSizePixel[i]) * selectedSegmentLabelmapSpacing[i]) for i in range(3)]
for i in range(3):
if marginSizeMM[i] > 0:
- marginSizeMM[i] = round(marginSizeMM[i], max(int(-math.floor(math.log10(marginSizeMM[i]))),1))
+ marginSizeMM[i] = round(marginSizeMM[i], max(int(-math.floor(math.log10(marginSizeMM[i]))), 1))
return marginSizeMM
def showStatusMessage(self, msg, timeoutMsec=500):
@@ -218,7 +218,7 @@ def onApply(self):
qt.QApplication.setOverrideCursor(qt.Qt.WaitCursor)
self.scriptedEffect.saveStateForUndo()
- applyToAllVisibleSegments = int(self.scriptedEffect.parameter("ApplyToAllVisibleSegments")) !=0 \
+ applyToAllVisibleSegments = int(self.scriptedEffect.parameter("ApplyToAllVisibleSegments")) != 0 \
if self.scriptedEffect.parameter("ApplyToAllVisibleSegments") else False
if applyToAllVisibleSegments:
diff --git a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorMaskVolumeEffect.py b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorMaskVolumeEffect.py
index 651a4ca4c45..9d35c932213 100644
--- a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorMaskVolumeEffect.py
+++ b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorMaskVolumeEffect.py
@@ -10,17 +10,17 @@ class SegmentEditorMaskVolumeEffect(AbstractScriptedSegmentEditorEffect):
def __init__(self, scriptedEffect):
scriptedEffect.name = 'Mask volume'
- scriptedEffect.perSegment = True # this effect operates on a single selected segment
+ scriptedEffect.perSegment = True # this effect operates on a single selected segment
AbstractScriptedSegmentEditorEffect.__init__(self, scriptedEffect)
- #Effect-specific members
+ # Effect-specific members
self.buttonToOperationNameMap = {}
def clone(self):
# It should not be necessary to modify this method
import qSlicerSegmentationsEditorEffectsPythonQt as effects
clonedEffect = effects.qSlicerSegmentEditorScriptedEffect(None)
- clonedEffect.setPythonSource(__file__.replace('\\','/'))
+ clonedEffect.setPythonSource(__file__.replace('\\', '/'))
return clonedEffect
def icon(self):
@@ -132,7 +132,7 @@ def setupOptionsFrame(self):
self.outputVolumeSelector.noneEnabled = True
self.outputVolumeSelector.noneDisplay = "(Create new Volume)"
self.outputVolumeSelector.showHidden = False
- self.outputVolumeSelector.setMRMLScene( slicer.mrmlScene )
+ self.outputVolumeSelector.setMRMLScene(slicer.mrmlScene)
self.outputVolumeSelector.setToolTip("Masked output volume. It may be the same as the input volume for cumulative masking.")
self.outputVolumeSelector.connect("currentNodeChanged(vtkMRMLNode*)", self.onOutputVolumeChanged)
@@ -282,10 +282,10 @@ def onApply(self):
volumesLogic = slicer.modules.volumes.logic()
scene = inputVolume.GetScene()
if operationMode == "FILL_INSIDE_AND_OUTSIDE":
- outputVolumeName = inputVolume.GetName()+" label"
+ outputVolumeName = inputVolume.GetName() + " label"
outputVolume = volumesLogic.CreateAndAddLabelVolume(inputVolume, outputVolumeName)
else:
- outputVolumeName = inputVolume.GetName()+" masked"
+ outputVolumeName = inputVolume.GetName() + " masked"
outputVolume = volumesLogic.CloneVolumeGeneric(scene, inputVolume, outputVolumeName, False)
self.outputVolumeSelector.setCurrentNode(outputVolume)
diff --git a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorSmoothingEffect.py b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorSmoothingEffect.py
index d05c8291ff5..a5a3052b532 100644
--- a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorSmoothingEffect.py
+++ b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorSmoothingEffect.py
@@ -21,7 +21,7 @@ def __init__(self, scriptedEffect):
def clone(self):
import qSlicerSegmentationsEditorEffectsPythonQt as effects
clonedEffect = effects.qSlicerSegmentEditorScriptedPaintEffect(None)
- clonedEffect.setPythonSource(__file__.replace('\\','/'))
+ clonedEffect.setPythonSource(__file__.replace('\\', '/'))
return clonedEffect
def icon(self):
@@ -122,16 +122,16 @@ def setMRMLDefaults(self):
def updateParameterWidgetsVisibility(self):
methodIndex = self.methodSelectorComboBox.currentIndex
smoothingMethod = self.methodSelectorComboBox.itemData(methodIndex)
- morphologicalMethod = (smoothingMethod==MEDIAN or smoothingMethod==MORPHOLOGICAL_OPENING or smoothingMethod==MORPHOLOGICAL_CLOSING)
+ morphologicalMethod = (smoothingMethod == MEDIAN or smoothingMethod == MORPHOLOGICAL_OPENING or smoothingMethod == MORPHOLOGICAL_CLOSING)
self.kernelSizeMMLabel.setVisible(morphologicalMethod)
self.kernelSizeMMSpinBox.setVisible(morphologicalMethod)
self.kernelSizePixel.setVisible(morphologicalMethod)
- self.gaussianStandardDeviationMMLabel.setVisible(smoothingMethod==GAUSSIAN)
- self.gaussianStandardDeviationMMSpinBox.setVisible(smoothingMethod==GAUSSIAN)
- self.jointTaubinSmoothingFactorLabel.setVisible(smoothingMethod==JOINT_TAUBIN)
- self.jointTaubinSmoothingFactorSlider.setVisible(smoothingMethod==JOINT_TAUBIN)
- self.applyToAllVisibleSegmentsLabel.setVisible(smoothingMethod!=JOINT_TAUBIN)
- self.applyToAllVisibleSegmentsCheckBox.setVisible(smoothingMethod!=JOINT_TAUBIN)
+ self.gaussianStandardDeviationMMLabel.setVisible(smoothingMethod == GAUSSIAN)
+ self.gaussianStandardDeviationMMSpinBox.setVisible(smoothingMethod == GAUSSIAN)
+ self.jointTaubinSmoothingFactorLabel.setVisible(smoothingMethod == JOINT_TAUBIN)
+ self.jointTaubinSmoothingFactorSlider.setVisible(smoothingMethod == JOINT_TAUBIN)
+ self.applyToAllVisibleSegmentsLabel.setVisible(smoothingMethod != JOINT_TAUBIN)
+ self.applyToAllVisibleSegmentsCheckBox.setVisible(smoothingMethod != JOINT_TAUBIN)
def getKernelSizePixel(self):
selectedSegmentLabelmapSpacing = [1.0, 1.0, 1.0]
@@ -141,7 +141,7 @@ def getKernelSizePixel(self):
# size rounded to nearest odd number. If kernel size is even then image gets shifted.
kernelSizeMM = self.scriptedEffect.doubleParameter("KernelSizeMm")
- kernelSizePixel = [int(round((kernelSizeMM / selectedSegmentLabelmapSpacing[componentIndex]+1)/2)*2-1) for componentIndex in range(3)]
+ kernelSizePixel = [int(round((kernelSizeMM / selectedSegmentLabelmapSpacing[componentIndex] + 1) / 2) * 2 - 1) for componentIndex in range(3)]
return kernelSizePixel
def updateGUIFromMRML(self):
@@ -197,7 +197,7 @@ def onApply(self, maskImage=None, maskExtent=None):
"""maskImage: contains nonzero where smoothing will be applied
"""
smoothingMethod = self.scriptedEffect.parameter("SmoothingMethod")
- applyToAllVisibleSegments = int(self.scriptedEffect.parameter("ApplyToAllVisibleSegments")) !=0 \
+ applyToAllVisibleSegments = int(self.scriptedEffect.parameter("ApplyToAllVisibleSegments")) != 0 \
if self.scriptedEffect.parameter("ApplyToAllVisibleSegments") else False
if smoothingMethod != JOINT_TAUBIN:
@@ -352,11 +352,11 @@ def smoothSelectedSegment(self, maskImage=None, maskExtent=None):
if smoothingMethod == MORPHOLOGICAL_OPENING:
smoothingFilter.SetOpenValue(labelValue)
smoothingFilter.SetCloseValue(backgroundValue)
- else: # must be smoothingMethod == MORPHOLOGICAL_CLOSING:
+ else: # must be smoothingMethod == MORPHOLOGICAL_CLOSING:
smoothingFilter.SetOpenValue(backgroundValue)
smoothingFilter.SetCloseValue(labelValue)
- smoothingFilter.SetKernelSize(kernelSizePixel[0],kernelSizePixel[1],kernelSizePixel[2])
+ smoothingFilter.SetKernelSize(kernelSizePixel[0], kernelSizePixel[1], kernelSizePixel[2])
smoothingFilter.Update()
self.modifySelectedSegmentByLabelmap(smoothingFilter.GetOutput(), selectedSegmentLabelmap, modifierLabelmap, maskImage, maskExtent)
@@ -383,10 +383,10 @@ def smoothMultipleSegments(self, maskImage=None, maskExtent=None):
logging.error('Failed to apply smoothing: cannot get list of visible segments')
return
- segmentLabelValues = [] # list of [segmentId, labelValue]
+ segmentLabelValues = [] # list of [segmentId, labelValue]
for i in range(visibleSegmentIds.GetNumberOfValues()):
segmentId = visibleSegmentIds.GetValue(i)
- segmentLabelValues.append([segmentId, i+1])
+ segmentLabelValues.append([segmentId, i + 1])
# Perform smoothing in voxel space
ici = vtk.vtkImageChangeInformation()
@@ -409,8 +409,8 @@ def smoothMultipleSegments(self, maskImage=None, maskExtent=None):
# Low-pass filtering using Taubin's method
smoothingFactor = self.scriptedEffect.doubleParameter("JointTaubinSmoothingFactor")
- smoothingIterations = 100 # according to VTK documentation 10-20 iterations could be enough but we use a higher value to reduce chance of shrinking
- passBand = pow(10.0, -4.0*smoothingFactor) # gives a nice range of 1-0.0001 from a user input of 0-1
+ smoothingIterations = 100 # according to VTK documentation 10-20 iterations could be enough but we use a higher value to reduce chance of shrinking
+ passBand = pow(10.0, -4.0 * smoothingFactor) # gives a nice range of 1-0.0001 from a user input of 0-1
smoother = vtk.vtkWindowedSincPolyDataFilter()
smoother.SetInputConnection(convertToPolyData.GetOutputPort())
smoother.SetNumberOfIterations(smoothingIterations)
@@ -432,8 +432,8 @@ def smoothMultipleSegments(self, maskImage=None, maskExtent=None):
# Convert polydata to stencil
polyDataToImageStencil = vtk.vtkPolyDataToImageStencil()
polyDataToImageStencil.SetInputConnection(geometryFilter.GetOutputPort())
- polyDataToImageStencil.SetOutputSpacing(1,1,1)
- polyDataToImageStencil.SetOutputOrigin(0,0,0)
+ polyDataToImageStencil.SetOutputSpacing(1, 1, 1)
+ polyDataToImageStencil.SetOutputOrigin(0, 0, 0)
polyDataToImageStencil.SetOutputWholeExtent(mergedImage.GetExtent())
# Convert stencil to image
@@ -445,7 +445,7 @@ def smoothMultipleSegments(self, maskImage=None, maskExtent=None):
stencil.SetInputData(emptyBinaryLabelMap)
stencil.SetStencilConnection(polyDataToImageStencil.GetOutputPort())
stencil.ReverseStencilOn()
- stencil.SetBackgroundValue(1) # General foreground value is 1 (background value because of reverse stencil)
+ stencil.SetBackgroundValue(1) # General foreground value is 1 (background value because of reverse stencil)
imageToWorldMatrix = vtk.vtkMatrix4x4()
mergedImage.GetImageToWorldMatrix(imageToWorldMatrix)
@@ -481,7 +481,7 @@ def paintApply(self, viewWidget):
maskExtent = self.scriptedEffect.paintBrushesIntoLabelmap(maskImage, viewWidget)
self.scriptedEffect.clearBrushes()
self.scriptedEffect.forceRender(viewWidget)
- if maskExtent[0]>maskExtent[1] or maskExtent[2]>maskExtent[3] or maskExtent[4]>maskExtent[5]:
+ if maskExtent[0] > maskExtent[1] or maskExtent[2] > maskExtent[3] or maskExtent[4] > maskExtent[5]:
return
self.scriptedEffect.saveStateForUndo()
diff --git a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorThresholdEffect.py b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorThresholdEffect.py
index 440b39ab662..1c27c1b965a 100644
--- a/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorThresholdEffect.py
+++ b/Modules/Loadable/Segmentations/EditorEffects/Python/SegmentEditorThresholdEffect.py
@@ -62,7 +62,7 @@ def __init__(self, scriptedEffect):
def clone(self):
import qSlicerSegmentationsEditorEffectsPythonQt as effects
clonedEffect = effects.qSlicerSegmentEditorScriptedEffect(None)
- clonedEffect.setPythonSource(__file__.replace('\\','/'))
+ clonedEffect.setPythonSource(__file__.replace('\\', '/'))
return clonedEffect
def icon(self):
@@ -173,7 +173,7 @@ def setupOptionsFrame(self):
# Li sometimes crashes (index out of range error in
# ITK/Modules/Filtering/Thresholding/include/itkLiThresholdCalculator.hxx#L94)
# We can add this method back when issue is fixed in ITK.
- #self.autoThresholdMethodSelectorComboBox.addItem("Li", METHOD_LI)
+ # self.autoThresholdMethodSelectorComboBox.addItem("Li", METHOD_LI)
self.autoThresholdMethodSelectorComboBox.addItem("Maximum entropy", METHOD_MAXIMUM_ENTROPY)
self.autoThresholdMethodSelectorComboBox.addItem("Moments", METHOD_MOMENTS)
self.autoThresholdMethodSelectorComboBox.addItem("Renyi entropy", METHOD_RENYI_ENTROPY)
@@ -185,12 +185,12 @@ def setupOptionsFrame(self):
self.selectPreviousAutoThresholdButton = qt.QToolButton()
self.selectPreviousAutoThresholdButton.text = "<"
self.selectPreviousAutoThresholdButton.setToolTip("Select previous thresholding method and set thresholds."
- +" Useful for iterating through all available methods.")
+ + " Useful for iterating through all available methods.")
self.selectNextAutoThresholdButton = qt.QToolButton()
self.selectNextAutoThresholdButton.text = ">"
self.selectNextAutoThresholdButton.setToolTip("Select next thresholding method and set thresholds."
- +" Useful for iterating through all available methods.")
+ + " Useful for iterating through all available methods.")
self.setAutoThresholdButton = qt.QPushButton("Set")
self.setAutoThresholdButton.setToolTip("Set threshold using selected method.")
@@ -309,7 +309,7 @@ def setupOptionsFrame(self):
lowerGroupBox = qt.QGroupBox("Lower")
lowerHistogramLayout = qt.QHBoxLayout()
- lowerHistogramLayout.setContentsMargins(0,3,0,3)
+ lowerHistogramLayout.setContentsMargins(0, 3, 0, 3)
lowerGroupBox.setLayout(lowerHistogramLayout)
histogramItemFrame.addWidget(lowerGroupBox)
self.histogramLowerMethodButtonGroup = qt.QButtonGroup()
@@ -342,7 +342,7 @@ def setupOptionsFrame(self):
upperGroupBox = qt.QGroupBox("Upper")
upperHistogramLayout = qt.QHBoxLayout()
- upperHistogramLayout.setContentsMargins(0,3,0,3)
+ upperHistogramLayout.setContentsMargins(0, 3, 0, 3)
upperGroupBox.setLayout(upperHistogramLayout)
histogramItemFrame.addWidget(upperGroupBox)
self.histogramUpperMethodButtonGroup = qt.QButtonGroup()
@@ -403,7 +403,7 @@ def masterVolumeNodeChanged(self):
self.thresholdSlider.singleStep = (hi - lo) / 1000.
if (self.scriptedEffect.doubleParameter("MinimumThreshold") == self.scriptedEffect.doubleParameter("MaximumThreshold")):
# has not been initialized yet
- self.scriptedEffect.setParameter("MinimumThreshold", lo+(hi-lo)*0.25)
+ self.scriptedEffect.setParameter("MinimumThreshold", lo + (hi - lo) * 0.25)
self.scriptedEffect.setParameter("MaximumThreshold", hi)
def layoutChanged(self):
@@ -509,7 +509,7 @@ def updateMRMLFromGUI(self):
#
# Effect specific methods (the above ones are the API methods to override)
#
- def onThresholdValuesChanged(self,min,max):
+ def onThresholdValuesChanged(self, min, max):
self.scriptedEffect.updateMRMLFromGUI()
def onUseForPaint(self):
@@ -674,19 +674,19 @@ def preview(self):
displayNode = segmentationNode.GetDisplayNode()
if displayNode is None:
logging.error("preview: Invalid segmentation display node!")
- color = [0.5,0.5,0.5]
+ color = [0.5, 0.5, 0.5]
segmentID = self.scriptedEffect.parameterSetNode().GetSelectedSegmentID()
# Make sure we keep the currently selected segment hidden (the user may have changed selection)
if segmentID != self.previewedSegmentID:
self.setCurrentSegmentTransparent()
- r,g,b = segmentationNode.GetSegmentation().GetSegment(segmentID).GetColor()
+ r, g, b = segmentationNode.GetSegmentation().GetSegment(segmentID).GetColor()
# Set values to pipelines
for sliceWidget in self.previewPipelines:
pipeline = self.previewPipelines[sliceWidget]
- pipeline.lookupTable.SetTableValue(1, r, g, b, opacity)
+ pipeline.lookupTable.SetTableValue(1, r, g, b, opacity)
layerLogic = self.getMasterVolumeLayerLogic(sliceWidget)
pipeline.thresholdFilter.SetInputConnection(layerLogic.GetReslice().GetOutputPort())
pipeline.thresholdFilter.ThresholdBetween(min, max)
@@ -816,8 +816,8 @@ def updateHistogram(self):
brushBounds = brushPolydata.GetBounds()
brushExtent = [0, -1, 0, -1, 0, -1]
for i in range(3):
- brushExtent[2*i] = vtk.vtkMath.Floor(brushBounds[2*i])
- brushExtent[2*i+1] = vtk.vtkMath.Ceil(brushBounds[2*i+1])
+ brushExtent[2 * i] = vtk.vtkMath.Floor(brushBounds[2 * i])
+ brushExtent[2 * i + 1] = vtk.vtkMath.Ceil(brushBounds[2 * i + 1])
if brushExtent[0] > brushExtent[1] or brushExtent[2] > brushExtent[3] or brushExtent[4] > brushExtent[5]:
self.histogramFunction.RemoveAllPoints()
return
@@ -853,7 +853,7 @@ def updateHistogram(self):
self.histogramFunction.AddPoint(binSpacing * i + scalarRange[0], value)
self.histogramFunction.AdjustRange(scalarRange)
- lower = self.imageAccumulate.GetMin()[0]
+ lower = self.imageAccumulate.GetMin()[0]
average = self.imageAccumulate.GetMean()[0]
upper = self.imageAccumulate.GetMax()[0]
@@ -916,9 +916,9 @@ def updateHistogramBackground(self):
scalarRange = masterImageData.GetScalarRange()
epsilon = 0.00001
- low = self.scriptedEffect.doubleParameter("MinimumThreshold")
+ low = self.scriptedEffect.doubleParameter("MinimumThreshold")
upper = self.scriptedEffect.doubleParameter("MaximumThreshold")
- low = max(scalarRange[0] + epsilon, low)
+ low = max(scalarRange[0] + epsilon, low)
upper = min(scalarRange[1] - epsilon, upper)
self.backgroundFunction.AddRGBPoint(scalarRange[0], 1, 1, 1)
@@ -943,7 +943,7 @@ def __init__(self):
self.lookupTable.SetRampToLinear()
self.lookupTable.SetNumberOfTableValues(2)
self.lookupTable.SetTableRange(0, 1)
- self.lookupTable.SetTableValue(0, 0, 0, 0, 0)
+ self.lookupTable.SetTableValue(0, 0, 0, 0, 0)
self.colorMapper = vtk.vtkImageMapToRGBA()
self.colorMapper.SetOutputFormatToRGBA()
self.colorMapper.SetLookupTable(self.lookupTable)
@@ -1077,7 +1077,7 @@ def __init__(self, thresholdEffect, scriptedEffect, sliceWidget, brushMode):
self.actor = vtk.vtkActor2D()
self.actor.SetMapper(self.mapper)
actorProperty = self.actor.GetProperty()
- actorProperty.SetColor(1,1,0)
+ actorProperty.SetColor(1, 1, 0)
actorProperty.SetLineWidth(2)
renderer = self.scriptedEffect.renderer(sliceWidget)
if renderer is None:
@@ -1100,7 +1100,7 @@ def __init__(self, thresholdEffect, scriptedEffect, sliceWidget, brushMode):
self.thinActor = vtk.vtkActor2D()
self.thinActor.SetMapper(self.thinMapper)
thinActorProperty = self.thinActor.GetProperty()
- thinActorProperty.SetColor(1,1,0)
+ thinActorProperty.SetColor(1, 1, 0)
thinActorProperty.SetLineWidth(1)
self.scriptedEffect.addActor2D(sliceWidget, self.thinActor)
elif self.brushMode == HISTOGRAM_BRUSH_TYPE_LINE:
@@ -1155,21 +1155,21 @@ def updateBrushModel(self):
# brush is rotated to the slice widget plane
brushToWorldOriginTransformMatrix = vtk.vtkMatrix4x4()
brushToWorldOriginTransformMatrix.DeepCopy(self.sliceWidget.sliceLogic().GetSliceNode().GetSliceToRAS())
- brushToWorldOriginTransformMatrix.SetElement(0,3, 0)
- brushToWorldOriginTransformMatrix.SetElement(1,3, 0)
- brushToWorldOriginTransformMatrix.SetElement(2,3, 0)
+ brushToWorldOriginTransformMatrix.SetElement(0, 3, 0)
+ brushToWorldOriginTransformMatrix.SetElement(1, 3, 0)
+ brushToWorldOriginTransformMatrix.SetElement(2, 3, 0)
self.brushToWorldOriginTransform.Identity()
self.brushToWorldOriginTransform.Concatenate(brushToWorldOriginTransformMatrix)
- self.brushToWorldOriginTransform.RotateX(90) # cylinder's long axis is the Y axis, we need to rotate it to Z axis
+ self.brushToWorldOriginTransform.RotateX(90) # cylinder's long axis is the Y axis, we need to rotate it to Z axis
sliceSpacingMm = self.scriptedEffect.sliceSpacing(self.sliceWidget)
- center = [0,0,0]
+ center = [0, 0, 0]
if self.brushMode == HISTOGRAM_BRUSH_TYPE_CIRCLE:
center = self.point1
- point1ToPoint2 = [0,0,0]
+ point1ToPoint2 = [0, 0, 0]
vtk.vtkMath.Subtract(self.point1, self.point2, point1ToPoint2)
radius = vtk.vtkMath.Normalize(point1ToPoint2)
@@ -1180,17 +1180,17 @@ def updateBrushModel(self):
elif self.brushMode == HISTOGRAM_BRUSH_TYPE_BOX:
self.brushToWorldOriginTransformer.SetInputConnection(self.brushCubeSource.GetOutputPort())
- length = [0,0,0]
+ length = [0, 0, 0]
for i in range(3):
center[i] = (self.point1[i] + self.point2[i]) / 2.0
length[i] = abs(self.point1[i] - self.point2[i])
- xVector = [1,0,0,0]
+ xVector = [1, 0, 0, 0]
self.brushToWorldOriginTransform.MultiplyPoint(xVector, xVector)
xLength = abs(vtk.vtkMath.Dot(xVector[:3], length))
self.brushCubeSource.SetXLength(xLength)
- zVector = [0,0,1,0]
+ zVector = [0, 0, 1, 0]
self.brushToWorldOriginTransform.MultiplyPoint(zVector, zVector)
zLength = abs(vtk.vtkMath.Dot(zVector[:3], length))
self.brushCubeSource.SetZLength(zLength)
diff --git a/Modules/Loadable/Segmentations/Testing/Python/SegmentationWidgetsTest1.py b/Modules/Loadable/Segmentations/Testing/Python/SegmentationWidgetsTest1.py
index 892f88c6989..f648427a0c9 100644
--- a/Modules/Loadable/Segmentations/Testing/Python/SegmentationWidgetsTest1.py
+++ b/Modules/Loadable/Segmentations/Testing/Python/SegmentationWidgetsTest1.py
@@ -20,10 +20,10 @@ def runTest(self):
self.setUp()
self.test_SegmentationWidgetsTest1()
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def test_SegmentationWidgetsTest1(self):
# Check for modules
- self.assertIsNotNone( slicer.modules.segmentations )
+ self.assertIsNotNone(slicer.modules.segmentations)
self.TestSection_00_SetupPathsAndNames()
self.TestSection_01_GenerateInputData()
@@ -33,12 +33,12 @@ def test_SegmentationWidgetsTest1(self):
logging.info('Test finished')
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_00_SetupPathsAndNames(self):
logging.info('Test section 0: SetupPathsAndNames')
self.inputSegmentationNode = None
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_01_GenerateInputData(self):
logging.info('Test section 1: GenerateInputData')
self.inputSegmentationNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLSegmentationNode')
@@ -48,11 +48,11 @@ def TestSection_01_GenerateInputData(self):
for segmentName in ['first', 'second', 'third']:
sphereSegment = slicer.vtkSegment()
sphereSegment.SetName(segmentName)
- sphereSegment.SetColor(random.uniform(0.0,1.0), random.uniform(0.0,1.0), random.uniform(0.0,1.0))
+ sphereSegment.SetColor(random.uniform(0.0, 1.0), random.uniform(0.0, 1.0), random.uniform(0.0, 1.0))
sphere = vtk.vtkSphereSource()
- sphere.SetCenter(random.uniform(0,100),random.uniform(0,100),random.uniform(0,100))
- sphere.SetRadius(random.uniform(20,30))
+ sphere.SetCenter(random.uniform(0, 100), random.uniform(0, 100), random.uniform(0, 100))
+ sphere.SetRadius(random.uniform(20, 30))
sphere.Update()
spherePolyData = sphere.GetOutput()
sphereSegment.AddRepresentation(
@@ -67,7 +67,7 @@ def TestSection_01_GenerateInputData(self):
displayNode = self.inputSegmentationNode.GetDisplayNode()
self.assertIsNotNone(displayNode)
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_02_qMRMLSegmentsTableView(self):
logging.info('Test section 2: qMRMLSegmentsTableView')
@@ -123,7 +123,7 @@ def TestSection_02_qMRMLSegmentsTableView(self):
self.inputSegmentationNode.SetSegmentListFilterEnabled(False)
self.inputSegmentationNode.SetSegmentListFilterOptions("")
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def compareOutputGeometry(self, orientedImageData, spacing, origin, directions):
if orientedImageData is None:
logging.error('Invalid input oriented image data')
@@ -141,22 +141,22 @@ def compareOutputGeometry(self, orientedImageData, spacing, origin, directions):
tolerance = 0.0001
actualSpacing = orientedImageData.GetSpacing()
actualOrigin = orientedImageData.GetOrigin()
- actualDirections = [[0]*3,[0]*3,[0]*3]
+ actualDirections = [[0] * 3, [0] * 3, [0] * 3]
orientedImageData.GetDirections(actualDirections)
- for i in [0,1,2]:
+ for i in [0, 1, 2]:
if not numpy.isclose(spacing[i], actualSpacing[i], tolerance):
logging.warning('Spacing discrepancy: ' + str(spacing) + ' != ' + str(actualSpacing))
return False
if not numpy.isclose(origin[i], actualOrigin[i], tolerance):
logging.warning('Origin discrepancy: ' + str(origin) + ' != ' + str(actualOrigin))
return False
- for j in [0,1,2]:
+ for j in [0, 1, 2]:
if not numpy.isclose(directions[i][j], actualDirections[i][j], tolerance):
logging.warning('Directions discrepancy: ' + str(directions) + ' != ' + str(actualDirections))
return False
return True
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def getForegroundVoxelCount(self, imageData):
if imageData is None:
logging.error('Invalid input image data')
@@ -167,7 +167,7 @@ def getForegroundVoxelCount(self, imageData):
imageAccumulate.Update()
return imageAccumulate.GetVoxelCount()
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_03_qMRMLSegmentationGeometryWidget(self):
logging.info('Test section 2: qMRMLSegmentationGeometryWidget')
@@ -205,7 +205,7 @@ def TestSection_03_qMRMLSegmentationGeometryWidget(self):
segmentOrientedImageData.SetImageToWorldMatrix(mrImageToWorldMatrix)
segment = slicer.vtkSegment()
segment.SetName('Brain')
- segment.SetColor(0.0,0.0,1.0)
+ segment.SetColor(0.0, 0.0, 1.0)
segment.AddRepresentation(binaryLabelmapReprName, segmentOrientedImageData)
segmentationNode.GetSegmentation().AddSegment(segment)
@@ -213,13 +213,13 @@ def TestSection_03_qMRMLSegmentationGeometryWidget(self):
geometryWidget = slicer.qMRMLSegmentationGeometryWidget()
geometryWidget.setSegmentationNode(segmentationNode)
geometryWidget.editEnabled = True
- geometryImageData = slicer.vtkOrientedImageData() # To contain the output later
+ geometryImageData = slicer.vtkOrientedImageData() # To contain the output later
# Volume source with no transforms
geometryWidget.setSourceNode(tinyVolumeNode)
geometryWidget.geometryImageData(geometryImageData)
self.assertTrue(self.compareOutputGeometry(geometryImageData,
- (49,49,23), (248.8439, 248.2890, -123.75),
+ (49, 49, 23), (248.8439, 248.2890, -123.75),
[[-1.0, 0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, 1.0]]))
slicer.vtkOrientedImageDataResample.ResampleOrientedImageToReferenceOrientedImage(
segmentOrientedImageData, geometryImageData, geometryImageData, False, True)
@@ -227,9 +227,9 @@ def TestSection_03_qMRMLSegmentationGeometryWidget(self):
# Transformed volume source
translationTransformMatrix = vtk.vtkMatrix4x4()
- translationTransformMatrix.SetElement(0,3,24.5)
- translationTransformMatrix.SetElement(1,3,24.5)
- translationTransformMatrix.SetElement(2,3,11.5)
+ translationTransformMatrix.SetElement(0, 3, 24.5)
+ translationTransformMatrix.SetElement(1, 3, 24.5)
+ translationTransformMatrix.SetElement(2, 3, 11.5)
translationTransformNode = slicer.vtkMRMLLinearTransformNode()
translationTransformNode.SetName('TestTranslation')
slicer.mrmlScene.AddNode(translationTransformNode)
@@ -238,7 +238,7 @@ def TestSection_03_qMRMLSegmentationGeometryWidget(self):
tinyVolumeNode.SetAndObserveTransformNodeID(translationTransformNode.GetID())
geometryWidget.geometryImageData(geometryImageData)
self.assertTrue(self.compareOutputGeometry(geometryImageData,
- (49,49,23), (273.3439, 272.7890, -112.25),
+ (49, 49, 23), (273.3439, 272.7890, -112.25),
[[-1.0, 0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, 1.0]]))
slicer.vtkOrientedImageDataResample.ResampleOrientedImageToReferenceOrientedImage(
segmentOrientedImageData, geometryImageData, geometryImageData, False, True)
@@ -249,7 +249,7 @@ def TestSection_03_qMRMLSegmentationGeometryWidget(self):
geometryWidget.setIsotropicSpacing(True)
geometryWidget.geometryImageData(geometryImageData)
self.assertTrue(self.compareOutputGeometry(geometryImageData,
- (23,23,23), (248.8439, 248.2890, -123.75),
+ (23, 23, 23), (248.8439, 248.2890, -123.75),
[[-1.0, 0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, 1.0]]))
slicer.vtkOrientedImageDataResample.ResampleOrientedImageToReferenceOrientedImage(
segmentOrientedImageData, geometryImageData, geometryImageData, False, True)
@@ -272,7 +272,7 @@ def TestSection_03_qMRMLSegmentationGeometryWidget(self):
geometryWidget.setSourceNode(tinySegmentationNode)
geometryWidget.geometryImageData(geometryImageData)
self.assertTrue(self.compareOutputGeometry(geometryImageData,
- (49,49,23), (248.8439, 248.2890, -123.75),
+ (49, 49, 23), (248.8439, 248.2890, -123.75),
[[-1.0, 0.0, 0.0], [0.0, -1.0, 0.0], [0.0, 0.0, 1.0]]))
slicer.vtkOrientedImageDataResample.ResampleOrientedImageToReferenceOrientedImage(
segmentOrientedImageData, geometryImageData, geometryImageData, False, True)
@@ -282,10 +282,10 @@ def TestSection_03_qMRMLSegmentationGeometryWidget(self):
tinySegmentationNode.GetSegmentation().SetConversionParameter('Smoothing factor', '0.0')
self.assertTrue(tinySegmentationNode.GetSegmentation().CreateRepresentation(closedSurfaceReprName))
tinySegmentationNode.GetSegmentation().SetMasterRepresentationName(closedSurfaceReprName)
- tinySegmentationNode.Modified() # Trigger re-calculation of geometry (only generic Modified event is observed)
+ tinySegmentationNode.Modified() # Trigger re-calculation of geometry (only generic Modified event is observed)
geometryWidget.geometryImageData(geometryImageData)
self.assertTrue(self.compareOutputGeometry(geometryImageData,
- (1,1,1), (-86.645, 133.929, 116.786), # current origin of the segmentation is kept
+ (1, 1, 1), (-86.645, 133.929, 116.786), # current origin of the segmentation is kept
[[0.0, 0.0, 1.0], [-1.0, 0.0, 0.0], [0.0, -1.0, 0.0]]))
slicer.vtkOrientedImageDataResample.ResampleOrientedImageToReferenceOrientedImage(
segmentOrientedImageData, geometryImageData, geometryImageData, False, True)
@@ -296,13 +296,13 @@ def TestSection_03_qMRMLSegmentationGeometryWidget(self):
shNode = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)
outputFolderId = shNode.CreateFolderItem(shNode.GetSceneItemID(), 'ModelsFolder')
success = vtkSlicerSegmentationsModuleLogic.vtkSlicerSegmentationsModuleLogic.ExportVisibleSegmentsToModels(
- tinySegmentationNode, outputFolderId )
+ tinySegmentationNode, outputFolderId)
self.assertTrue(success)
modelNode = slicer.util.getNode('Body_Contour')
geometryWidget.setSourceNode(modelNode)
geometryWidget.geometryImageData(geometryImageData)
self.assertTrue(self.compareOutputGeometry(geometryImageData,
- (1,1,1), (-86.645, 133.929, 116.786), # current origin of the segmentation is kept
+ (1, 1, 1), (-86.645, 133.929, 116.786), # current origin of the segmentation is kept
[[0.0, 0.0, 1.0], [-1.0, 0.0, 0.0], [0.0, -1.0, 0.0]]))
slicer.vtkOrientedImageDataResample.ResampleOrientedImageToReferenceOrientedImage(
segmentOrientedImageData, geometryImageData, geometryImageData, False, True)
@@ -323,7 +323,7 @@ def TestSection_03_qMRMLSegmentationGeometryWidget(self):
modelNode.Modified()
geometryWidget.geometryImageData(geometryImageData)
self.assertTrue(self.compareOutputGeometry(geometryImageData,
- (1,1,1), (-86.645, 177.282, -12.122),
+ (1, 1, 1), (-86.645, 177.282, -12.122),
[[0.0, 0.0, 1.0], [-0.7071, -0.7071, 0.0], [0.7071, -0.7071, 0.0]]))
slicer.vtkOrientedImageDataResample.ResampleOrientedImageToReferenceOrientedImage(
segmentOrientedImageData, geometryImageData, geometryImageData, False, True)
@@ -336,14 +336,14 @@ def TestSection_03_qMRMLSegmentationGeometryWidget(self):
rasCenter = [0.0, 0.0, 0.0]
slicer.vtkMRMLSliceLogic.GetVolumeRASBox(tinyVolumeNode, rasDimensions, rasCenter)
print(f"rasDimensions={rasDimensions}, rasCenter={rasCenter}")
- rasRadius = [x/2.0 for x in rasDimensions]
+ rasRadius = [x / 2.0 for x in rasDimensions]
roiNode.SetCenter(rasCenter)
roiNode.SetRadiusXYZ(rasRadius)
geometryWidget.setSourceNode(roiNode)
geometryWidget.geometryImageData(geometryImageData)
print(f"geometryImageData: {geometryImageData}")
self.assertTrue(self.compareOutputGeometry(geometryImageData,
- (1,1,1), (28.344, 27.789, -20.25),
+ (1, 1, 1), (28.344, 27.789, -20.25),
[[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]))
slicer.vtkOrientedImageDataResample.ResampleOrientedImageToReferenceOrientedImage(
segmentOrientedImageData, geometryImageData, geometryImageData, False, True)
@@ -352,7 +352,7 @@ def TestSection_03_qMRMLSegmentationGeometryWidget(self):
slicer.util.delayDisplay('Segmentation geometry widget test passed')
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_04_qMRMLSegmentEditorWidget(self):
logging.info('Test section 4: qMRMLSegmentEditorWidget')
@@ -395,11 +395,11 @@ def TestSection_04_qMRMLSegmentEditorWidget(self):
slicer.util.delayDisplay("Next segment (with second segment hidden)")
# Trying to go out of bounds past first segment
- segmentEditorWidget.selectPreviousSegment() #First
+ segmentEditorWidget.selectPreviousSegment() # First
self.assertEqual(self.segmentEditorNode.GetSelectedSegmentID(), 'first')
- segmentEditorWidget.selectPreviousSegment() #First
+ segmentEditorWidget.selectPreviousSegment() # First
self.assertEqual(self.segmentEditorNode.GetSelectedSegmentID(), 'first')
- segmentEditorWidget.selectPreviousSegment() #First
+ segmentEditorWidget.selectPreviousSegment() # First
self.assertEqual(self.segmentEditorNode.GetSelectedSegmentID(), 'first')
slicer.app.processEvents()
slicer.util.delayDisplay("Multiple previous segment")
diff --git a/Modules/Loadable/Segmentations/Testing/Python/SegmentationsModuleTest1.py b/Modules/Loadable/Segmentations/Testing/Python/SegmentationsModuleTest1.py
index be35833d22c..1c51f1a3255 100644
--- a/Modules/Loadable/Segmentations/Testing/Python/SegmentationsModuleTest1.py
+++ b/Modules/Loadable/Segmentations/Testing/Python/SegmentationsModuleTest1.py
@@ -23,10 +23,10 @@ def runTest(self):
self.setUp()
self.test_SegmentationsModuleTest1()
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def test_SegmentationsModuleTest1(self):
# Check for modules
- self.assertIsNotNone( slicer.modules.segmentations )
+ self.assertIsNotNone(slicer.modules.segmentations)
self.TestSection_SetupPathsAndNames()
self.TestSection_RetrieveInputData()
@@ -39,7 +39,7 @@ def test_SegmentationsModuleTest1(self):
logging.info('Test finished')
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_SetupPathsAndNames(self):
# Set up paths used for this test
self.segmentationsModuleTestDir = slicer.app.temporaryPath + '/SegmentationsModuleTest'
@@ -65,7 +65,7 @@ def TestSection_SetupPathsAndNames(self):
self.closedSurfaceReprName = vtkSegmentationCore.vtkSegmentationConverter.GetSegmentationClosedSurfaceRepresentationName()
self.binaryLabelmapReprName = vtkSegmentationCore.vtkSegmentationConverter.GetSegmentationBinaryLabelmapRepresentationName()
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_RetrieveInputData(self):
try:
slicer.util.downloadAndExtractArchive(
@@ -74,17 +74,17 @@ def TestSection_RetrieveInputData(self):
checksum='SHA256:b902f635ef2059cd3b4ba854c000b388e4a9e817a651f28be05c22511a317ec7')
numOfFilesInDataDirTest = len([name for name in os.listdir(self.dataDir) if os.path.isfile(self.dataDir + '/' + name)])
- self.assertEqual( numOfFilesInDataDirTest, self.expectedNumOfFilesInDataDir )
- self.assertTrue( os.access(self.dataSegDir, os.F_OK) )
+ self.assertEqual(numOfFilesInDataDirTest, self.expectedNumOfFilesInDataDir)
+ self.assertTrue(os.access(self.dataSegDir, os.F_OK))
numOfFilesInDataSegDirTest = len([name for name in os.listdir(self.dataSegDir) if os.path.isfile(self.dataSegDir + '/' + name)])
- self.assertEqual( numOfFilesInDataSegDirTest, self.expectedNumOfFilesInDataSegDir )
+ self.assertEqual(numOfFilesInDataSegDirTest, self.expectedNumOfFilesInDataSegDir)
except Exception as e:
import traceback
traceback.print_exc()
logging.error('Test caused exception!\n' + str(e))
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_LoadInputData(self):
# Load into Slicer
slicer.util.loadVolume(self.dataDir + '/TinyPatient_CT.nrrd')
@@ -94,7 +94,7 @@ def TestSection_LoadInputData(self):
self.inputSegmentationNode = slicer.util.getNode('vtkMRMLSegmentationNode1')
self.inputSegmentationNode.GetSegmentation().SetMasterRepresentationName(self.closedSurfaceReprName)
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_AddRemoveSegment(self):
# Add/remove segment from segmentation (check display properties, color table, etc.)
logging.info('Test section: Add/remove segment')
@@ -105,18 +105,18 @@ def TestSection_AddRemoveSegment(self):
# If segments are not found then the returned color is the pre-defined invalid color
bodyColor = self.inputSegmentationNode.GetSegmentation().GetSegment(self.bodySegmentName).GetColor()
logging.info(f"bodyColor: {bodyColor}")
- self.assertEqual(int(bodyColor[0]*100), 33)
- self.assertEqual(int(bodyColor[1]*100), 66)
- self.assertEqual(int(bodyColor[2]*100), 0)
+ self.assertEqual(int(bodyColor[0] * 100), 33)
+ self.assertEqual(int(bodyColor[1] * 100), 66)
+ self.assertEqual(int(bodyColor[2] * 100), 0)
tumorColor = self.inputSegmentationNode.GetSegmentation().GetSegment(self.tumorSegmentName).GetColor()
logging.info(f"tumorColor: {tumorColor}")
- self.assertEqual(int(tumorColor[0]*100), 100)
- self.assertEqual(int(tumorColor[1]*100), 0)
- self.assertEqual(int(tumorColor[2]*100), 0)
+ self.assertEqual(int(tumorColor[0] * 100), 100)
+ self.assertEqual(int(tumorColor[1] * 100), 0)
+ self.assertEqual(int(tumorColor[2] * 100), 0)
# Create new segment
sphere = vtk.vtkSphereSource()
- sphere.SetCenter(0,50,0)
+ sphere.SetCenter(0, 50, 0)
sphere.SetRadius(80)
sphere.Update()
spherePolyData = vtk.vtkPolyData()
@@ -124,7 +124,7 @@ def TestSection_AddRemoveSegment(self):
self.sphereSegment = vtkSegmentationCore.vtkSegment()
self.sphereSegment.SetName(self.sphereSegmentName)
- self.sphereSegment.SetColor(0.0,0.0,1.0)
+ self.sphereSegment.SetColor(0.0, 0.0, 1.0)
self.sphereSegment.AddRepresentation(self.closedSurfaceReprName, spherePolyData)
# Add segment to segmentation
@@ -137,18 +137,18 @@ def TestSection_AddRemoveSegment(self):
self.inputSegmentationNode.GenerateMergedLabelmapForAllSegments(mergedLabelmap, 0)
imageStat = vtk.vtkImageAccumulate()
imageStat.SetInputData(mergedLabelmap)
- imageStat.SetComponentExtent(0,4,0,0,0,0)
- imageStat.SetComponentOrigin(0,0,0)
- imageStat.SetComponentSpacing(1,1,1)
+ imageStat.SetComponentExtent(0, 4, 0, 0, 0, 0)
+ imageStat.SetComponentOrigin(0, 0, 0)
+ imageStat.SetComponentSpacing(1, 1, 1)
imageStat.Update()
imageStatResult = imageStat.GetOutput()
for i in range(4):
logging.info(f"Volume {i}: {imageStatResult.GetScalarComponentAsDouble(i,0,0,0)}")
self.assertEqual(imageStat.GetVoxelCount(), 1000)
- self.assertEqual(imageStatResult.GetScalarComponentAsDouble(0,0,0,0), 786)
- self.assertEqual(imageStatResult.GetScalarComponentAsDouble(1,0,0,0), 170)
- self.assertEqual(imageStatResult.GetScalarComponentAsDouble(2,0,0,0), 4)
- self.assertEqual(imageStatResult.GetScalarComponentAsDouble(3,0,0,0), 40)
+ self.assertEqual(imageStatResult.GetScalarComponentAsDouble(0, 0, 0, 0), 786)
+ self.assertEqual(imageStatResult.GetScalarComponentAsDouble(1, 0, 0, 0), 170)
+ self.assertEqual(imageStatResult.GetScalarComponentAsDouble(2, 0, 0, 0), 4)
+ self.assertEqual(imageStatResult.GetScalarComponentAsDouble(3, 0, 0, 0), 40)
# Check if segment reorder is taken into account in merged labelmap generation
# Change segment order
@@ -162,16 +162,16 @@ def TestSection_AddRemoveSegment(self):
for i in range(4):
logging.info(f"Volume {i}: {imageStatResult.GetScalarComponentAsDouble(i,0,0,0)}")
self.assertEqual(imageStat.GetVoxelCount(), 1000)
- self.assertEqual(imageStatResult.GetScalarComponentAsDouble(0,0,0,0), 786)
- self.assertEqual(imageStatResult.GetScalarComponentAsDouble(1,0,0,0), 170)
- self.assertEqual(imageStatResult.GetScalarComponentAsDouble(2,0,0,0), 39)
- self.assertEqual(imageStatResult.GetScalarComponentAsDouble(3,0,0,0), 5)
+ self.assertEqual(imageStatResult.GetScalarComponentAsDouble(0, 0, 0, 0), 786)
+ self.assertEqual(imageStatResult.GetScalarComponentAsDouble(1, 0, 0, 0), 170)
+ self.assertEqual(imageStatResult.GetScalarComponentAsDouble(2, 0, 0, 0), 39)
+ self.assertEqual(imageStatResult.GetScalarComponentAsDouble(3, 0, 0, 0), 5)
# Remove segment from segmentation
self.inputSegmentationNode.GetSegmentation().RemoveSegment(self.sphereSegmentName)
self.assertEqual(self.inputSegmentationNode.GetSegmentation().GetNumberOfSegments(), 2)
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_MergeLabelmapWithDifferentGeometries(self):
# Merge labelmap when segments containing labelmaps with different geometries (both same directions, different directions)
logging.info('Test section: Merge labelmap with different geometries')
@@ -215,21 +215,21 @@ def TestSection_MergeLabelmapWithDifferentGeometries(self):
imageStat = vtk.vtkImageAccumulate()
imageStat.SetInputData(mergedLabelmap)
- imageStat.SetComponentExtent(0,5,0,0,0,0)
- imageStat.SetComponentOrigin(0,0,0)
- imageStat.SetComponentSpacing(1,1,1)
+ imageStat.SetComponentExtent(0, 5, 0, 0, 0, 0)
+ imageStat.SetComponentOrigin(0, 0, 0)
+ imageStat.SetComponentSpacing(1, 1, 1)
imageStat.Update()
imageStatResult = imageStat.GetOutput()
for i in range(5):
logging.info(f"Volume {i}: {imageStatResult.GetScalarComponentAsDouble(i,0,0,0)}")
self.assertEqual(imageStat.GetVoxelCount(), 226981000)
- self.assertEqual(imageStatResult.GetScalarComponentAsDouble(0,0,0,0), 178838889)
- self.assertEqual(imageStatResult.GetScalarComponentAsDouble(1,0,0,0), 39705288)
- self.assertEqual(imageStatResult.GetScalarComponentAsDouble(2,0,0,0), 890883)
- self.assertEqual(imageStatResult.GetScalarComponentAsDouble(3,0,0,0), 7545940)
- self.assertEqual(imageStatResult.GetScalarComponentAsDouble(4,0,0,0), 0) # Built from color table and color four is removed in previous test section
+ self.assertEqual(imageStatResult.GetScalarComponentAsDouble(0, 0, 0, 0), 178838889)
+ self.assertEqual(imageStatResult.GetScalarComponentAsDouble(1, 0, 0, 0), 39705288)
+ self.assertEqual(imageStatResult.GetScalarComponentAsDouble(2, 0, 0, 0), 890883)
+ self.assertEqual(imageStatResult.GetScalarComponentAsDouble(3, 0, 0, 0), 7545940)
+ self.assertEqual(imageStatResult.GetScalarComponentAsDouble(4, 0, 0, 0), 0) # Built from color table and color four is removed in previous test section
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_ImportExportSegment(self):
# Import/export, both one label and all labels
logging.info('Test section: Import/export segment')
@@ -243,11 +243,11 @@ def TestSection_ImportExportSegment(self):
result = slicer.vtkSlicerSegmentationsModuleLogic.ExportSegmentToRepresentationNode(bodySegment, bodyModelNode)
self.assertTrue(result)
self.assertIsNotNone(bodyModelNode.GetPolyData())
- #TODO: Number of points increased to 1677 due to end-capping, need to investigate!
- #self.assertEqual(bodyModelNode.GetPolyData().GetNumberOfPoints(), 302)
- #TODO: On Linux and Windows it is 588, on Mac it is 580. Need to investigate
+ # TODO: Number of points increased to 1677 due to end-capping, need to investigate!
+ # self.assertEqual(bodyModelNode.GetPolyData().GetNumberOfPoints(), 302)
+ # TODO: On Linux and Windows it is 588, on Mac it is 580. Need to investigate
# self.assertEqual(bodyModelNode.GetPolyData().GetNumberOfCells(), 588)
- #self.assertTrue(bodyModelNode.GetPolyData().GetNumberOfCells() == 588 or bodyModelNode.GetPolyData().GetNumberOfCells() == 580)
+ # self.assertTrue(bodyModelNode.GetPolyData().GetNumberOfCells() == 588 or bodyModelNode.GetPolyData().GetNumberOfCells() == 580)
# Export single segment to volume node
bodyLabelmapNode = slicer.vtkMRMLLabelMapVolumeNode()
@@ -274,23 +274,23 @@ def TestSection_ImportExportSegment(self):
self.assertIsNotNone(allSegmentsImageData)
imageStat = vtk.vtkImageAccumulate()
imageStat.SetInputData(allSegmentsImageData)
- imageStat.SetComponentExtent(0,5,0,0,0,0)
- imageStat.SetComponentOrigin(0,0,0)
- imageStat.SetComponentSpacing(1,1,1)
+ imageStat.SetComponentExtent(0, 5, 0, 0, 0, 0)
+ imageStat.SetComponentOrigin(0, 0, 0)
+ imageStat.SetComponentSpacing(1, 1, 1)
imageStat.Update()
imageStatResult = imageStat.GetOutput()
for i in range(4):
logging.info(f"Volume {i}: {imageStatResult.GetScalarComponentAsDouble(i,0,0,0)}")
self.assertEqual(imageStat.GetVoxelCount(), 127109360)
- self.assertEqual(imageStatResult.GetScalarComponentAsDouble(0,0,0,0), 78967249)
- self.assertEqual(imageStatResult.GetScalarComponentAsDouble(1,0,0,0), 39705288)
- self.assertEqual(imageStatResult.GetScalarComponentAsDouble(2,0,0,0), 890883)
- self.assertEqual(imageStatResult.GetScalarComponentAsDouble(3,0,0,0), 7545940)
+ self.assertEqual(imageStatResult.GetScalarComponentAsDouble(0, 0, 0, 0), 78967249)
+ self.assertEqual(imageStatResult.GetScalarComponentAsDouble(1, 0, 0, 0), 39705288)
+ self.assertEqual(imageStatResult.GetScalarComponentAsDouble(2, 0, 0, 0), 890883)
+ self.assertEqual(imageStatResult.GetScalarComponentAsDouble(3, 0, 0, 0), 7545940)
# Import model to segment
modelImportSegmentationNode = slicer.mrmlScene.AddNewNodeByClass('vtkMRMLSegmentationNode', 'ModelImport')
modelImportSegmentationNode.GetSegmentation().SetMasterRepresentationName(self.closedSurfaceReprName)
modelSegment = slicer.vtkSlicerSegmentationsModuleLogic.CreateSegmentFromModelNode(bodyModelNode)
- modelSegment.UnRegister(None) # Need to release ownership
+ modelSegment.UnRegister(None) # Need to release ownership
self.assertIsNotNone(modelSegment)
self.assertIsNotNone(modelSegment.GetRepresentation(self.closedSurfaceReprName))
@@ -319,7 +319,7 @@ def TestSection_ImportExportSegment(self):
threshold.Update()
allSegmentsLabelmapNode.GetImageData().ShallowCopy(threshold.GetOutput())
labelSegment = slicer.vtkSlicerSegmentationsModuleLogic.CreateSegmentFromLabelmapVolumeNode(allSegmentsLabelmapNode)
- labelSegment.UnRegister(None) # Need to release ownership
+ labelSegment.UnRegister(None) # Need to release ownership
self.assertIsNotNone(labelSegment)
self.assertIsNotNone(labelSegment.GetRepresentation(self.binaryLabelmapReprName))
@@ -365,7 +365,7 @@ def TestSection_ImportExportSegment(self):
modelTransformedImportSegmentationNode.GetSegmentation().SetMasterRepresentationName(self.closedSurfaceReprName)
modelTransformedImportSegmentationNode.SetAndObserveTransformNodeID(modelTransformedImportSegmentationTransformNode.GetID())
modelSegmentTranformed = slicer.vtkSlicerSegmentationsModuleLogic.CreateSegmentFromModelNode(bodyModelNodeTransformed, modelTransformedImportSegmentationNode)
- modelSegmentTranformed.UnRegister(None) # Need to release ownership
+ modelSegmentTranformed.UnRegister(None) # Need to release ownership
self.assertIsNotNone(modelSegmentTranformed)
modelSegmentTransformedPolyData = modelSegmentTranformed.GetRepresentation(self.closedSurfaceReprName)
self.assertIsNotNone(modelSegmentTransformedPolyData)
@@ -461,48 +461,48 @@ def TestSection_ImportExportSegment2(self):
slicer.mrmlScene.RemoveNode(tumorLabelmapNode)
slicer.mrmlScene.RemoveNode(singleLabelImportSegmentationNode)
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_SubjectHierarchy(self):
# Subject hierarchy plugin: item creation, removal, renaming
logging.info('Test section: Subject hierarchy')
shNode = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)
- self.assertIsNotNone( shNode )
+ self.assertIsNotNone(shNode)
# Check if subject hierarchy items have been created
segmentationShItemID = shNode.GetItemByDataNode(self.inputSegmentationNode)
- self.assertIsNotNone( segmentationShItemID )
+ self.assertIsNotNone(segmentationShItemID)
bodyItemID = shNode.GetItemChildWithName(segmentationShItemID, self.bodySegmentName)
- self.assertIsNotNone( bodyItemID )
- tumorItemID = shNode.GetItemChildWithName(segmentationShItemID, self.tumorSegmentName)
- self.assertIsNotNone( tumorItemID )
- sphereItemID = shNode.GetItemChildWithName(segmentationShItemID, self.sphereSegmentName)
- self.assertIsNotNone( sphereItemID )
+ self.assertIsNotNone(bodyItemID)
+ tumorItemID = shNode.GetItemChildWithName(segmentationShItemID, self.tumorSegmentName)
+ self.assertIsNotNone(tumorItemID)
+ sphereItemID = shNode.GetItemChildWithName(segmentationShItemID, self.sphereSegmentName)
+ self.assertIsNotNone(sphereItemID)
# Rename segment
bodySegment = self.inputSegmentationNode.GetSegmentation().GetSegment(self.bodySegmentName)
bodySegment.SetName('Body')
qt.QApplication.processEvents()
- self.assertEqual( shNode.GetItemName(bodyItemID), 'Body')
+ self.assertEqual(shNode.GetItemName(bodyItemID), 'Body')
tumorSegment = self.inputSegmentationNode.GetSegmentation().GetSegment(self.tumorSegmentName)
shNode.SetItemName(tumorItemID, 'Tumor')
qt.QApplication.processEvents()
- self.assertEqual( tumorSegment.GetName(), 'Tumor')
+ self.assertEqual(tumorSegment.GetName(), 'Tumor')
# Remove segment
self.inputSegmentationNode.GetSegmentation().RemoveSegment(bodySegment)
qt.QApplication.processEvents()
logging.info('(The error messages below are results of testing invalidity of objects, they are supposed to appear)')
- self.assertEqual( shNode.GetItemChildWithName(segmentationShItemID, 'Body'), 0)
- self.assertEqual( self.inputSegmentationNode.GetSegmentation().GetNumberOfSegments(), 2)
+ self.assertEqual(shNode.GetItemChildWithName(segmentationShItemID, 'Body'), 0)
+ self.assertEqual(self.inputSegmentationNode.GetSegmentation().GetNumberOfSegments(), 2)
shNode.RemoveItem(tumorItemID)
qt.QApplication.processEvents()
- self.assertEqual( self.inputSegmentationNode.GetSegmentation().GetNumberOfSegments(), 1 )
+ self.assertEqual(self.inputSegmentationNode.GetSegmentation().GetNumberOfSegments(), 1)
# Remove segmentation
slicer.mrmlScene.RemoveNode(self.inputSegmentationNode)
- self.assertEqual( shNode.GetItemName(segmentationShItemID), '')
- self.assertEqual( shNode.GetItemName(sphereItemID), '')
+ self.assertEqual(shNode.GetItemName(segmentationShItemID), '')
+ self.assertEqual(shNode.GetItemName(sphereItemID), '')
diff --git a/Modules/Loadable/Segmentations/Testing/Python/SegmentationsModuleTest2.py b/Modules/Loadable/Segmentations/Testing/Python/SegmentationsModuleTest2.py
index ff919dc8bb8..e9aa3eab3c9 100644
--- a/Modules/Loadable/Segmentations/Testing/Python/SegmentationsModuleTest2.py
+++ b/Modules/Loadable/Segmentations/Testing/Python/SegmentationsModuleTest2.py
@@ -18,24 +18,24 @@
class SegmentationsModuleTest2(unittest.TestCase):
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def setUp(self):
""" Do whatever is needed to reset the state - typically a scene clear will be enough.
"""
slicer.mrmlScene.Clear(0)
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def runTest(self):
"""Run as few or as many tests as needed here.
"""
self.setUp()
self.test_SegmentationsModuleTest2()
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def test_SegmentationsModuleTest2(self):
# Check for modules
- self.assertIsNotNone( slicer.modules.segmentations )
- self.assertIsNotNone( slicer.modules.segmenteditor )
+ self.assertIsNotNone(slicer.modules.segmentations)
+ self.assertIsNotNone(slicer.modules.segmenteditor)
# Run tests
self.TestSection_SetupPathsAndNames()
@@ -47,7 +47,7 @@ def test_SegmentationsModuleTest2(self):
self.TestSection_MaskingSettings()
logging.info('Test finished')
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_SetupPathsAndNames(self):
# Set up paths used for this test
self.segmentationsModuleTestDir = slicer.app.temporaryPath + '/SegmentationsModuleTest'
@@ -67,7 +67,7 @@ def TestSection_SetupPathsAndNames(self):
self.closedSurfaceReprName = vtkSegmentationCore.vtkSegmentationConverter.GetSegmentationClosedSurfaceRepresentationName()
self.binaryLabelmapReprName = vtkSegmentationCore.vtkSegmentationConverter.GetSegmentationBinaryLabelmapRepresentationName()
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_RetrieveInputData(self):
try:
slicer.util.downloadAndExtractArchive(
@@ -76,17 +76,17 @@ def TestSection_RetrieveInputData(self):
checksum='SHA256:b902f635ef2059cd3b4ba854c000b388e4a9e817a651f28be05c22511a317ec7')
numOfFilesInDataDirTest = len([name for name in os.listdir(self.dataDir) if os.path.isfile(self.dataDir + '/' + name)])
- self.assertEqual( numOfFilesInDataDirTest, self.expectedNumOfFilesInDataDir )
- self.assertTrue( os.access(self.dataSegDir, os.F_OK) )
+ self.assertEqual(numOfFilesInDataDirTest, self.expectedNumOfFilesInDataDir)
+ self.assertTrue(os.access(self.dataSegDir, os.F_OK))
numOfFilesInDataSegDirTest = len([name for name in os.listdir(self.dataSegDir) if os.path.isfile(self.dataSegDir + '/' + name)])
- self.assertEqual( numOfFilesInDataSegDirTest, self.expectedNumOfFilesInDataSegDir )
+ self.assertEqual(numOfFilesInDataSegDirTest, self.expectedNumOfFilesInDataSegDir)
except Exception as e:
import traceback
traceback.print_exc()
logging.error('Test caused exception!\n' + str(e))
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_SetupScene(self):
self.paintEffect = slicer.modules.segmenteditor.widgetRepresentation().self().editor.effectByName("Paint")
self.eraseEffect = slicer.modules.segmenteditor.widgetRepresentation().self().editor.effectByName("Erase")
@@ -108,7 +108,7 @@ def TestSection_SetupScene(self):
self.segmentation.SetMasterRepresentationName(self.binaryLabelmapReprName)
self.assertIsNotNone(self.segmentation)
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_SharedLabelmapMultipleLayerEditing(self):
self.segmentation.RemoveAllSegments()
self.segmentation.AddEmptySegment("Segment_1")
@@ -144,7 +144,7 @@ def TestSection_SharedLabelmapMultipleLayerEditing(self):
self.segmentEditorNode.SetOverwriteMode(oldOverwriteMode)
logging.info('Multiple layer editing successful')
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_IslandEffects(self):
islandSizes = [1, 26, 11, 6, 8, 6, 2]
islandSizes.sort(reverse=True)
@@ -152,7 +152,7 @@ def TestSection_IslandEffects(self):
minimumSize = 3
self.resetIslandSegments(islandSizes)
self.islandEffect.setParameter('MinimumSize', minimumSize)
- self.islandEffect.setParameter('Operation','KEEP_LARGEST_ISLAND')
+ self.islandEffect.setParameter('Operation', 'KEEP_LARGEST_ISLAND')
self.islandEffect.self().onApply()
layerCount = self.segmentation.GetNumberOfLayers()
self.assertEqual(layerCount, 1)
@@ -167,7 +167,7 @@ def TestSection_IslandEffects(self):
minimumSize = 7
self.resetIslandSegments(islandSizes)
self.islandEffect.setParameter('MinimumSize', minimumSize)
- self.islandEffect.setParameter('Operation','REMOVE_SMALL_ISLANDS')
+ self.islandEffect.setParameter('Operation', 'REMOVE_SMALL_ISLANDS')
self.islandEffect.self().onApply()
layerCount = self.segmentation.GetNumberOfLayers()
self.assertEqual(layerCount, 1)
@@ -182,7 +182,7 @@ def TestSection_IslandEffects(self):
self.resetIslandSegments(islandSizes)
minimumSize = 3
self.islandEffect.setParameter('MinimumSize', minimumSize)
- self.islandEffect.setParameter('Operation','SPLIT_ISLANDS_TO_SEGMENTS')
+ self.islandEffect.setParameter('Operation', 'SPLIT_ISLANDS_TO_SEGMENTS')
self.islandEffect.self().onApply()
layerCount = self.segmentation.GetNumberOfLayers()
self.assertEqual(layerCount, 1)
@@ -193,7 +193,7 @@ def TestSection_IslandEffects(self):
continue
self.checkSegmentVoxelCount(i, size)
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def resetIslandSegments(self, islandSizes):
self.segmentation.RemoveAllSegments()
@@ -205,7 +205,7 @@ def resetIslandSegments(self, islandSizes):
mergedLabelmap = vtkSegmentationCore.vtkOrientedImageData()
mergedLabelmap.SetImageToWorldMatrix(self.ijkToRas)
- mergedLabelmapExtent = [0, totalSize-1, 0, 0, 0, 0]
+ mergedLabelmapExtent = [0, totalSize - 1, 0, 0, 0, 0]
self.setupIslandLabelmap(mergedLabelmap, mergedLabelmapExtent, 0)
emptySegment = slicer.vtkSegment()
@@ -218,7 +218,7 @@ def resetIslandSegments(self, islandSizes):
for size in islandSizes:
islandLabelmap = vtkSegmentationCore.vtkOrientedImageData()
islandLabelmap.SetImageToWorldMatrix(self.ijkToRas)
- islandExtent = [startExtent, startExtent+size-1, 0, 0, 0, 0]
+ islandExtent = [startExtent, startExtent + size - 1, 0, 0, 0, 0]
self.setupIslandLabelmap(islandLabelmap, islandExtent)
self.paintEffect.modifySelectedSegmentByLabelmap(islandLabelmap, self.paintEffect.ModificationModeAdd)
startExtent += size + 1
@@ -227,7 +227,7 @@ def resetIslandSegments(self, islandSizes):
layerCount = self.segmentation.GetNumberOfLayers()
self.assertEqual(layerCount, 1)
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def checkSegmentVoxelCount(self, segmentIndex, expectedVoxelCount):
segment = self.segmentation.GetNthSegment(segmentIndex)
self.assertIsNotNone(segment)
@@ -239,21 +239,21 @@ def checkSegmentVoxelCount(self, segmentIndex, expectedVoxelCount):
imageStat = vtk.vtkImageAccumulate()
imageStat.SetInputData(labelmap)
- imageStat.SetComponentExtent(0,4,0,0,0,0)
- imageStat.SetComponentOrigin(0,0,0)
- imageStat.SetComponentSpacing(1,1,1)
+ imageStat.SetComponentExtent(0, 4, 0, 0, 0, 0)
+ imageStat.SetComponentOrigin(0, 0, 0)
+ imageStat.SetComponentSpacing(1, 1, 1)
imageStat.IgnoreZeroOn()
imageStat.Update()
self.assertEqual(imageStat.GetVoxelCount(), expectedVoxelCount)
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def setupIslandLabelmap(self, labelmap, extent, value=1):
labelmap.SetExtent(extent)
labelmap.AllocateScalars(vtk.VTK_UNSIGNED_CHAR, 1)
labelmap.GetPointData().GetScalars().Fill(value)
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_MarginEffects(self):
logging.info("Running test on margin effect")
@@ -278,12 +278,12 @@ def TestSection_MarginEffects(self):
vtk.VTK_UNSIGNED_SHORT,
vtk.VTK_INT,
vtk.VTK_UNSIGNED_INT,
- #vtk.VTK_LONG, # On linux, VTK_LONG has the same size as VTK_LONG_LONG. This causes issues in vtkImageThreshold.
- #vtk.VTK_UNSIGNED_LONG, See https://github.com/Slicer/Slicer/issues/5427
- #vtk.VTK_FLOAT, # Since float can't represent all int, we jump straight to double.
+ # vtk.VTK_LONG, # On linux, VTK_LONG has the same size as VTK_LONG_LONG. This causes issues in vtkImageThreshold.
+ # vtk.VTK_UNSIGNED_LONG, See https://github.com/Slicer/Slicer/issues/5427
+ # vtk.VTK_FLOAT, # Since float can't represent all int, we jump straight to double.
vtk.VTK_DOUBLE,
- #vtk.VTK_LONG_LONG, # These types are unsupported in ITK
- #vtk.VTK_UNSIGNED_LONG_LONG,
+ # vtk.VTK_LONG_LONG, # These types are unsupported in ITK
+ # vtk.VTK_UNSIGNED_LONG_LONG,
]
logging.info("Testing shared labelmaps")
for dataType in dataTypes:
@@ -318,7 +318,7 @@ def TestSection_MarginEffects(self):
self.runMarginEffect(segment1, segment2, dataType, self.segmentEditorNode.OverwriteNone)
self.assertEqual(self.segmentation.GetNumberOfLayers(), 2)
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def runMarginEffect(self, segment1, segment2, dataType, overwriteMode):
logging.info(f"Running margin effect with data type: {dataType}, and overwriteMode {overwriteMode}")
marginEffect = slicer.modules.segmenteditor.widgetRepresentation().self().editor.effectByName("Margin")
@@ -345,28 +345,28 @@ def runMarginEffect(self, segment1, segment2, dataType, overwriteMode):
self.checkSegmentVoxelCount(1, 1)
marginEffect.self().onApply()
- self.checkSegmentVoxelCount(0, 9) # Margin grow
+ self.checkSegmentVoxelCount(0, 9) # Margin grow
self.checkSegmentVoxelCount(1, 1)
marginEffect.self().onApply()
- self.checkSegmentVoxelCount(0, 37) # Margin grow
+ self.checkSegmentVoxelCount(0, 37) # Margin grow
if overwriteMode == slicer.vtkMRMLSegmentEditorNode.OverwriteAllSegments:
- self.checkSegmentVoxelCount(1, 0) # Overwritten
+ self.checkSegmentVoxelCount(1, 0) # Overwritten
else:
- self.checkSegmentVoxelCount(1, 1) # Not overwritten
+ self.checkSegmentVoxelCount(1, 1) # Not overwritten
marginEffect.setParameter("MarginSizeMm", -50.0)
marginEffect.self().onApply()
- self.checkSegmentVoxelCount(0, 9) # Margin shrink
+ self.checkSegmentVoxelCount(0, 9) # Margin shrink
if overwriteMode == slicer.vtkMRMLSegmentEditorNode.OverwriteAllSegments:
- self.checkSegmentVoxelCount(1, 0) # Overwritten
+ self.checkSegmentVoxelCount(1, 0) # Overwritten
else:
- self.checkSegmentVoxelCount(1, 1) # Not overwritten
+ self.checkSegmentVoxelCount(1, 1) # Not overwritten
self.segmentEditorNode.SetOverwriteMode(oldOverwriteMode)
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_MaskingSettings(self):
self.segmentation.RemoveAllSegments()
segment1Id = self.segmentation.AddEmptySegment("Segment_1")
@@ -376,16 +376,16 @@ def TestSection_MaskingSettings(self):
oldOverwriteMode = self.segmentEditorNode.GetOverwriteMode()
- #-------------------
+ # -------------------
# Test applying threshold with no masking
self.segmentEditorNode.SetSelectedSegmentID(segment1Id)
- self.thresholdEffect.setParameter("MinimumThreshold","-17")
- self.thresholdEffect.setParameter("MaximumThreshold","848")
+ self.thresholdEffect.setParameter("MinimumThreshold", "-17")
+ self.thresholdEffect.setParameter("MaximumThreshold", "848")
self.thresholdEffect.self().onApply()
- self.checkSegmentVoxelCount(0, 204) # Segment_1
- self.checkSegmentVoxelCount(1, 0) # Segment_2
+ self.checkSegmentVoxelCount(0, 204) # Segment_1
+ self.checkSegmentVoxelCount(1, 0) # Segment_2
- #-------------------
+ # -------------------
# Add paint to segment 2. No overwrite
paintModifierLabelmap = vtkSegmentationCore.vtkOrientedImageData()
paintModifierLabelmap.SetImageToWorldMatrix(self.ijkToRas)
@@ -397,10 +397,10 @@ def TestSection_MaskingSettings(self):
self.segmentEditorNode.SetSelectedSegmentID(segment2Id)
self.paintEffect.modifySelectedSegmentByLabelmap(paintModifierLabelmap, self.paintEffect.ModificationModeAdd)
- self.checkSegmentVoxelCount(0, 204) # Segment_1
- self.checkSegmentVoxelCount(1, 64) # Segment_2
+ self.checkSegmentVoxelCount(0, 204) # Segment_1
+ self.checkSegmentVoxelCount(1, 64) # Segment_2
- #-------------------
+ # -------------------
# Test erasing with no masking
eraseModifierLabelmap = vtkSegmentationCore.vtkOrientedImageData()
eraseModifierLabelmap.SetImageToWorldMatrix(self.ijkToRas)
@@ -410,72 +410,72 @@ def TestSection_MaskingSettings(self):
self.segmentEditorNode.SetSelectedSegmentID(segment1Id)
self.eraseEffect.modifySelectedSegmentByLabelmap(eraseModifierLabelmap, self.paintEffect.ModificationModeRemove)
- self.checkSegmentVoxelCount(0, 177) # Segment_1
- self.checkSegmentVoxelCount(1, 64) # Segment_2
+ self.checkSegmentVoxelCount(0, 177) # Segment_1
+ self.checkSegmentVoxelCount(1, 64) # Segment_2
- #-------------------
+ # -------------------
# Test erasing with masking on empty segment
self.segmentEditorNode.SetSelectedSegmentID(segment1Id)
- self.thresholdEffect.self().onApply() # Reset Segment_1
- self.checkSegmentVoxelCount(0, 204) # Segment_1
+ self.thresholdEffect.self().onApply() # Reset Segment_1
+ self.checkSegmentVoxelCount(0, 204) # Segment_1
self.segmentEditorNode.SetMaskMode(slicer.vtkMRMLSegmentationNode.EditAllowedInsideSingleSegment)
self.segmentEditorNode.SetMaskSegmentID(segment2Id)
self.eraseEffect.modifySelectedSegmentByLabelmap(eraseModifierLabelmap, self.paintEffect.ModificationModeRemove)
- self.checkSegmentVoxelCount(0, 177) # We expect to be able to erase the current segment regardless of masking
- self.checkSegmentVoxelCount(1, 64) # Segment_2
+ self.checkSegmentVoxelCount(0, 177) # We expect to be able to erase the current segment regardless of masking
+ self.checkSegmentVoxelCount(1, 64) # Segment_2
- #-------------------
+ # -------------------
# Test erasing with masking on the same segment
self.segmentEditorNode.SetSelectedSegmentID(segment1Id)
- self.thresholdEffect.self().onApply() # Reset Segment_1
- self.checkSegmentVoxelCount(0, 204) # Segment_1
+ self.thresholdEffect.self().onApply() # Reset Segment_1
+ self.checkSegmentVoxelCount(0, 204) # Segment_1
self.segmentEditorNode.SetMaskSegmentID(segment1Id)
self.eraseEffect.modifySelectedSegmentByLabelmap(eraseModifierLabelmap, self.paintEffect.ModificationModeRemove)
- self.checkSegmentVoxelCount(0, 177) # Segment_1
- self.checkSegmentVoxelCount(1, 64) # Segment_2
+ self.checkSegmentVoxelCount(0, 177) # Segment_1
+ self.checkSegmentVoxelCount(1, 64) # Segment_2
- #-------------------
+ # -------------------
# Test erasing all segments
self.segmentEditorNode.SetMaskMode(slicer.vtkMRMLSegmentationNode.EditAllowedEverywhere)
- self.thresholdEffect.self().onApply() # Reset Segment_1
- self.checkSegmentVoxelCount(0, 204) # Segment_1
+ self.thresholdEffect.self().onApply() # Reset Segment_1
+ self.checkSegmentVoxelCount(0, 204) # Segment_1
self.segmentEditorNode.SetSelectedSegmentID(segment1Id)
self.eraseEffect.modifySelectedSegmentByLabelmap(eraseModifierLabelmap, self.paintEffect.ModificationModeRemoveAll)
- self.checkSegmentVoxelCount(0, 177) # Segment_1
- self.checkSegmentVoxelCount(1, 0) # Segment_2
+ self.checkSegmentVoxelCount(0, 177) # Segment_1
+ self.checkSegmentVoxelCount(1, 0) # Segment_2
- #-------------------
+ # -------------------
# Test adding back segments
- self.thresholdEffect.self().onApply() # Reset Segment_1
- self.checkSegmentVoxelCount(0, 204) # Segment_1
+ self.thresholdEffect.self().onApply() # Reset Segment_1
+ self.checkSegmentVoxelCount(0, 204) # Segment_1
self.segmentEditorNode.SetMaskMode(slicer.vtkMRMLSegmentationNode.EditAllowedInsideSingleSegment)
self.segmentEditorNode.SetMaskSegmentID(segment2Id)
self.eraseEffect.modifySelectedSegmentByLabelmap(eraseModifierLabelmap, self.paintEffect.ModificationModeRemove)
- self.checkSegmentVoxelCount(0, 177) # Segment_1
- self.checkSegmentVoxelCount(1, 27) # Segment_2
+ self.checkSegmentVoxelCount(0, 177) # Segment_1
+ self.checkSegmentVoxelCount(1, 27) # Segment_2
- #-------------------
+ # -------------------
# Test threshold effect segment mask
- self.segmentEditorNode.SetMaskSegmentID(segment2Id) # Erase Segment_2
+ self.segmentEditorNode.SetMaskSegmentID(segment2Id) # Erase Segment_2
self.segmentEditorNode.SetSelectedSegmentID(segment2Id)
self.eraseEffect.modifySelectedSegmentByLabelmap(eraseModifierLabelmap, self.paintEffect.ModificationModeRemove)
self.segmentEditorNode.SetMaskSegmentID(segment1Id)
self.segmentEditorNode.SetSelectedSegmentID(segment2Id)
- self.thresholdEffect.self().onApply() # Threshold Segment_2 within Segment_1
- self.checkSegmentVoxelCount(0, 177) # Segment_1
- self.checkSegmentVoxelCount(1, 177) # Segment_2
+ self.thresholdEffect.self().onApply() # Threshold Segment_2 within Segment_1
+ self.checkSegmentVoxelCount(0, 177) # Segment_1
+ self.checkSegmentVoxelCount(1, 177) # Segment_2
- #-------------------
+ # -------------------
# Test intensity masking with segment mask
self.segmentEditorNode.MasterVolumeIntensityMaskOn()
self.segmentEditorNode.SetMasterVolumeIntensityMaskRange(-17, 848)
- self.thresholdEffect.setParameter("MinimumThreshold","-99999")
- self.thresholdEffect.setParameter("MaximumThreshold","99999")
+ self.thresholdEffect.setParameter("MinimumThreshold", "-99999")
+ self.thresholdEffect.setParameter("MaximumThreshold", "99999")
self.segmentEditorNode.SetSelectedSegmentID(segment3Id)
- self.thresholdEffect.self().onApply() # Threshold Segment_3
- self.checkSegmentVoxelCount(2, 177) # Segment_3
+ self.thresholdEffect.self().onApply() # Threshold Segment_3
+ self.checkSegmentVoxelCount(2, 177) # Segment_3
- #-------------------
+ # -------------------
# Test intensity masking with islands
self.segmentEditorNode.SetMaskMode(slicer.vtkMRMLSegmentationNode.EditAllowedEverywhere)
self.segmentEditorNode.MasterVolumeIntensityMaskOff()
@@ -494,14 +494,14 @@ def TestSection_MaskingSettings(self):
island2ModifierLabelmap.AllocateScalars(vtk.VTK_UNSIGNED_CHAR, 1)
island2ModifierLabelmap.GetPointData().GetScalars().Fill(1)
self.paintEffect.modifySelectedSegmentByLabelmap(island2ModifierLabelmap, self.paintEffect.ModificationModeAdd)
- self.checkSegmentVoxelCount(3, 91) # Segment_4
+ self.checkSegmentVoxelCount(3, 91) # Segment_4
# Test that no masking works as expected
minimumSize = 3
self.islandEffect.setParameter('MinimumSize', minimumSize)
- self.islandEffect.setParameter('Operation','KEEP_LARGEST_ISLAND')
+ self.islandEffect.setParameter('Operation', 'KEEP_LARGEST_ISLAND')
self.islandEffect.self().onApply()
- self.checkSegmentVoxelCount(3, 64) # Segment_4
+ self.checkSegmentVoxelCount(3, 64) # Segment_4
# Reset Segment_4 islands
self.paintEffect.modifySelectedSegmentByLabelmap(island1ModifierLabelmap, self.paintEffect.ModificationModeAdd)
@@ -511,7 +511,7 @@ def TestSection_MaskingSettings(self):
self.segmentEditorNode.MasterVolumeIntensityMaskOn()
self.segmentEditorNode.SetMasterVolumeIntensityMaskRange(-17, 848)
self.islandEffect.self().onApply()
- self.checkSegmentVoxelCount(3, 87) # Segment_4
+ self.checkSegmentVoxelCount(3, 87) # Segment_4
# Restore old overwrite setting
self.segmentEditorNode.SetOverwriteMode(oldOverwriteMode)
diff --git a/Modules/Loadable/SubjectHierarchy/Testing/Python/SubjectHierarchyCorePluginsSelfTest.py b/Modules/Loadable/SubjectHierarchy/Testing/Python/SubjectHierarchyCorePluginsSelfTest.py
index 2756db23e0d..947b0eaed6e 100644
--- a/Modules/Loadable/SubjectHierarchy/Testing/Python/SubjectHierarchyCorePluginsSelfTest.py
+++ b/Modules/Loadable/SubjectHierarchy/Testing/Python/SubjectHierarchyCorePluginsSelfTest.py
@@ -74,11 +74,11 @@ def setUp(self):
self.delayMs = 700
- #TODO: Comment out (sample code for debugging)
- #logFile = open('d:/pyTestLog.txt', 'w')
- #logFile.write(repr(slicer.modules.SubjectHierarchyCorePluginsSelfTest) + '\n')
- #logFile.write(repr(slicer.modules.subjecthierarchy) + '\n')
- #logFile.close()
+ # TODO: Comment out (sample code for debugging)
+ # logFile = open('d:/pyTestLog.txt', 'w')
+ # logFile.write(repr(slicer.modules.SubjectHierarchyCorePluginsSelfTest) + '\n')
+ # logFile.write(repr(slicer.modules.subjecthierarchy) + '\n')
+ # logFile.close()
def runTest(self):
"""Run as few or as many tests as needed here.
@@ -89,7 +89,7 @@ def runTest(self):
# ------------------------------------------------------------------------------
def test_SubjectHierarchyCorePluginsSelfTest_FullTest1(self):
# Check for SubjectHierarchy module
- self.assertTrue( slicer.modules.subjecthierarchy )
+ self.assertTrue(slicer.modules.subjecthierarchy)
# Switch to subject hierarchy module so that the changes can be seen as the test goes
slicer.util.selectModule('SubjectHierarchy')
@@ -113,10 +113,10 @@ def section_SetupPathsAndNames(self):
# ------------------------------------------------------------------------------
def section_MarkupRole(self):
- self.delayDisplay("Markup role",self.delayMs)
+ self.delayDisplay("Markup role", self.delayMs)
shNode = slicer.mrmlScene.GetSubjectHierarchyNode()
- self.assertIsNotNone( shNode )
+ self.assertIsNotNone(shNode)
# Create sample markups node
markupsNode = slicer.vtkMRMLMarkupsFiducialNode()
@@ -125,8 +125,8 @@ def section_MarkupRole(self):
fiducialPosition = [100.0, 0.0, 0.0]
markupsNode.AddControlPoint(fiducialPosition)
markupsShItemID = shNode.GetItemByDataNode(markupsNode)
- self.assertIsNotNone( markupsShItemID )
- self.assertEqual( shNode.GetItemOwnerPluginName(markupsShItemID), 'Markups' )
+ self.assertIsNotNone(markupsShItemID)
+ self.assertEqual(shNode.GetItemOwnerPluginName(markupsShItemID), 'Markups')
# Create patient and study
patientItemID = shNode.CreateSubjectItem(shNode.GetSceneItemID(), 'Patient')
@@ -134,22 +134,22 @@ def section_MarkupRole(self):
# Add markups under study
markupsShItemID2 = shNode.CreateItem(self.studyItemID, markupsNode)
- self.assertEqual( markupsShItemID, markupsShItemID2 )
- self.assertEqual( shNode.GetItemParent(markupsShItemID), self.studyItemID )
- self.assertEqual( shNode.GetItemOwnerPluginName(markupsShItemID), 'Markups' )
+ self.assertEqual(markupsShItemID, markupsShItemID2)
+ self.assertEqual(shNode.GetItemParent(markupsShItemID), self.studyItemID)
+ self.assertEqual(shNode.GetItemOwnerPluginName(markupsShItemID), 'Markups')
# ------------------------------------------------------------------------------
def section_CloneNode(self):
- self.delayDisplay("Clone node",self.delayMs)
+ self.delayDisplay("Clone node", self.delayMs)
shNode = slicer.mrmlScene.GetSubjectHierarchyNode()
- self.assertIsNotNone( shNode )
+ self.assertIsNotNone(shNode)
markupsNode = slicer.util.getNode(self.sampleMarkupName)
markupsShItemID = shNode.GetItemByDataNode(markupsNode)
- self.assertIsNotNone( markupsShItemID )
- self.assertIsNotNone( shNode.GetItemDataNode(markupsShItemID) )
+ self.assertIsNotNone(markupsShItemID)
+ self.assertIsNotNone(shNode.GetItemDataNode(markupsShItemID))
# Add storage node for markups node to test cloning those
markupsStorageNode = slicer.vtkMRMLMarkupsFiducialStorageNode()
@@ -158,10 +158,10 @@ def section_CloneNode(self):
# Get clone node plugin
pluginHandler = slicer.qSlicerSubjectHierarchyPluginHandler().instance()
- self.assertIsNotNone( pluginHandler )
+ self.assertIsNotNone(pluginHandler)
cloneNodePlugin = pluginHandler.pluginByName('CloneNode')
- self.assertIsNotNone( cloneNodePlugin )
+ self.assertIsNotNone(cloneNodePlugin)
# Set markup node as current (i.e. selected in the tree) for clone
pluginHandler.setCurrentItem(markupsShItemID)
@@ -169,28 +169,28 @@ def section_CloneNode(self):
# Get clone node context menu action and trigger
cloneNodePlugin.itemContextMenuActions()[0].activate(qt.QAction.Trigger)
- self.assertEqual( slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLMarkupsFiducialNode'), 2 )
- self.assertEqual( slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLMarkupsDisplayNode'), 2 )
- self.assertEqual( slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLMarkupsFiducialStorageNode'), 2 )
+ self.assertEqual(slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLMarkupsFiducialNode'), 2)
+ self.assertEqual(slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLMarkupsDisplayNode'), 2)
+ self.assertEqual(slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLMarkupsFiducialStorageNode'), 2)
clonedMarkupsName = self.sampleMarkupName + self.cloneNodeNamePostfix
clonedMarkupsNode = slicer.util.getNode(clonedMarkupsName)
- self.assertIsNotNone( clonedMarkupsNode )
+ self.assertIsNotNone(clonedMarkupsNode)
clonedMarkupsShItemID = shNode.GetItemChildWithName(self.studyItemID, clonedMarkupsName)
- self.assertIsNotNone( clonedMarkupsShItemID )
- self.assertIsNotNone( clonedMarkupsNode.GetDisplayNode() )
- self.assertIsNotNone( clonedMarkupsNode.GetStorageNode() )
+ self.assertIsNotNone(clonedMarkupsShItemID)
+ self.assertIsNotNone(clonedMarkupsNode.GetDisplayNode())
+ self.assertIsNotNone(clonedMarkupsNode.GetStorageNode())
inSameStudy = slicer.vtkSlicerSubjectHierarchyModuleLogic.AreItemsInSameBranch(
shNode, markupsShItemID, clonedMarkupsShItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMLevelStudy())
- self.assertTrue( inSameStudy )
+ self.assertTrue(inSameStudy)
# ------------------------------------------------------------------------------
def section_SegmentEditor(self):
- self.delayDisplay("Segment Editor",self.delayMs)
+ self.delayDisplay("Segment Editor", self.delayMs)
shNode = slicer.mrmlScene.GetSubjectHierarchyNode()
- self.assertIsNotNone( shNode )
+ self.assertIsNotNone(shNode)
import SampleData
mrHeadNode = SampleData.SampleDataLogic().downloadMRHead()
@@ -226,5 +226,5 @@ def section_SegmentEditor(self):
self.assertIsNotNone(segmentationNode)
segmentationItem = shNode.GetItemByDataNode(segmentationNode)
- self.assertEqual( shNode.GetItemParent(segmentationItem), shNode.GetItemParent(mrHeadItem) )
- self.assertEqual( segmentationNode.GetName()[:len(mrHeadNode.GetName())], mrHeadNode.GetName() )
+ self.assertEqual(shNode.GetItemParent(segmentationItem), shNode.GetItemParent(mrHeadItem))
+ self.assertEqual(segmentationNode.GetName()[:len(mrHeadNode.GetName())], mrHeadNode.GetName())
diff --git a/Modules/Loadable/SubjectHierarchy/Testing/Python/SubjectHierarchyFoldersTest1.py b/Modules/Loadable/SubjectHierarchy/Testing/Python/SubjectHierarchyFoldersTest1.py
index 8b0f210998a..38946356955 100644
--- a/Modules/Loadable/SubjectHierarchy/Testing/Python/SubjectHierarchyFoldersTest1.py
+++ b/Modules/Loadable/SubjectHierarchy/Testing/Python/SubjectHierarchyFoldersTest1.py
@@ -21,10 +21,10 @@ def runTest(self):
self.setUp()
self.test_SubjectHierarchyFoldersTest1()
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def test_SubjectHierarchyFoldersTest1(self):
# Check for modules
- self.assertIsNotNone( slicer.modules.subjecthierarchy )
+ self.assertIsNotNone(slicer.modules.subjecthierarchy)
self.TestSection_InitializeTest()
self.TestSection_LoadTestData()
@@ -34,7 +34,7 @@ def test_SubjectHierarchyFoldersTest1(self):
logging.info('Test finished')
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_InitializeTest(self):
#
# Define variables
@@ -77,7 +77,7 @@ def TestSection_InitializeTest(self):
self.modelDisplayableManager = self.getModelDisplayableManager()
self.assertIsNotNone(self.modelDisplayableManager)
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_LoadTestData(self):
# Load NAC Brain Atlas 2015 (https://github.com/Slicer/SlicerDataStore/releases/download/SHA256/d69d0331d4fd2574be1459b7734921f64f5872d3cb9589ec01b2f53dadc7112f)
logging.info('Test section: Load NAC Brain Atlas 2015')
@@ -93,7 +93,7 @@ def TestSection_LoadTestData(self):
ioManager.loadFile(sceneFile)
# Check number of models to see if atlas was fully loaded
- self.assertEqual(298, slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLModelNode')) # 301 with main window due to the slice views
+ self.assertEqual(298, slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLModelNode')) # 301 with main window due to the slice views
# Check number of model hierarchy nodes to make sure all of them were converted
self.assertEqual(0, slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLModelHierarchyNode'))
@@ -110,7 +110,7 @@ def TestSection_LoadTestData(self):
numberOfFolderItems += 1
self.assertEqual(80, numberOfFolderItems)
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_FolderVisibility(self):
# Test apply display properties on branch feature
logging.info('Test section: Folder visibility')
@@ -140,7 +140,7 @@ def TestSection_FolderVisibility(self):
# Hide branch using the folder plugin
self.startTiming()
self.folderPlugin.setDisplayVisibility(brainFolderItem, 0)
- logging.info('Time of hiding whole brain: ' + str(self.stopTiming()/1000) + ' s')
+ logging.info('Time of hiding whole brain: ' + str(self.stopTiming() / 1000) + ' s')
# Check if a folder display node was indeed created when changing display property on the folder
self.assertEqual(1, slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLFolderDisplayNode'))
@@ -163,7 +163,7 @@ def TestSection_FolderVisibility(self):
# Show folder again
self.startTiming()
self.folderPlugin.setDisplayVisibility(brainFolderItem, 1)
- logging.info('Time of showing whole brain: ' + str(self.stopTiming()/1000) + ' s')
+ logging.info('Time of showing whole brain: ' + str(self.stopTiming() / 1000) + ' s')
# Check number of visible models
numberOfVisibleModels = 0
@@ -178,7 +178,7 @@ def TestSection_FolderVisibility(self):
testModelHierarchyVisibility = slicer.vtkMRMLFolderDisplayNode.GetHierarchyVisibility(self.testModelNode)
self.assertTrue(testModelHierarchyVisibility)
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_ApplyDisplayPropertiesOnBranch(self):
# Test apply display properties on branch feature
logging.info('Test section: Apply display properties on branch')
@@ -191,7 +191,7 @@ def TestSection_ApplyDisplayPropertiesOnBranch(self):
overrideColorQt = qt.QColor(self.overrideColor[0], self.overrideColor[1], self.overrideColor[2])
self.startTiming()
self.folderPlugin.setDisplayColor(midbrainFolderItem, overrideColorQt, {})
- logging.info('Time of setting override color on midbrain branch: ' + str(self.stopTiming()/1000) + ' s')
+ logging.info('Time of setting override color on midbrain branch: ' + str(self.stopTiming() / 1000) + ' s')
# Check number of models with overridden color
numberOfOverriddenMidbrainModels = 0
@@ -201,13 +201,13 @@ def TestSection_ApplyDisplayPropertiesOnBranch(self):
for index in range(midbrainModelItems.GetNumberOfIds()):
currentMidbrainModelItem = midbrainModelItems.GetId(index)
currentMidbrainModelNode = self.shNode.GetItemDataNode(currentMidbrainModelItem)
- if currentMidbrainModelNode: # The child item can be a folder as well, in which case there is no model node
+ if currentMidbrainModelNode: # The child item can be a folder as well, in which case there is no model node
displayNode = currentMidbrainModelNode.GetDisplayNode()
actor = self.modelDisplayableManager.GetActorByID(displayNode.GetID())
currentColor = actor.GetProperty().GetColor()
- if (currentColor[0] == self.overrideColor[0]/255 and
- currentColor[1] == self.overrideColor[1]/255 and
- currentColor[2] == self.overrideColor[2]/255):
+ if (currentColor[0] == self.overrideColor[0] / 255 and
+ currentColor[1] == self.overrideColor[1] / 255 and
+ currentColor[2] == self.overrideColor[2] / 255):
if currentMidbrainModelNode is self.testModelNode:
testModelNodeOverridden = True
numberOfOverriddenMidbrainModels += 1
@@ -234,7 +234,7 @@ def TestSection_ApplyDisplayPropertiesOnBranch(self):
testModelHierarchyOpacity = slicer.vtkMRMLFolderDisplayNode.GetHierarchyOpacity(self.testModelNode)
self.assertEqual(testModelHierarchyOpacity, 0.25)
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def TestSection_FolderDisplayOverrideAllowed(self):
# Test exclusion of a node from the apply display properties feature
logging.info('Test section: Disable apply display properties using FolderDisplayOverrideAllowed')
@@ -250,25 +250,25 @@ def TestSection_FolderDisplayOverrideAllowed(self):
testModelCurrentColor = testModelActor.GetProperty().GetColor()
colorOverridden = False
- if (testModelCurrentColor[0] == self.overrideColor[0]/255 and
- testModelCurrentColor[1] == self.overrideColor[1]/255 and
- testModelCurrentColor[2] == self.overrideColor[2]/255):
+ if (testModelCurrentColor[0] == self.overrideColor[0] / 255 and
+ testModelCurrentColor[1] == self.overrideColor[1] / 255 and
+ testModelCurrentColor[2] == self.overrideColor[2] / 255):
colorOverridden = True
self.assertFalse(colorOverridden)
testModelCurrentOpacity = testModelActor.GetProperty().GetOpacity()
self.assertEqual(testModelCurrentOpacity, 1.0)
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def startTiming(self):
self.timer = qt.QTime()
self.timer.start()
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def stopTiming(self):
return self.timer.elapsed()
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
def getModelDisplayableManager(self):
if self.viewWidget is None:
logging.error('View widget is not created')
diff --git a/Modules/Loadable/SubjectHierarchy/Testing/Python/SubjectHierarchyGenericSelfTest.py b/Modules/Loadable/SubjectHierarchy/Testing/Python/SubjectHierarchyGenericSelfTest.py
index 7e617717245..7a855ceacda 100644
--- a/Modules/Loadable/SubjectHierarchy/Testing/Python/SubjectHierarchyGenericSelfTest.py
+++ b/Modules/Loadable/SubjectHierarchy/Testing/Python/SubjectHierarchyGenericSelfTest.py
@@ -80,11 +80,11 @@ def setUp(self):
self.delayMs = 700
- #TODO: Comment out (sample code for debugging)
- #logFile = open('d:/pyTestLog.txt', 'w')
- #logFile.write(repr(slicer.modules.subjecthierarchygenericselftest) + '\n')
- #logFile.write(repr(slicer.modules.subjecthierarchy) + '\n')
- #logFile.close()
+ # TODO: Comment out (sample code for debugging)
+ # logFile = open('d:/pyTestLog.txt', 'w')
+ # logFile.write(repr(slicer.modules.subjecthierarchygenericselftest) + '\n')
+ # logFile.write(repr(slicer.modules.subjecthierarchy) + '\n')
+ # logFile.close()
def runTest(self):
"""Run as few or as many tests as needed here.
@@ -95,7 +95,7 @@ def runTest(self):
# ------------------------------------------------------------------------------
def test_SubjectHierarchyGenericSelfTest_FullTest1(self):
# Check for SubjectHierarchy module
- self.assertIsNotNone( slicer.modules.subjecthierarchy )
+ self.assertIsNotNone(slicer.modules.subjecthierarchy)
# Switch to subject hierarchy module so that the changes can be seen as the test goes
slicer.util.selectModule('SubjectHierarchy')
@@ -143,7 +143,7 @@ def section_SetupPathsAndNames(self):
self.loadedDicomStudyName = 'No study description (20110101)'
self.loadedDicomVolumeName = '303: Unnamed Series'
- self.patientItemID = self.invalidItemID # To be filled in after adding
+ self.patientItemID = self.invalidItemID # To be filled in after adding
self.patientOriginalName = ''
self.patientNewName = 'TestPatient_1'
self.studyItemID = self.invalidItemID
@@ -167,16 +167,16 @@ def section_SetupPathsAndNames(self):
# ------------------------------------------------------------------------------
def section_ClearScene(self):
- self.delayDisplay("Clear scene",self.delayMs)
+ self.delayDisplay("Clear scene", self.delayMs)
# Clear the scene to make sure there is no crash (closing scene is a sensitive operation)
slicer.mrmlScene.Clear()
# Make sure there is only one subject hierarchy node after closing the scene
- self.assertEqual( slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLSubjectHierarchyNode'), 1 )
+ self.assertEqual(slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLSubjectHierarchyNode'), 1)
shNode = slicer.mrmlScene.GetSubjectHierarchyNode()
- self.assertIsNotNone( shNode )
+ self.assertIsNotNone(shNode)
# ------------------------------------------------------------------------------
def section_LoadDicomDataWitchBatchProcessing(self):
@@ -187,13 +187,13 @@ def section_LoadDicomDataWitchBatchProcessing(self):
# Open test database and empty it
with DICOMUtils.TemporaryDICOMDatabase(self.dicomDatabaseDir) as db:
- self.assertTrue( db.isOpen )
- self.assertEqual( slicer.dicomDatabase, db)
+ self.assertTrue(db.isOpen)
+ self.assertEqual(slicer.dicomDatabase, db)
slicer.mrmlScene.StartState(slicer.vtkMRMLScene.BatchProcessState)
# Download, unzip, import, and load data. Verify loaded nodes.
- loadedNodes = {'vtkMRMLScalarVolumeNode':1}
+ loadedNodes = {'vtkMRMLScalarVolumeNode': 1}
with DICOMUtils.LoadDICOMFilesToDatabase( \
self.dicomZipFileUrl, self.dicomZipFilePath, \
self.dicomDataDir, self.expectedNumOfFilesInDicomDataDir, \
@@ -202,22 +202,22 @@ def section_LoadDicomDataWitchBatchProcessing(self):
slicer.mrmlScene.EndState(slicer.vtkMRMLScene.BatchProcessState)
- self.assertEqual( len( slicer.util.getNodes('vtkMRMLSubjectHierarchyNode*') ), 1 )
+ self.assertEqual(len(slicer.util.getNodes('vtkMRMLSubjectHierarchyNode*')), 1)
shNode = slicer.mrmlScene.GetSubjectHierarchyNode()
- self.assertIsNotNone( shNode )
+ self.assertIsNotNone(shNode)
loadedDicomVolumeItemID = shNode.GetItemByName(self.loadedDicomVolumeName)
loadedDicomStudyItemID = shNode.GetItemByName(self.loadedDicomStudyName)
- self.assertEqual( shNode.GetItemParent(loadedDicomVolumeItemID), loadedDicomStudyItemID )
+ self.assertEqual(shNode.GetItemParent(loadedDicomVolumeItemID), loadedDicomStudyItemID)
except Exception as e:
import traceback
traceback.print_exc()
- self.delayDisplay('Test caused exception!\n' + str(e),self.delayMs*2)
+ self.delayDisplay('Test caused exception!\n' + str(e), self.delayMs * 2)
# ------------------------------------------------------------------------------
def section_SaveScene(self):
- self.delayDisplay("Save scene",self.delayMs)
+ self.delayDisplay("Save scene", self.delayMs)
if not os.access(self.tempDir, os.F_OK):
os.mkdir(self.tempDir)
@@ -230,16 +230,16 @@ def section_SaveScene(self):
logging.info('Scene saved into ' + self.genericTestSceneFileName)
readable = os.access(self.genericTestSceneFileName, os.R_OK)
- self.assertTrue( readable )
+ self.assertTrue(readable)
# ------------------------------------------------------------------------------
def section_AddNodeToSubjectHierarchy(self):
- self.delayDisplay("Add node to subject hierarchy",self.delayMs)
+ self.delayDisplay("Add node to subject hierarchy", self.delayMs)
# Get volume previously loaded from DICOM
volumeNodes = list(slicer.util.getNodes('vtkMRMLScalarVolumeNode*').values())
- ctVolumeNode = volumeNodes[len(volumeNodes)-1]
- self.assertIsNotNone( ctVolumeNode )
+ ctVolumeNode = volumeNodes[len(volumeNodes) - 1]
+ self.assertIsNotNone(ctVolumeNode)
# Create sample labelmap and model and add them in subject hierarchy
self.sampleLabelmapNode = self.createSampleLabelmapVolumeNode(ctVolumeNode, self.sampleLabelmapName, 2)
@@ -248,40 +248,40 @@ def section_AddNodeToSubjectHierarchy(self):
# Get subject hierarchy scene model and node
dataWidget = slicer.modules.data.widgetRepresentation()
- self.assertIsNotNone( dataWidget )
+ self.assertIsNotNone(dataWidget)
shTreeView = slicer.util.findChild(dataWidget, name='SubjectHierarchyTreeView')
- self.assertIsNotNone( shTreeView )
+ self.assertIsNotNone(shTreeView)
shModel = shTreeView.model()
- self.assertIsNotNone( shModel )
+ self.assertIsNotNone(shModel)
shNode = slicer.mrmlScene.GetSubjectHierarchyNode()
- self.assertIsNotNone( shNode )
+ self.assertIsNotNone(shNode)
# Get and check subject hierarchy items for the data nodes
self.ctVolumeShItemID = shNode.GetItemByDataNode(ctVolumeNode)
self.ctVolumeOriginalName = shNode.GetItemName(self.ctVolumeShItemID)
- self.assertIsNotNone( self.ctVolumeShItemID )
+ self.assertIsNotNone(self.ctVolumeShItemID)
self.sampleLabelmapShItemID = shNode.GetItemByDataNode(self.sampleLabelmapNode)
- self.assertIsNotNone( self.sampleLabelmapShItemID )
- self.assertEqual( shNode.GetItemOwnerPluginName(self.sampleLabelmapShItemID), 'LabelMaps' )
+ self.assertIsNotNone(self.sampleLabelmapShItemID)
+ self.assertEqual(shNode.GetItemOwnerPluginName(self.sampleLabelmapShItemID), 'LabelMaps')
self.sampleModelShItemID = shNode.GetItemByDataNode(self.sampleModelNode)
- self.assertIsNotNone( self.sampleModelShItemID )
- self.assertEqual( shNode.GetItemOwnerPluginName(self.sampleModelShItemID), 'Models' )
+ self.assertIsNotNone(self.sampleModelShItemID)
+ self.assertEqual(shNode.GetItemOwnerPluginName(self.sampleModelShItemID), 'Models')
# Save item IDs for scene load testing
self.studyItemID = shNode.GetItemParent(self.ctVolumeShItemID)
self.studyOriginalName = shNode.GetItemName(self.studyItemID)
- self.assertIsNotNone( self.studyItemID )
+ self.assertIsNotNone(self.studyItemID)
self.patientItemID = shNode.GetItemParent(self.studyItemID)
self.patientOriginalName = shNode.GetItemName(self.patientItemID)
- self.assertIsNotNone( self.patientItemID )
+ self.assertIsNotNone(self.patientItemID)
# Verify DICOM levels
- self.assertEqual( shNode.GetItemLevel(self.patientItemID), slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMLevelPatient() )
- self.assertEqual( shNode.GetItemLevel(self.studyItemID), slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMLevelStudy() )
- self.assertEqual( shNode.GetItemLevel(self.ctVolumeShItemID), "" )
+ self.assertEqual(shNode.GetItemLevel(self.patientItemID), slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMLevelPatient())
+ self.assertEqual(shNode.GetItemLevel(self.studyItemID), slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMLevelStudy())
+ self.assertEqual(shNode.GetItemLevel(self.ctVolumeShItemID), "")
# Add model and labelmap to the created study
retVal1 = shModel.reparent(self.sampleLabelmapShItemID, self.studyItemID)
@@ -292,14 +292,14 @@ def section_AddNodeToSubjectHierarchy(self):
# ------------------------------------------------------------------------------
def section_CLI(self):
- self.delayDisplay("Test command-line interface",self.delayMs)
+ self.delayDisplay("Test command-line interface", self.delayMs)
shNode = slicer.mrmlScene.GetSubjectHierarchyNode()
- self.assertIsNotNone( shNode )
+ self.assertIsNotNone(shNode)
# Get CT volume
ctVolumeNode = shNode.GetItemDataNode(self.ctVolumeShItemID)
- self.assertIsNotNone( ctVolumeNode )
+ self.assertIsNotNone(ctVolumeNode)
# Create output volume
resampledVolumeNode = slicer.vtkMRMLScalarVolumeNode()
@@ -307,22 +307,22 @@ def section_CLI(self):
slicer.mrmlScene.AddNode(resampledVolumeNode)
# Resample
- resampleParameters = { 'outputPixelSpacing':'24.5,24.5,11.5', 'interpolationType':'lanczos',
- 'InputVolume':ctVolumeNode.GetID(), 'OutputVolume':resampledVolumeNode.GetID() }
+ resampleParameters = {'outputPixelSpacing': '24.5,24.5,11.5', 'interpolationType': 'lanczos',
+ 'InputVolume': ctVolumeNode.GetID(), 'OutputVolume': resampledVolumeNode.GetID()}
slicer.cli.run(slicer.modules.resamplescalarvolume, None, resampleParameters, wait_for_completion=True)
- self.delayDisplay("Wait for CLI logic to add result to same branch",self.delayMs)
+ self.delayDisplay("Wait for CLI logic to add result to same branch", self.delayMs)
# Check if output is also under the same study node
resampledVolumeItemID = shNode.GetItemByDataNode(resampledVolumeNode)
- self.assertIsNotNone( resampledVolumeItemID )
- self.assertEqual( shNode.GetItemParent(resampledVolumeItemID), self.studyItemID )
+ self.assertIsNotNone(resampledVolumeItemID)
+ self.assertEqual(shNode.GetItemParent(resampledVolumeItemID), self.studyItemID)
# ------------------------------------------------------------------------------
def section_CreateSecondBranch(self):
- self.delayDisplay("Create second branch in subject hierarchy",self.delayMs)
+ self.delayDisplay("Create second branch in subject hierarchy", self.delayMs)
shNode = slicer.mrmlScene.GetSubjectHierarchyNode()
- self.assertIsNotNone( shNode )
+ self.assertIsNotNone(shNode)
# Create second patient, study, and a folder
self.patient2ItemID = shNode.CreateSubjectItem(shNode.GetSceneItemID(), self.patient2Name)
@@ -330,46 +330,46 @@ def section_CreateSecondBranch(self):
self.folderItemID = shNode.CreateFolderItem(self.study2ItemID, self.folderName)
# Check if the items have the right parents
- self.assertEqual( shNode.GetItemParent(self.patient2ItemID), shNode.GetSceneItemID() )
- self.assertEqual( shNode.GetItemParent(self.study2ItemID), self.patient2ItemID )
- self.assertEqual( shNode.GetItemParent(self.folderItemID), self.study2ItemID )
+ self.assertEqual(shNode.GetItemParent(self.patient2ItemID), shNode.GetSceneItemID())
+ self.assertEqual(shNode.GetItemParent(self.study2ItemID), self.patient2ItemID)
+ self.assertEqual(shNode.GetItemParent(self.folderItemID), self.study2ItemID)
# ------------------------------------------------------------------------------
def section_ReparentNodeInSubjectHierarchy(self):
- self.delayDisplay("Reparent node in subject hierarchy",self.delayMs)
+ self.delayDisplay("Reparent node in subject hierarchy", self.delayMs)
shNode = slicer.mrmlScene.GetSubjectHierarchyNode()
- self.assertIsNotNone( shNode )
+ self.assertIsNotNone(shNode)
# Get subject hierarchy scene model
dataWidget = slicer.modules.data.widgetRepresentation()
- self.assertIsNotNone( dataWidget )
+ self.assertIsNotNone(dataWidget)
shTreeView = slicer.util.findChild(dataWidget, name='SubjectHierarchyTreeView')
- self.assertIsNotNone( shTreeView )
+ self.assertIsNotNone(shTreeView)
shModel = shTreeView.model()
- self.assertIsNotNone( shModel )
+ self.assertIsNotNone(shModel)
# Reparent using the item model
shModel.reparent(self.sampleLabelmapShItemID, self.studyItemID)
- self.assertEqual( shNode.GetItemParent(self.sampleLabelmapShItemID), self.studyItemID )
- self.assertEqual( shNode.GetItemOwnerPluginName(self.sampleLabelmapShItemID), 'LabelMaps' )
+ self.assertEqual(shNode.GetItemParent(self.sampleLabelmapShItemID), self.studyItemID)
+ self.assertEqual(shNode.GetItemOwnerPluginName(self.sampleLabelmapShItemID), 'LabelMaps')
# Reparent using the node's set parent function
shNode.SetItemParent(self.ctVolumeShItemID, self.study2ItemID)
- self.assertEqual( shNode.GetItemParent(self.ctVolumeShItemID), self.study2ItemID )
- self.assertEqual( shNode.GetItemOwnerPluginName(self.ctVolumeShItemID), 'Volumes' )
+ self.assertEqual(shNode.GetItemParent(self.ctVolumeShItemID), self.study2ItemID)
+ self.assertEqual(shNode.GetItemOwnerPluginName(self.ctVolumeShItemID), 'Volumes')
# Reparent using the node's create item function
shNode.CreateItem(self.folderItemID, self.sampleModelNode)
- self.assertEqual( shNode.GetItemParent(self.sampleModelShItemID), self.folderItemID )
- self.assertEqual( shNode.GetItemOwnerPluginName(self.sampleModelShItemID), 'Models' )
+ self.assertEqual(shNode.GetItemParent(self.sampleModelShItemID), self.folderItemID)
+ self.assertEqual(shNode.GetItemOwnerPluginName(self.sampleModelShItemID), 'Models')
# ------------------------------------------------------------------------------
def section_LoadScene(self):
- self.delayDisplay("Load scene",self.delayMs)
+ self.delayDisplay("Load scene", self.delayMs)
shNode = slicer.mrmlScene.GetSubjectHierarchyNode()
- self.assertIsNotNone( shNode )
+ self.assertIsNotNone(shNode)
# Rename existing items so that when the scene is loaded again they are different
shNode.SetItemName(self.patientItemID, self.patientNewName)
@@ -380,27 +380,27 @@ def section_LoadScene(self):
slicer.util.loadScene(self.genericTestSceneFileName)
# Check number of nodes in the scene
- self.assertEqual( slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLScalarVolumeNode'), 4 )
- self.assertEqual( slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLModelNode'), 4 ) # Including the three slice view models
- self.assertEqual( slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLSubjectHierarchyNode'), 1 )
+ self.assertEqual(slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLScalarVolumeNode'), 4)
+ self.assertEqual(slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLModelNode'), 4) # Including the three slice view models
+ self.assertEqual(slicer.mrmlScene.GetNumberOfNodesByClass('vtkMRMLSubjectHierarchyNode'), 1)
# Check if the items are in the right hierarchy with the right names
- self.assertEqual( shNode.GetItemChildWithName(shNode.GetSceneItemID(), self.patientNewName), self.patientItemID )
- self.assertEqual( shNode.GetItemChildWithName(self.patientItemID, self.studyNewName), self.studyItemID )
- self.assertEqual( shNode.GetItemChildWithName(self.studyItemID, self.sampleLabelmapName), self.sampleLabelmapShItemID )
+ self.assertEqual(shNode.GetItemChildWithName(shNode.GetSceneItemID(), self.patientNewName), self.patientItemID)
+ self.assertEqual(shNode.GetItemChildWithName(self.patientItemID, self.studyNewName), self.studyItemID)
+ self.assertEqual(shNode.GetItemChildWithName(self.studyItemID, self.sampleLabelmapName), self.sampleLabelmapShItemID)
- self.assertEqual( shNode.GetItemChildWithName(shNode.GetSceneItemID(), self.patient2Name), self.patient2ItemID )
- self.assertEqual( shNode.GetItemChildWithName(self.patient2ItemID, self.study2Name), self.study2ItemID )
- self.assertEqual( shNode.GetItemChildWithName(self.study2ItemID, self.folderName), self.folderItemID )
- self.assertEqual( shNode.GetItemChildWithName(self.folderItemID, self.sampleModelName), self.sampleModelShItemID )
- self.assertEqual( shNode.GetItemChildWithName(self.study2ItemID, self.ctVolumeNewName), self.ctVolumeShItemID )
+ self.assertEqual(shNode.GetItemChildWithName(shNode.GetSceneItemID(), self.patient2Name), self.patient2ItemID)
+ self.assertEqual(shNode.GetItemChildWithName(self.patient2ItemID, self.study2Name), self.study2ItemID)
+ self.assertEqual(shNode.GetItemChildWithName(self.study2ItemID, self.folderName), self.folderItemID)
+ self.assertEqual(shNode.GetItemChildWithName(self.folderItemID, self.sampleModelName), self.sampleModelShItemID)
+ self.assertEqual(shNode.GetItemChildWithName(self.study2ItemID, self.ctVolumeNewName), self.ctVolumeShItemID)
loadedPatientItemID = shNode.GetItemChildWithName(shNode.GetSceneItemID(), self.patientOriginalName)
- self.assertIsNotNone( loadedPatientItemID )
+ self.assertIsNotNone(loadedPatientItemID)
loadedStudyItemID = shNode.GetItemChildWithName(loadedPatientItemID, self.studyOriginalName)
- self.assertIsNotNone( loadedStudyItemID )
+ self.assertIsNotNone(loadedStudyItemID)
loadedCtVolumeShItemID = shNode.GetItemChildWithName(loadedStudyItemID, self.ctVolumeOriginalName)
- self.assertIsNotNone( loadedCtVolumeShItemID )
+ self.assertIsNotNone(loadedCtVolumeShItemID)
# Print subject hierarchy after the test
logging.info(shNode)
@@ -408,20 +408,20 @@ def section_LoadScene(self):
# ------------------------------------------------------------------------------
def section_TestCircularParenthood(self):
# Test case for https://issues.slicer.org/view.php?id=4713
- self.delayDisplay("Test circular parenthood",self.delayMs)
+ self.delayDisplay("Test circular parenthood", self.delayMs)
shNode = slicer.mrmlScene.GetSubjectHierarchyNode()
- self.assertIsNotNone( shNode )
+ self.assertIsNotNone(shNode)
sceneItemID = shNode.GetSceneItemID()
mainfolder_ID = shNode.CreateFolderItem(sceneItemID, "Main Folder")
subfolder_ID = shNode.CreateFolderItem(sceneItemID, "Sub Folder")
- shNode.SetItemParent(subfolder_ID, mainfolder_ID) # Regular hierarchy setting
- shNode.SetItemParent(mainfolder_ID, subfolder_ID) # Makes slicer crash instead of returning an error
+ shNode.SetItemParent(subfolder_ID, mainfolder_ID) # Regular hierarchy setting
+ shNode.SetItemParent(mainfolder_ID, subfolder_ID) # Makes slicer crash instead of returning an error
# ------------------------------------------------------------------------------
def section_AttributeFilters(self):
- self.delayDisplay("Attribute filters",self.delayMs)
+ self.delayDisplay("Attribute filters", self.delayMs)
import SampleData
sceneFile = SampleData.downloadFromURL(
@@ -568,7 +568,7 @@ def testAttributeFilters(filteredObject, proxyModel):
# ------------------------------------------------------------------------------
def section_ComboboxFeatures(self):
- self.delayDisplay("Combobox features",self.delayMs)
+ self.delayDisplay("Combobox features", self.delayMs)
comboBox = slicer.qMRMLSubjectHierarchyComboBox()
comboBox.setMRMLScene(slicer.mrmlScene)
@@ -609,9 +609,9 @@ def section_ComboboxFeatures(self):
# ------------------------------------------------------------------------------
# Create sample labelmap with same geometry as input volume
def createSampleLabelmapVolumeNode(self, volumeNode, name, label, colorNode=None):
- self.assertIsNotNone( volumeNode )
- self.assertTrue( volumeNode.IsA('vtkMRMLScalarVolumeNode') )
- self.assertTrue( label > 0 )
+ self.assertIsNotNone(volumeNode)
+ self.assertTrue(volumeNode.IsA('vtkMRMLScalarVolumeNode'))
+ self.assertTrue(label > 0)
sampleLabelmapNode = slicer.vtkMRMLLabelMapVolumeNode()
sampleLabelmapNode.SetName(name)
@@ -619,22 +619,22 @@ def createSampleLabelmapVolumeNode(self, volumeNode, name, label, colorNode=None
sampleLabelmapNode.Copy(volumeNode)
imageData = sampleLabelmapNode.GetImageData()
extent = imageData.GetExtent()
- for x in range(extent[0], extent[1]+1):
- for y in range(extent[2], extent[3]+1):
- for z in range(extent[4], extent[5]+1):
- if ( (x >= (extent[1]/4) and x <= (extent[1]/4) * 3) and
- (y >= (extent[3]/4) and y <= (extent[3]/4) * 3) and
- (z >= (extent[5]/4) and z <= (extent[5]/4) * 3) ):
- imageData.SetScalarComponentFromDouble(x,y,z,0,label)
+ for x in range(extent[0], extent[1] + 1):
+ for y in range(extent[2], extent[3] + 1):
+ for z in range(extent[4], extent[5] + 1):
+ if ((x >= (extent[1] / 4) and x <= (extent[1] / 4) * 3) and
+ (y >= (extent[3] / 4) and y <= (extent[3] / 4) * 3) and
+ (z >= (extent[5] / 4) and z <= (extent[5] / 4) * 3)):
+ imageData.SetScalarComponentFromDouble(x, y, z, 0, label)
else:
- imageData.SetScalarComponentFromDouble(x,y,z,0,0)
+ imageData.SetScalarComponentFromDouble(x, y, z, 0, 0)
# Display labelmap
labelmapVolumeDisplayNode = slicer.vtkMRMLLabelMapVolumeDisplayNode()
slicer.mrmlScene.AddNode(labelmapVolumeDisplayNode)
if colorNode is None:
colorNode = slicer.util.getNode('GenericAnatomyColors')
- self.assertIsNotNone( colorNode )
+ self.assertIsNotNone(colorNode)
labelmapVolumeDisplayNode.SetAndObserveColorNodeID(colorNode.GetID())
labelmapVolumeDisplayNode.VisibilityOn()
sampleLabelmapName = slicer.mrmlScene.GenerateUniqueName(name)
@@ -643,17 +643,17 @@ def createSampleLabelmapVolumeNode(self, volumeNode, name, label, colorNode=None
return sampleLabelmapNode
- #------------------------------------------------------------------------------
+ # ------------------------------------------------------------------------------
# Create sphere model at the centre of an input volume
def createSampleModelNode(self, name, color, volumeNode=None):
if volumeNode:
- self.assertTrue( volumeNode.IsA('vtkMRMLScalarVolumeNode') )
+ self.assertTrue(volumeNode.IsA('vtkMRMLScalarVolumeNode'))
bounds = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
volumeNode.GetRASBounds(bounds)
- x = (bounds[0] + bounds[1])/2
- y = (bounds[2] + bounds[3])/2
- z = (bounds[4] + bounds[5])/2
- radius = min(bounds[1]-bounds[0],bounds[3]-bounds[2],bounds[5]-bounds[4]) / 3.0
+ x = (bounds[0] + bounds[1]) / 2
+ y = (bounds[2] + bounds[3]) / 2
+ z = (bounds[4] + bounds[5]) / 2
+ radius = min(bounds[1] - bounds[0], bounds[3] - bounds[2], bounds[5] - bounds[4]) / 3.0
else:
radius = 50
x = y = z = 0
diff --git a/Modules/Loadable/Tables/Testing/Python/TablesSelfTest.py b/Modules/Loadable/Tables/Testing/Python/TablesSelfTest.py
index 23b820ffaa6..0cb71cb0578 100644
--- a/Modules/Loadable/Tables/Testing/Python/TablesSelfTest.py
+++ b/Modules/Loadable/Tables/Testing/Python/TablesSelfTest.py
@@ -64,7 +64,7 @@ def runTest(self):
# ------------------------------------------------------------------------------
def test_TablesSelfTest_FullTest1(self):
# Check for Tables module
- self.assertTrue( slicer.modules.tables )
+ self.assertTrue(slicer.modules.tables)
self.section_SetupPathsAndNames()
self.section_CreateTable()
@@ -89,7 +89,7 @@ def section_CreateTable(self):
# Add a new column
column = tableNode.AddColumn()
- self.assertTrue( column is not None )
+ self.assertTrue(column is not None)
column.InsertNextValue("some")
column.InsertNextValue("data")
column.InsertNextValue("in this")
@@ -98,9 +98,9 @@ def section_CreateTable(self):
# Check table
table = tableNode.GetTable()
- self.assertTrue( table is not None )
- self.assertTrue( table.GetNumberOfRows() == 4 )
- self.assertTrue( table.GetNumberOfColumns() == 1 )
+ self.assertTrue(table is not None)
+ self.assertTrue(table.GetNumberOfRows() == 4)
+ self.assertTrue(table.GetNumberOfColumns() == 1)
# ------------------------------------------------------------------------------
def section_TableProperties(self):
@@ -123,22 +123,22 @@ def section_TableWidgetButtons(self):
# Make sure subject hierarchy auto-creation is on for this test
tablesWidget = slicer.modules.tables.widgetRepresentation()
- self.assertTrue( tablesWidget is not None )
+ self.assertTrue(tablesWidget is not None)
tableNode = slicer.util.getNode(self.sampleTableName)
tablesWidget.setCurrentTableNode(tableNode)
- lockTableButton = slicer.util.findChildren(widget=tablesWidget,name='LockTableButton')[0]
- copyButton = slicer.util.findChildren(widget=tablesWidget,name='CopyButton')[0]
- pasteButton = slicer.util.findChildren(widget=tablesWidget,name='PasteButton')[0]
- addRowButton = slicer.util.findChildren(widget=tablesWidget,name='RowInsertButton')[0]
- deleteRowButton = slicer.util.findChildren(widget=tablesWidget,name='RowDeleteButton')[0]
- lockFirstRowButton = slicer.util.findChildren(widget=tablesWidget,name='LockFirstRowButton')[0]
- addColumnButton = slicer.util.findChildren(widget=tablesWidget,name='ColumnInsertButton')[0]
- deleteColumnButton = slicer.util.findChildren(widget=tablesWidget,name='ColumnDeleteButton')[0]
- lockFirstColumnButton = slicer.util.findChildren(widget=tablesWidget,name='LockFirstColumnButton')[0]
- tableView = slicer.util.findChildren(widget=tablesWidget,name='TableView')[0]
+ lockTableButton = slicer.util.findChildren(widget=tablesWidget, name='LockTableButton')[0]
+ copyButton = slicer.util.findChildren(widget=tablesWidget, name='CopyButton')[0]
+ pasteButton = slicer.util.findChildren(widget=tablesWidget, name='PasteButton')[0]
+ addRowButton = slicer.util.findChildren(widget=tablesWidget, name='RowInsertButton')[0]
+ deleteRowButton = slicer.util.findChildren(widget=tablesWidget, name='RowDeleteButton')[0]
+ lockFirstRowButton = slicer.util.findChildren(widget=tablesWidget, name='LockFirstRowButton')[0]
+ addColumnButton = slicer.util.findChildren(widget=tablesWidget, name='ColumnInsertButton')[0]
+ deleteColumnButton = slicer.util.findChildren(widget=tablesWidget, name='ColumnDeleteButton')[0]
+ lockFirstColumnButton = slicer.util.findChildren(widget=tablesWidget, name='LockFirstColumnButton')[0]
+ tableView = slicer.util.findChildren(widget=tablesWidget, name='TableView')[0]
tableModel = tableView.model()
@@ -149,32 +149,32 @@ def section_TableWidgetButtons(self):
self.delayDisplay("Test add rows/columns")
addRowButton.click()
- self.assertTrue( tableNode.GetNumberOfRows() == initialNumberOfRows+1 )
+ self.assertTrue(tableNode.GetNumberOfRows() == initialNumberOfRows + 1)
addColumnButton.click()
- self.assertTrue( tableNode.GetNumberOfColumns() == initialNumberOfColumns+1 )
+ self.assertTrue(tableNode.GetNumberOfColumns() == initialNumberOfColumns + 1)
#############
self.delayDisplay("Test lock first row/column")
- self.assertTrue( tableModel.data(tableModel.index(0,0)) == 'Column 1' )
+ self.assertTrue(tableModel.data(tableModel.index(0, 0)) == 'Column 1')
lockFirstRowButton.click()
- self.assertTrue( tableModel.data(tableModel.index(0,0)) == 'some' )
+ self.assertTrue(tableModel.data(tableModel.index(0, 0)) == 'some')
lockFirstColumnButton.click()
- self.assertTrue( tableModel.data(tableModel.index(0,0)) == '' )
+ self.assertTrue(tableModel.data(tableModel.index(0, 0)) == '')
lockFirstRowButton.click()
lockFirstColumnButton.click()
#############
self.delayDisplay("Test delete row/column")
- tableView.selectionModel().select(tableModel.index(1,1),qt.QItemSelectionModel.Select) # Select second item in second column
+ tableView.selectionModel().select(tableModel.index(1, 1), qt.QItemSelectionModel.Select) # Select second item in second column
deleteColumnButton.click()
- self.assertTrue( tableNode.GetNumberOfColumns() == initialNumberOfColumns )
+ self.assertTrue(tableNode.GetNumberOfColumns() == initialNumberOfColumns)
- tableView.selectionModel().select(tableModel.index(4,0),qt.QItemSelectionModel.Select) # Select 5th item in first column
+ tableView.selectionModel().select(tableModel.index(4, 0), qt.QItemSelectionModel.Select) # Select 5th item in first column
deleteRowButton.click()
- self.assertTrue( tableNode.GetNumberOfRows() == initialNumberOfRows )
+ self.assertTrue(tableNode.GetNumberOfRows() == initialNumberOfRows)
#############
self.delayDisplay("Test if buttons are disabled")
@@ -182,24 +182,24 @@ def section_TableWidgetButtons(self):
lockTableButton.click()
addRowButton.click()
- self.assertTrue( tableNode.GetNumberOfRows() == initialNumberOfRows )
+ self.assertTrue(tableNode.GetNumberOfRows() == initialNumberOfRows)
addColumnButton.click()
- self.assertTrue( tableNode.GetNumberOfColumns() == initialNumberOfColumns )
+ self.assertTrue(tableNode.GetNumberOfColumns() == initialNumberOfColumns)
- tableView.selectionModel().select(tableView.model().index(0,0),qt.QItemSelectionModel.Select)
+ tableView.selectionModel().select(tableView.model().index(0, 0), qt.QItemSelectionModel.Select)
deleteColumnButton.click()
- self.assertTrue( tableNode.GetNumberOfColumns() == initialNumberOfColumns )
+ self.assertTrue(tableNode.GetNumberOfColumns() == initialNumberOfColumns)
deleteRowButton.click()
- self.assertTrue( tableNode.GetNumberOfRows() == initialNumberOfRows )
+ self.assertTrue(tableNode.GetNumberOfRows() == initialNumberOfRows)
lockFirstRowButton.click()
- self.assertTrue( tableModel.data(tableModel.index(0,0)) == 'Column 1' )
+ self.assertTrue(tableModel.data(tableModel.index(0, 0)) == 'Column 1')
lockFirstColumnButton.click()
- self.assertTrue( tableModel.data(tableModel.index(0,0)) == 'Column 1' )
+ self.assertTrue(tableModel.data(tableModel.index(0, 0)) == 'Column 1')
lockTableButton.click()
@@ -213,12 +213,12 @@ def section_TableWidgetButtons(self):
# Paste first column into a newly created second column
addColumnButton.click()
- tableView.setCurrentIndex(tableModel.index(0,1))
+ tableView.setCurrentIndex(tableModel.index(0, 1))
pasteButton.click()
# Check if first and second column content is the same
for rowIndex in range(5):
- self.assertEqual( tableModel.data(tableModel.index(rowIndex,0)), tableModel.data(tableModel.index(rowIndex,1)) )
+ self.assertEqual(tableModel.data(tableModel.index(rowIndex, 0)), tableModel.data(tableModel.index(rowIndex, 1)))
# ------------------------------------------------------------------------------
def section_CliTableInputOutput(self):
@@ -236,8 +236,8 @@ def section_CliTableInputOutput(self):
inputTableNode.AddEmptyRow()
for row in range(3):
for col in range(3):
- inputTableNode.SetCellText(row,col,str((row+1)*(col+1)))
- inputTableNode.SetCellText(0,0,"source")
+ inputTableNode.SetCellText(row, col, str((row + 1) * (col + 1)))
+ inputTableNode.SetCellText(0, 0, "source")
outputTableNode = slicer.vtkMRMLTableNode()
slicer.mrmlScene.AddNode(outputTableNode)
@@ -261,12 +261,12 @@ def section_CliTableInputOutput(self):
# of the first column, which is set to "Computed first" and "Computed second" strings
for row in range(3):
for col in range(3):
- if row==0 and col==0:
- self.assertTrue( outputTableNode.GetCellText(row, col) == "Computed first")
- elif row==1 and col==0:
- self.assertTrue( outputTableNode.GetCellText(row, col) == "Computed second")
+ if row == 0 and col == 0:
+ self.assertTrue(outputTableNode.GetCellText(row, col) == "Computed first")
+ elif row == 1 and col == 0:
+ self.assertTrue(outputTableNode.GetCellText(row, col) == "Computed second")
else:
- self.assertTrue( outputTableNode.GetCellText(row, col) == inputTableNode.GetCellText(row, col) )
+ self.assertTrue(outputTableNode.GetCellText(row, col) == inputTableNode.GetCellText(row, col))
def createDummyTransform(self):
transformNode = slicer.vtkMRMLLinearTransformNode()
@@ -275,7 +275,7 @@ def createDummyTransform(self):
def createDummyVolume(self):
imageData = vtk.vtkImageData()
- imageData.SetDimensions(10,10,10)
+ imageData.SetDimensions(10, 10, 10)
imageData.AllocateScalars(vtk.VTK_UNSIGNED_CHAR, 1)
volumeNode = slicer.vtkMRMLScalarVolumeNode()
volumeNode.SetAndObserveImageData(imageData)
diff --git a/Modules/Loadable/VolumeRendering/Testing/Python/VolumeRendering_CTAbdomenTutorial.py b/Modules/Loadable/VolumeRendering/Testing/Python/VolumeRendering_CTAbdomenTutorial.py
index d5f343e0217..faa9446bd6c 100644
--- a/Modules/Loadable/VolumeRendering/Testing/Python/VolumeRendering_CTAbdomenTutorial.py
+++ b/Modules/Loadable/VolumeRendering/Testing/Python/VolumeRendering_CTAbdomenTutorial.py
@@ -4,5 +4,5 @@
filepath = datapath.input + '/VolumeRendering_CTAbdomenTutorial.xml'
testUtility = slicer.app.testingUtility()
success = testUtility.playTests(filepath)
-if not success :
+if not success:
raise Exception('Failed to finished properly the play back !')
diff --git a/Modules/Loadable/VolumeRendering/Testing/Python/VolumeRendering_CTAbdomen_AppleTutorial.py b/Modules/Loadable/VolumeRendering/Testing/Python/VolumeRendering_CTAbdomen_AppleTutorial.py
index ae4a92e4abf..9890be05902 100644
--- a/Modules/Loadable/VolumeRendering/Testing/Python/VolumeRendering_CTAbdomen_AppleTutorial.py
+++ b/Modules/Loadable/VolumeRendering/Testing/Python/VolumeRendering_CTAbdomen_AppleTutorial.py
@@ -4,5 +4,5 @@
filepath = datapath.input + '/VolumeRendering_CTAbdomen_AppleTutorial.xml'
testUtility = slicer.app.testingUtility()
success = testUtility.playTests(filepath)
-if not success :
+if not success:
raise Exception('Failed to finished properly the play back !')
diff --git a/Modules/Loadable/Volumes/Testing/Python/VolumesLogicCompareVolumeGeometry.py b/Modules/Loadable/Volumes/Testing/Python/VolumesLogicCompareVolumeGeometry.py
index eeb70657e61..2ba77240819 100644
--- a/Modules/Loadable/Volumes/Testing/Python/VolumesLogicCompareVolumeGeometry.py
+++ b/Modules/Loadable/Volumes/Testing/Python/VolumesLogicCompareVolumeGeometry.py
@@ -41,7 +41,7 @@ def test_VolumesLogicCompareVolumeGeometry(self):
print(warningString)
return False
else:
- print('Success in comparing MRHead vs itself with epsilon',volumesLogic.GetCompareVolumeGeometryEpsilon())
+ print('Success in comparing MRHead vs itself with epsilon', volumesLogic.GetCompareVolumeGeometryEpsilon())
#
# see if you can get it to fail with a tighter epsilon
@@ -57,7 +57,7 @@ def test_VolumesLogicCompareVolumeGeometry(self):
print(warningString)
return False
else:
- print('Success in comparing MRHead vs itself with epsilon',volumesLogic.GetCompareVolumeGeometryEpsilon())
+ print('Success in comparing MRHead vs itself with epsilon', volumesLogic.GetCompareVolumeGeometryEpsilon())
#
# clone the volume so can test for mismatches in geometry with
@@ -65,13 +65,13 @@ def test_VolumesLogicCompareVolumeGeometry(self):
#
head2 = volumesLogic.CloneVolume(head, 'head2')
- warningString = volumesLogic.CompareVolumeGeometry(head, head2)
+ warningString = volumesLogic.CompareVolumeGeometry(head, head2)
if len(warningString) != 0:
print('Error in checking MRHead geometry against itself with epsilon ', volumesLogic.GetCompareVolumeGeometryEpsilon())
print(warningString)
return False
else:
- print('Success in comparing MRHead vs clone with epsilon',volumesLogic.GetCompareVolumeGeometryEpsilon())
+ print('Success in comparing MRHead vs clone with epsilon', volumesLogic.GetCompareVolumeGeometryEpsilon())
#
# now try with a label map volume
@@ -79,28 +79,28 @@ def test_VolumesLogicCompareVolumeGeometry(self):
headLabel = volumesLogic.CreateAndAddLabelVolume(head, "label vol")
warningString = volumesLogic.CompareVolumeGeometry(head, headLabel)
if len(warningString) != 0:
- print('Error in comparing MRHead geometry against a label map of itself with epsilon',volumesLogic.GetCompareVolumeGeometryEpsilon())
+ print('Error in comparing MRHead geometry against a label map of itself with epsilon', volumesLogic.GetCompareVolumeGeometryEpsilon())
print(warningString)
return False
else:
- print('Success in comparing MRHead vs label map with epsilon',volumesLogic.GetCompareVolumeGeometryEpsilon())
+ print('Success in comparing MRHead vs label map with epsilon', volumesLogic.GetCompareVolumeGeometryEpsilon())
#
# adjust the geometry and make it fail
#
head2Matrix = vtk.vtkMatrix4x4()
head2.GetRASToIJKMatrix(head2Matrix)
- val = head2Matrix.GetElement(2,0)
- head2Matrix.SetElement(2,0,val+0.25)
+ val = head2Matrix.GetElement(2, 0)
+ head2Matrix.SetElement(2, 0, val + 0.25)
head2.SetRASToIJKMatrix(head2Matrix)
head2.SetSpacing(0.12345678901234567890, 2.0, 3.4)
- warningString = volumesLogic.CompareVolumeGeometry(head,head2)
+ warningString = volumesLogic.CompareVolumeGeometry(head, head2)
if len(warningString) == 0:
- print('Error in comparing MRHead geometry against an updated clone, with epsilon',volumesLogic.GetCompareVolumeGeometryEpsilon())
+ print('Error in comparing MRHead geometry against an updated clone, with epsilon', volumesLogic.GetCompareVolumeGeometryEpsilon())
return False
else:
- print('Success in making the comparison fail, with with epsilon',volumesLogic.GetCompareVolumeGeometryEpsilon())
+ print('Success in making the comparison fail, with with epsilon', volumesLogic.GetCompareVolumeGeometryEpsilon())
print(warningString)
#
@@ -113,9 +113,9 @@ def test_VolumesLogicCompareVolumeGeometry(self):
return False
precision = volumesLogic.GetCompareVolumeGeometryPrecision()
if precision != 2:
- print('Failed to set the precision to 2: ',precision)
+ print('Failed to set the precision to 2: ', precision)
return False
- warningString = volumesLogic.CompareVolumeGeometry(head,head2)
+ warningString = volumesLogic.CompareVolumeGeometry(head, head2)
print(warningString)
self.delayDisplay('Test passed')
diff --git a/Modules/Scripted/CropVolumeSequence/CropVolumeSequence.py b/Modules/Scripted/CropVolumeSequence/CropVolumeSequence.py
index 19808ef794e..8e0e4e50700 100644
--- a/Modules/Scripted/CropVolumeSequence/CropVolumeSequence.py
+++ b/Modules/Scripted/CropVolumeSequence/CropVolumeSequence.py
@@ -64,8 +64,8 @@ def setup(self):
self.inputSelector.noneEnabled = False
self.inputSelector.showHidden = False
self.inputSelector.showChildNodeTypes = False
- self.inputSelector.setMRMLScene( slicer.mrmlScene )
- self.inputSelector.setToolTip( "Pick a sequence node of volumes that will be cropped and resampled." )
+ self.inputSelector.setMRMLScene(slicer.mrmlScene)
+ self.inputSelector.setToolTip("Pick a sequence node of volumes that will be cropped and resampled.")
parametersFormLayout.addRow("Input volume sequence: ", self.inputSelector)
#
@@ -80,8 +80,8 @@ def setup(self):
self.outputSelector.noneDisplay = "(Overwrite input)"
self.outputSelector.showHidden = False
self.outputSelector.showChildNodeTypes = False
- self.outputSelector.setMRMLScene( slicer.mrmlScene )
- self.outputSelector.setToolTip( "Pick a sequence node where the cropped and resampled volumes will be stored." )
+ self.outputSelector.setMRMLScene(slicer.mrmlScene)
+ self.outputSelector.setToolTip("Pick a sequence node where the cropped and resampled volumes will be stored.")
parametersFormLayout.addRow("Output volume sequence: ", self.outputSelector)
#
@@ -96,12 +96,12 @@ def setup(self):
self.cropParametersSelector.noneEnabled = False
self.cropParametersSelector.showHidden = True
self.cropParametersSelector.showChildNodeTypes = False
- self.cropParametersSelector.setMRMLScene( slicer.mrmlScene )
+ self.cropParametersSelector.setMRMLScene(slicer.mrmlScene)
self.cropParametersSelector.setToolTip("Select a crop volumes parameters.")
self.editCropParametersButton = qt.QPushButton()
self.editCropParametersButton.setIcon(qt.QIcon(':Icons/Go.png'))
- #self.editCropParametersButton.setMaximumWidth(60)
+ # self.editCropParametersButton.setMaximumWidth(60)
self.editCropParametersButton.enabled = True
self.editCropParametersButton.toolTip = "Go to Crop Volume module to edit cropping parameters."
hbox = qt.QHBoxLayout()
@@ -188,7 +188,7 @@ def run(self, inputVolSeq, outputVolSeq, cropParameters):
seqBrowser = slicer.mrmlScene.AddNewNodeByClass("vtkMRMLSequenceBrowserNode")
seqBrowser.SetAndObserveMasterSequenceNodeID(inputVolSeq.GetID())
- seqBrowser.SetSaveChanges(inputVolSeq, True) # allow modifying node in the sequence
+ seqBrowser.SetSaveChanges(inputVolSeq, True) # allow modifying node in the sequence
seqBrowser.SetSelectedItemNumber(0)
slicer.modules.sequences.logic().UpdateAllProxyNodes()
@@ -326,7 +326,7 @@ def test_CropVolumeSequence1(self):
slicer.modules.cropvolume.logic().FitROIToInputVolume(cropVolumeNode)
# Crop volume sequence
- CropVolumeSequenceLogic().run(sequenceNode,croppedSequenceNode,cropVolumeNode)
+ CropVolumeSequenceLogic().run(sequenceNode, croppedSequenceNode, cropVolumeNode)
# Verify results
diff --git a/Modules/Scripted/DICOM/DICOM.py b/Modules/Scripted/DICOM/DICOM.py
index 9a8b2acb1ce..0aa6b7dcdd9 100644
--- a/Modules/Scripted/DICOM/DICOM.py
+++ b/Modules/Scripted/DICOM/DICOM.py
@@ -26,7 +26,7 @@ def __init__(self, parent):
ScriptedLoadableModule.__init__(self, parent)
self.parent.title = "DICOM"
- self.parent.categories = ["", "Informatics"] # top level module
+ self.parent.categories = ["", "Informatics"] # top level module
self.parent.contributors = ["Steve Pieper (Isomics)", "Andras Lasso (PerkLab)"]
self.parent.helpText = """
This module allows importing, loading, and exporting DICOM files, and sending receiving data using DICOM networking.
@@ -72,7 +72,7 @@ def performPostModuleDiscoveryTasks(self):
return
self.postModuleDiscoveryTasksPerformed = True
- if slicer.mrmlScene.GetTagByClassName( "vtkMRMLScriptedModuleNode" ) != 'ScriptedModule':
+ if slicer.mrmlScene.GetTagByClassName("vtkMRMLScriptedModuleNode") != 'ScriptedModule':
slicer.mrmlScene.RegisterNodeClass(vtkMRMLScriptedModuleNode())
self.initializeDICOMDatabase()
@@ -118,7 +118,7 @@ def onURLReceived(self, urlString):
url = qt.QUrl(urlString)
if (url.authority().lower() != "viewer"):
- logging.debug("DICOM module ignores non-viewer URL: "+urlString)
+ logging.debug("DICOM module ignores non-viewer URL: " + urlString)
return
query = qt.QUrlQuery(url)
queryMap = {}
@@ -126,13 +126,13 @@ def onURLReceived(self, urlString):
queryMap[key] = qt.QUrl.fromPercentEncoding(value)
if not "dicomweb_endpoint" in queryMap:
- logging.debug("DICOM module ignores URL without dicomweb_endpoint query parameter: "+urlString)
+ logging.debug("DICOM module ignores URL without dicomweb_endpoint query parameter: " + urlString)
return
if not "studyUID" in queryMap:
- logging.debug("DICOM module ignores URL without studyUID query parameter: "+urlString)
+ logging.debug("DICOM module ignores URL without studyUID query parameter: " + urlString)
return
- logging.info("DICOM module received URL: "+urlString)
+ logging.info("DICOM module received URL: " + urlString)
accessToken = None
if "access_token" in queryMap:
@@ -167,18 +167,18 @@ def initializeDICOMDatabase(self):
# Try to initialize the database using the location stored in settings
if slicer.app.commandOptions().testingEnabled:
# For automatic tests (use a separate DICOM database for testing)
- slicer.dicomDatabaseDirectorySettingsKey = 'DatabaseDirectoryTest_'+ctk.ctkDICOMDatabase().schemaVersion()
+ slicer.dicomDatabaseDirectorySettingsKey = 'DatabaseDirectoryTest_' + ctk.ctkDICOMDatabase().schemaVersion()
databaseDirectory = os.path.join(slicer.app.temporaryPath,
- 'temp'+slicer.app.applicationName+'DICOMDatabase_'+ctk.ctkDICOMDatabase().schemaVersion())
+ 'temp' + slicer.app.applicationName + 'DICOMDatabase_' + ctk.ctkDICOMDatabase().schemaVersion())
else:
# For production
- slicer.dicomDatabaseDirectorySettingsKey = 'DatabaseDirectory_'+ctk.ctkDICOMDatabase().schemaVersion()
+ slicer.dicomDatabaseDirectorySettingsKey = 'DatabaseDirectory_' + ctk.ctkDICOMDatabase().schemaVersion()
settings = qt.QSettings()
databaseDirectory = settings.value(slicer.dicomDatabaseDirectorySettingsKey)
if not databaseDirectory:
documentsLocation = qt.QStandardPaths.DocumentsLocation
documents = qt.QStandardPaths.writableLocation(documentsLocation)
- databaseDirectory = os.path.join(documents, slicer.app.applicationName+"DICOMDatabase")
+ databaseDirectory = os.path.join(documents, slicer.app.applicationName + "DICOMDatabase")
settings.setValue(slicer.dicomDatabaseDirectorySettingsKey, databaseDirectory)
# Attempt to open the database. If it fails then user will have to configure it using DICOM module.
@@ -208,7 +208,7 @@ def startListener(self):
logging.error("Failed to start DICOM listener. Process start failed.")
return False
slicer.dicomListener = dicomListener
- logging.info("DICOM C-Store SCP service started at port "+str(slicer.dicomListener.port))
+ logging.info("DICOM C-Store SCP service started at port " + str(slicer.dicomListener.port))
def stopListener(self):
if hasattr(slicer, 'dicomListener'):
@@ -391,7 +391,7 @@ class DICOMFileDialog:
and commit http://svn.slicer.org/Slicer4/trunk@21951 and issue #3081
"""
- def __init__(self,qSlicerFileDialog):
+ def __init__(self, qSlicerFileDialog):
self.qSlicerFileDialog = qSlicerFileDialog
qSlicerFileDialog.fileType = 'DICOM Directory'
qSlicerFileDialog.description = 'Load directory into DICOM database'
@@ -415,10 +415,10 @@ def pathsFromMimeData(mimeData):
if mimeData.hasFormat('text/uri-list'):
urls = mimeData.urls()
for url in urls:
- localPath = url.toLocalFile() # convert QUrl to local path
+ localPath = url.toLocalFile() # convert QUrl to local path
pathInfo = qt.QFileInfo()
- pathInfo.setFile(localPath) # information about the path
- if pathInfo.isDir(): # if it is a directory we add the files to the dialog
+ pathInfo.setFile(localPath) # information about the path
+ if pathInfo.isDir(): # if it is a directory we add the files to the dialog
directoriesToAdd.append(localPath)
else:
filesToAdd.append(localPath)
@@ -661,8 +661,8 @@ def setup(self):
mw = slicer.util.mainWindow()
if mw:
try:
- action = slicer.util.findChildren(mw,name='LoadDICOMAction')[0]
- action.connect('triggered()',self.onOpenBrowserWidget)
+ action = slicer.util.findChildren(mw, name='LoadDICOMAction')[0]
+ action.connect('triggered()', self.onOpenBrowserWidget)
except IndexError:
logging.error('Could not connect to the main window DICOM button')
@@ -807,7 +807,7 @@ def onListenerStateChanged(self, newState=None):
self.ui.listenerStateLabel.text = "starting"
if newState == 2:
port = str(slicer.dicomListener.port) if hasattr(slicer, 'dicomListener') else "unknown"
- self.ui.listenerStateLabel.text = "running at port "+port
+ self.ui.listenerStateLabel.text = "running at port " + port
self.ui.toggleListener.checked = True
def onListenerToAddFile(self):
@@ -856,16 +856,16 @@ def onToggleServer(self):
self.tmpDir = tmpDir + '/DICOM'
if not os.path.exists(self.tmpDir):
os.mkdir(self.tmpDir)
- self.testingServer = DICOMLib.DICOMTestingQRServer(exeDir=self.exeDir,tmpDir=self.tmpDir)
+ self.testingServer = DICOMLib.DICOMTestingQRServer(exeDir=self.exeDir, tmpDir=self.tmpDir)
# look for the sample data to load (only works on build trees
# with standard naming conventions)
- self.dataDir = slicer.app.slicerHome + '/../../Slicer4/Testing/Data/Input/CTHeadAxialDicom'
- files = glob.glob(self.dataDir+'/*.dcm')
+ self.dataDir = slicer.app.slicerHome + '/../../Slicer4/Testing/Data/Input/CTHeadAxialDicom'
+ files = glob.glob(self.dataDir + '/*.dcm')
# now start the server
- self.testingServer.start(verbose=self.verboseServer.checked,initialFiles=files)
- #self.toggleServer.text = "Stop Testing Server"
+ self.testingServer.start(verbose=self.verboseServer.checked, initialFiles=files)
+ # self.toggleServer.text = "Stop Testing Server"
def onRunListenerAtStart(self, toggled):
settings = qt.QSettings()
@@ -874,7 +874,7 @@ def onRunListenerAtStart(self, toggled):
def updateDatabaseDirectoryFromWidget(self, databaseDirectory):
self.browserWidget.dicomBrowser.databaseDirectory = databaseDirectory
- def updateDatabaseDirectoryFromBrowser(self,databaseDirectory):
+ def updateDatabaseDirectoryFromBrowser(self, databaseDirectory):
wasBlocked = self.ui.directoryButton.blockSignals(True)
self.ui.directoryButton.directory = databaseDirectory
self.ui.directoryButton.blockSignals(wasBlocked)
diff --git a/Modules/Scripted/DICOMLib/DICOMBrowser.py b/Modules/Scripted/DICOMLib/DICOMBrowser.py
index ac306fdcda2..d68fd12a7a5 100644
--- a/Modules/Scripted/DICOMLib/DICOMBrowser.py
+++ b/Modules/Scripted/DICOMLib/DICOMBrowser.py
@@ -35,7 +35,7 @@ class SlicerDICOMBrowser(VTKObservationMixin, qt.QWidget):
This is a helper used in the DICOMWidget class.
"""
- closed = qt.Signal() # Invoked when the dicom widget is closed using the close method
+ closed = qt.Signal() # Invoked when the dicom widget is closed using the close method
def __init__(self, dicomBrowser=None, parent="mainWindow"):
VTKObservationMixin.__init__(self)
@@ -177,13 +177,13 @@ def setup(self, showPreview=False):
def updateButtonStates(self):
if self.advancedView:
- #self.loadButton.enabled = loadEnabled = loadEnabled or loadablesByPlugin[plugin] != []
+ # self.loadButton.enabled = loadEnabled = loadEnabled or loadablesByPlugin[plugin] != []
loadablesChecked = self.loadableTable.getNumberOfCheckedItems() > 0
self.loadButton.enabled = loadablesChecked
self.examineButton.enabled = len(self.fileLists) != 0
self.uncheckAllButton.enabled = loadablesChecked
else:
- #seriesSelected = self.dicomBrowser.dicomTableManager().seriesTable().tableView().selectedIndexes()
+ # seriesSelected = self.dicomBrowser.dicomTableManager().seriesTable().tableView().selectedIndexes()
self.loadButton.enabled = self.fileLists
def onDirectoryImported(self):
diff --git a/Modules/Scripted/DICOMLib/DICOMExportScalarVolume.py b/Modules/Scripted/DICOMLib/DICOMExportScalarVolume.py
index b50c1939059..733b2bb3c3f 100644
--- a/Modules/Scripted/DICOMLib/DICOMExportScalarVolume.py
+++ b/Modules/Scripted/DICOMLib/DICOMExportScalarVolume.py
@@ -23,7 +23,7 @@ class DICOMExportScalarVolume:
TODO: delete temp directories and files
"""
- def __init__(self,studyUID,volumeNode,tags,directory,filenamePrefix=None):
+ def __init__(self, studyUID, volumeNode, tags, directory, filenamePrefix=None):
"""
studyUID parameter is not used (studyUID is retrieved from tags).
"""
@@ -32,9 +32,9 @@ def __init__(self,studyUID,volumeNode,tags,directory,filenamePrefix=None):
self.tags = tags
self.directory = directory
self.filenamePrefix = filenamePrefix if filenamePrefix else "IMG"
- #self.referenceFile = None
+ # self.referenceFile = None
- #TODO: May come in use when appending to existing study
+ # TODO: May come in use when appending to existing study
# def parametersFromStudy(self,studyUID=None):
# """Return a dictionary of the required conversion parameters
# based on the studyUID found in the dicom dictionary (empty if
@@ -91,7 +91,7 @@ def __init__(self,studyUID,volumeNode,tags,directory,filenamePrefix=None):
# p[tags[tag]] = value
# return p
- def progress(self,string):
+ def progress(self, string):
# TODO: make this a callback for a gui progress dialog
print(string)
@@ -134,8 +134,8 @@ def export(self):
else:
# labelmap volume
scalarRange = displayNode.GetScalarRange()
- cliparameters['windowCenter'] = str((scalarRange[0]+scalarRange[0])/2.0)
- cliparameters['windowWidth'] = str(scalarRange[1]-scalarRange[0])
+ cliparameters['windowCenter'] = str((scalarRange[0] + scalarRange[0]) / 2.0)
+ cliparameters['windowWidth'] = str(scalarRange[1] - scalarRange[0])
cliparameters['contentDate'] = self.tags['Content Date']
cliparameters['contentTime'] = self.tags['Content Time']
diff --git a/Modules/Scripted/DICOMLib/DICOMExportScene.py b/Modules/Scripted/DICOMLib/DICOMExportScene.py
index a9211313730..403321afe27 100644
--- a/Modules/Scripted/DICOMLib/DICOMExportScene.py
+++ b/Modules/Scripted/DICOMLib/DICOMExportScene.py
@@ -49,7 +49,7 @@ def __init__(self, referenceFile, saveDirectoryPath=None):
# Dictionary where the keys are the tag names (such as StudyInstanceUID), and the values are the tag values
self.optionalTags = {}
- def progress(self,string):
+ def progress(self, string):
# TODO: make this a callback for a gui progress dialog
logging.info(string)
@@ -94,12 +94,12 @@ def createDICOMFileForScene(self):
imageReader.Update()
# Clean up paths on Windows (some commands and operations are not performed properly with mixed slash and backslash)
- self.saveDirectoryPath = self.saveDirectoryPath.replace('\\','/')
- self.imageFile = self.imageFile.replace('\\','/')
- self.zipFile = self.zipFile.replace('\\','/')
- self.dumpFile = self.dumpFile.replace('\\','/')
- self.templateFile = self.templateFile.replace('\\','/')
- self.sdbFile = self.sdbFile.replace('\\','/')
+ self.saveDirectoryPath = self.saveDirectoryPath.replace('\\', '/')
+ self.imageFile = self.imageFile.replace('\\', '/')
+ self.zipFile = self.zipFile.replace('\\', '/')
+ self.dumpFile = self.dumpFile.replace('\\', '/')
+ self.templateFile = self.templateFile.replace('\\', '/')
+ self.sdbFile = self.sdbFile.replace('\\', '/')
# save the scene to the temp dir
self.progress('Saving scene into MRB...')
@@ -139,7 +139,7 @@ def createDICOMFileForScene(self):
fp.close()
self.progress('Encapsulating scene in DICOM dump...')
- args = [ self.dumpFile, self.templateFile, '--generate-new-uids', '--overwrite-uids', '--ignore-errors' ]
+ args = [self.dumpFile, self.templateFile, '--generate-new-uids', '--overwrite-uids', '--ignore-errors']
DICOMLib.DICOMCommand('dump2dcm', args).start()
# now create the Secondary Capture data set
@@ -149,12 +149,12 @@ def createDICOMFileForScene(self):
'-k', 'StudyDescription=%s' % str(self.studyDescription),
'-k', 'SeriesDescription=%s' % str(self.seriesDescription),
'--dataset-from', self.templateFile,
- self.imageFile, self.sdbFile ]
+ self.imageFile, self.sdbFile]
argIndex = 6
for key, value in self.optionalTags.items():
args.insert(argIndex, '-k')
tagNameValue = f'{str(key)}={str(value)}'
- args.insert(argIndex+1, tagNameValue)
+ args.insert(argIndex + 1, tagNameValue)
argIndex += 2
self.progress('Creating DICOM binary file...')
DICOMLib.DICOMCommand('img2dcm', args).start()
diff --git a/Modules/Scripted/DICOMLib/DICOMPlugin.py b/Modules/Scripted/DICOMLib/DICOMPlugin.py
index e2bfdc13b4e..261707b3850 100644
--- a/Modules/Scripted/DICOMLib/DICOMPlugin.py
+++ b/Modules/Scripted/DICOMLib/DICOMPlugin.py
@@ -113,7 +113,7 @@ def isDetailedLogging(self):
"""
return slicer.util.settingsValue('DICOM/detailedLogging', False, converter=slicer.util.toBool)
- def hashFiles(self,files):
+ def hashFiles(self, files):
"""Create a hash key for a list of files"""
try:
import hashlib
@@ -125,7 +125,7 @@ def hashFiles(self,files):
m.update(f.encode('UTF-8', 'ignore'))
return(m.digest())
- def getCachedLoadables(self,files):
+ def getCachedLoadables(self, files):
""" Helper method to access the results of a previous
examination of a list of files"""
key = self.hashFiles(files)
@@ -133,33 +133,33 @@ def getCachedLoadables(self,files):
return self.loadableCache[key]
return None
- def cacheLoadables(self,files,loadables):
+ def cacheLoadables(self, files, loadables):
""" Helper method to store the results of examining a list
of files for later quick access"""
key = self.hashFiles(files)
self.loadableCache[key] = loadables
- def examineForImport(self,fileList):
+ def examineForImport(self, fileList):
"""Look at the list of lists of filenames and return
a list of DICOMLoadables that are options for loading
Virtual: should be overridden by the subclass
"""
return []
- def examine(self,fileList):
+ def examine(self, fileList):
"""Backwards compatibility function for examineForImport
(renamed on introducing examineForExport to avoid confusion)
"""
return self.examineForImport(fileList)
- def load(self,loadable):
+ def load(self, loadable):
"""Accept a DICOMLoadable and perform the operation to convert
the referenced data into MRML nodes
Virtual: should be overridden by the subclass
"""
return True
- def examineForExport(self,subjectHierarchyItemID):
+ def examineForExport(self, subjectHierarchyItemID):
"""Return a list of DICOMExportable instances that describe the
available techniques that this plugin offers to convert MRML
data associated to a subject hierarchy item into DICOM data
@@ -167,21 +167,21 @@ def examineForExport(self,subjectHierarchyItemID):
"""
return []
- def export(self,exportable):
+ def export(self, exportable):
"""Export an exportable (one series) to file(s)
Return error message, empty if success
Virtual: should be overridden by the subclass
"""
return ""
- def defaultSeriesNodeName(self,seriesUID):
+ def defaultSeriesNodeName(self, seriesUID):
"""Generate a name suitable for use as a mrml node name based
on the series level data in the database"""
instanceFilePaths = slicer.dicomDatabase.filesForSeries(seriesUID, 1)
if len(instanceFilePaths) == 0:
return "Unnamed Series"
- seriesDescription = slicer.dicomDatabase.fileValue(instanceFilePaths[0],self.tags['seriesDescription'])
- seriesNumber = slicer.dicomDatabase.fileValue(instanceFilePaths[0],self.tags['seriesNumber'])
+ seriesDescription = slicer.dicomDatabase.fileValue(instanceFilePaths[0], self.tags['seriesDescription'])
+ seriesNumber = slicer.dicomDatabase.fileValue(instanceFilePaths[0], self.tags['seriesNumber'])
name = seriesDescription
if seriesDescription == "":
name = "Unnamed Series"
@@ -189,7 +189,7 @@ def defaultSeriesNodeName(self,seriesUID):
name = seriesNumber + ": " + name
return name
- def addSeriesInSubjectHierarchy(self,loadable,dataNode):
+ def addSeriesInSubjectHierarchy(self, loadable, dataNode):
"""Add loaded DICOM series into subject hierarchy.
The DICOM tags are read from the first file referenced by the
given loadable. The dataNode argument is associated to the created
@@ -240,18 +240,18 @@ def addSeriesInSubjectHierarchy(self,loadable,dataNode):
seriesItemID = shn.CreateItem(sceneItemID, dataNode)
# Specify details of series item
- seriesInstanceUid = slicer.dicomDatabase.fileValue(firstFile,tags['seriesInstanceUID'])
+ seriesInstanceUid = slicer.dicomDatabase.fileValue(firstFile, tags['seriesInstanceUID'])
shn.SetItemUID(seriesItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMUIDName(), seriesInstanceUid)
- shn.SetItemAttribute( seriesItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMSeriesModalityAttributeName(),
- slicer.dicomDatabase.fileValue(firstFile, tags['seriesModality']) )
- shn.SetItemAttribute( seriesItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMSeriesNumberAttributeName(),
- slicer.dicomDatabase.fileValue(firstFile, tags['seriesNumber']) )
- shn.SetItemAttribute( seriesItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMFrameOfReferenceUIDAttributeName(),
- slicer.dicomDatabase.fileValue(firstFile, tags['frameOfReferenceUID']) )
+ shn.SetItemAttribute(seriesItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMSeriesModalityAttributeName(),
+ slicer.dicomDatabase.fileValue(firstFile, tags['seriesModality']))
+ shn.SetItemAttribute(seriesItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMSeriesNumberAttributeName(),
+ slicer.dicomDatabase.fileValue(firstFile, tags['seriesNumber']))
+ shn.SetItemAttribute(seriesItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMFrameOfReferenceUIDAttributeName(),
+ slicer.dicomDatabase.fileValue(firstFile, tags['frameOfReferenceUID']))
# Set instance UIDs
instanceUIDs = ""
for file in loadable.files:
- uid = slicer.dicomDatabase.fileValue(file,tags['instanceUID'])
+ uid = slicer.dicomDatabase.fileValue(file, tags['instanceUID'])
if uid == "":
uid = "Unknown"
instanceUIDs += uid + " "
@@ -260,12 +260,12 @@ def addSeriesInSubjectHierarchy(self,loadable,dataNode):
# Set referenced instance UIDs from loadable to series
referencedInstanceUIDs = ""
- if hasattr(loadable,'referencedInstanceUIDs'):
+ if hasattr(loadable, 'referencedInstanceUIDs'):
for instanceUID in loadable.referencedInstanceUIDs:
referencedInstanceUIDs += instanceUID + " "
referencedInstanceUIDs = referencedInstanceUIDs[:-1] # strip last space
- shn.SetItemAttribute( seriesItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMReferencedInstanceUIDsAttributeName(),
- referencedInstanceUIDs )
+ shn.SetItemAttribute(seriesItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMReferencedInstanceUIDsAttributeName(),
+ referencedInstanceUIDs)
# Add series item to hierarchy under the right study and patient items. If they are present then used, if not, then created
studyInstanceUid = slicer.dicomDatabase.fileValue(firstFile, tags['studyInstanceUID'])
@@ -275,7 +275,7 @@ def addSeriesInSubjectHierarchy(self,loadable,dataNode):
# the standard (e.g., incorrectly anonymized) and have empty patient tag. We generate a unique ID from the study instance UID.
# The DICOM browser uses the study instance UID as patient ID directly, but this would not work in the subject hierarchy, because
# then the DICOM UID of the patient and study tag would be the same, so we add a prefix ("Patient-").
- patientId = "Patient-"+studyInstanceUid
+ patientId = "Patient-" + studyInstanceUid
patientItemID = shn.GetItemByUID(slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMUIDName(), patientId)
studyId = slicer.dicomDatabase.fileValue(firstFile, tags['studyID'])
studyItemID = shn.GetItemByUID(slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMUIDName(), studyInstanceUid)
@@ -285,21 +285,21 @@ def addSeriesInSubjectHierarchy(self,loadable,dataNode):
patientItemID = shn.GetItemByUID(slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMUIDName(), patientId)
if patientItemID:
# Add attributes for DICOM tags
- patientName = slicer.dicomDatabase.fileValue(firstFile,tags['patientName'])
+ patientName = slicer.dicomDatabase.fileValue(firstFile, tags['patientName'])
if patientName == '':
patientName = 'No name'
- shn.SetItemAttribute( patientItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMPatientNameAttributeName(),
- patientName )
- shn.SetItemAttribute( patientItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMPatientIDAttributeName(),
- patientId )
- shn.SetItemAttribute( patientItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMPatientSexAttributeName(),
- slicer.dicomDatabase.fileValue(firstFile, tags['patientSex']) )
+ shn.SetItemAttribute(patientItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMPatientNameAttributeName(),
+ patientName)
+ shn.SetItemAttribute(patientItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMPatientIDAttributeName(),
+ patientId)
+ shn.SetItemAttribute(patientItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMPatientSexAttributeName(),
+ slicer.dicomDatabase.fileValue(firstFile, tags['patientSex']))
patientBirthDate = slicer.dicomDatabase.fileValue(firstFile, tags['patientBirthDate'])
- shn.SetItemAttribute( patientItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMPatientBirthDateAttributeName(),
- patientBirthDate )
- shn.SetItemAttribute( patientItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMPatientCommentsAttributeName(),
- slicer.dicomDatabase.fileValue(firstFile, tags['patientComments']) )
+ shn.SetItemAttribute(patientItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMPatientBirthDateAttributeName(),
+ patientBirthDate)
+ shn.SetItemAttribute(patientItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMPatientCommentsAttributeName(),
+ slicer.dicomDatabase.fileValue(firstFile, tags['patientComments']))
# Set item name
patientItemName = patientName
if pluginHandlerSingleton.displayPatientIDInSubjectHierarchyItemName:
@@ -312,21 +312,21 @@ def addSeriesInSubjectHierarchy(self,loadable,dataNode):
studyItemID = shn.GetItemByUID(slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMUIDName(), studyInstanceUid)
if studyItemID:
# Add attributes for DICOM tags
- studyDescription = slicer.dicomDatabase.fileValue(firstFile,tags['studyDescription'])
+ studyDescription = slicer.dicomDatabase.fileValue(firstFile, tags['studyDescription'])
if studyDescription == '':
studyDescription = 'No study description'
- shn.SetItemAttribute( studyItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMStudyDescriptionAttributeName(),
- studyDescription )
- studyDate = slicer.dicomDatabase.fileValue(firstFile,tags['studyDate'])
- shn.SetItemAttribute( studyItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMStudyInstanceUIDAttributeName(),
- studyInstanceUid )
- shn.SetItemAttribute( studyItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMStudyIDAttributeName(),
- studyId )
- shn.SetItemAttribute( studyItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMStudyDateAttributeName(),
- studyDate )
- shn.SetItemAttribute( studyItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMStudyTimeAttributeName(),
- slicer.dicomDatabase.fileValue(firstFile, tags['studyTime']) )
+ shn.SetItemAttribute(studyItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMStudyDescriptionAttributeName(),
+ studyDescription)
+ studyDate = slicer.dicomDatabase.fileValue(firstFile, tags['studyDate'])
+ shn.SetItemAttribute(studyItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMStudyInstanceUIDAttributeName(),
+ studyInstanceUid)
+ shn.SetItemAttribute(studyItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMStudyIDAttributeName(),
+ studyId)
+ shn.SetItemAttribute(studyItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMStudyDateAttributeName(),
+ studyDate)
+ shn.SetItemAttribute(studyItemID, slicer.vtkMRMLSubjectHierarchyConstants.GetDICOMStudyTimeAttributeName(),
+ slicer.dicomDatabase.fileValue(firstFile, tags['studyTime']))
# Set item name
studyItemName = studyDescription
if pluginHandlerSingleton.displayStudyIDInSubjectHierarchyItemName:
diff --git a/Modules/Scripted/DICOMLib/DICOMProcesses.py b/Modules/Scripted/DICOMLib/DICOMProcesses.py
index f1f1d08c733..433244dd179 100644
--- a/Modules/Scripted/DICOMLib/DICOMProcesses.py
+++ b/Modules/Scripted/DICOMLib/DICOMProcesses.py
@@ -60,7 +60,7 @@ def __init__(self):
if os.name == 'nt':
self.exeExtension = '.exe'
- self.QProcessState = {0: 'NotRunning', 1: 'Starting', 2: 'Running',}
+ self.QProcessState = {0: 'NotRunning', 1: 'Starting', 2: 'Running', }
def __del__(self):
self.stop()
@@ -89,7 +89,7 @@ def onStateChanged(self, newState):
return None, None
def stop(self):
- if hasattr(self,'process'):
+ if hasattr(self, 'process'):
if self.process:
logging.debug("stopping DICOM process")
self.process.kill()
@@ -103,9 +103,9 @@ class DICOMCommand(DICOMProcess):
Run a generic dcmtk command and return the stdout
"""
- def __init__(self,cmd,args):
+ def __init__(self, cmd, args):
super().__init__()
- self.executable = self.exeDir+'/'+cmd+self.exeExtension
+ self.executable = self.exeDir + '/' + cmd + self.exeExtension
self.args = args
def __del__(self):
@@ -157,7 +157,7 @@ def __init__(self, incomingDataDir, incomingPort=None):
self.port = settings.value('StoragePort')
self.storescpExecutable = os.path.join(self.exeDir, self.STORESCP_PROCESS_FILE_NAME + self.exeExtension)
- self.dcmdumpExecutable = os.path.join(self.exeDir,'dcmdump'+self.exeExtension)
+ self.dcmdumpExecutable = os.path.join(self.exeDir, 'dcmdump' + self.exeExtension)
def __del__(self):
super().__del__()
@@ -175,7 +175,7 @@ def start(self, cmd=None, args=None):
self.killStoreSCPProcesses()
onReceptionCallback = '%s --load-short --print-short --print-filename --search PatientName "%s/#f"' \
% (self.dcmdumpExecutable, self.incomingDataDir)
- args = [str(self.port), '--accept-all', '--output-directory' , self.incomingDataDir, '--exec-sync',
+ args = [str(self.port), '--accept-all', '--output-directory', self.incomingDataDir, '--exec-sync',
'--exec-on-reception', onReceptionCallback]
logging.debug("Starting storescp process")
super().start(self.storescpExecutable, args)
@@ -398,7 +398,7 @@ class DICOMSender(DICOMProcess):
"""
extended_dicom_config_path = 'DICOM/dcmtk/storescu-seg.cfg'
- def __init__(self,files,address,protocol=None,progressCallback=None,aeTitle=None):
+ def __init__(self, files, address, protocol=None, progressCallback=None, aeTitle=None):
"""protocol: can be DIMSE (default) or DICOMweb
port: optional (if not specified then address URL should contain it)
"""
@@ -418,7 +418,7 @@ def __init__(self,files,address,protocol=None,progressCallback=None,aeTitle=None
def __del__(self):
super().__del__()
- def defaultProgressCallback(self,s):
+ def defaultProgressCallback(self, s):
logging.debug(s)
def send(self):
@@ -468,7 +468,7 @@ def send(self):
if url.path().startswith('/view/'):
# This is a Kheops viewer URL.
# Retrieve the token from the viewer URL and use the Kheops API URL to connect to the server.
- token = url.path().replace('/view/','')
+ token = url.path().replace('/view/', '')
effectiveServerUrl = "https://demo.kheops.online/api"
from requests.auth import HTTPBasicAuth
from dicomweb_client.session_utils import create_session_from_auth
@@ -492,9 +492,9 @@ def send(self):
def dicomSend(self, file, config=None, config_profile='Default'):
"""Send DICOM file to the specified modality."""
- self.storeSCUExecutable = self.exeDir+'/storescu'+self.exeExtension
+ self.storeSCUExecutable = self.exeDir + '/storescu' + self.exeExtension
- ### TODO: maybe use dcmsend (is smarter about the compress/decompress)
+ # TODO: maybe use dcmsend (is smarter about the compress/decompress)
args = []
@@ -555,7 +555,7 @@ class DICOMTestingQRServer:
"""
# TODO: make this use DICOMProcess superclass
- def __init__(self,exeDir=".",tmpDir="./DICOM"):
+ def __init__(self, exeDir=".", tmpDir="./DICOM"):
self.qrProcess = None
self.tmpDir = tmpDir
self.exeDir = exeDir
@@ -566,15 +566,15 @@ def __del__(self):
def qrRunning(self):
return self.qrProcess is not None
- def start(self,verbose=False,initialFiles=None):
+ def start(self, verbose=False, initialFiles=None):
if self.qrRunning():
self.stop()
- self.dcmqrscpExecutable = self.exeDir+'/dcmqrdb/apps/dcmqrscp'
- self.storeSCUExecutable = self.exeDir+'/dcmnet/apps/storescu'
+ self.dcmqrscpExecutable = self.exeDir + '/dcmqrdb/apps/dcmqrscp'
+ self.storeSCUExecutable = self.exeDir + '/dcmnet/apps/storescu'
# make the config file
- cfg = self.tmpDir+"/dcmqrscp.cfg"
+ cfg = self.tmpDir + "/dcmqrscp.cfg"
self.makeConfigFile(cfg, storageDirectory=self.tmpDir)
# start the server!
@@ -585,9 +585,9 @@ def start(self,verbose=False,initialFiles=None):
cmdLine.append(cfg)
self.qrProcess = subprocess.Popen(cmdLine)
# TODO: handle output
- #stdin=subprocess.PIPE,
- #stdout=subprocess.PIPE,
- #stderr=subprocess.PIPE)
+ # stdin=subprocess.PIPE,
+ # stdout=subprocess.PIPE,
+ # stderr=subprocess.PIPE)
# push the data to the server!
if initialFiles:
@@ -610,7 +610,7 @@ def stop(self):
self.qrProcess.wait()
self.qrProcess = None
- def makeConfigFile(self,configFile,storageDirectory='.'):
+ def makeConfigFile(self, configFile, storageDirectory='.'):
""" make a config file for the local instance with just
the parts we need (comments and examples removed).
For examples and the full syntax
@@ -641,6 +641,6 @@ def makeConfigFile(self,configFile,storageDirectory='.'):
"""
config = template % storageDirectory
- fp = open(configFile,'w')
+ fp = open(configFile, 'w')
fp.write(config)
fp.close()
diff --git a/Modules/Scripted/DICOMLib/DICOMRecentActivityWidget.py b/Modules/Scripted/DICOMLib/DICOMRecentActivityWidget.py
index 58121e8c1cd..d59f7c60ca3 100644
--- a/Modules/Scripted/DICOMLib/DICOMRecentActivityWidget.py
+++ b/Modules/Scripted/DICOMLib/DICOMRecentActivityWidget.py
@@ -130,7 +130,7 @@ def onActivated(self, modelIndex):
series = self.recentSeries[modelIndex.row()]
seriesUID = series.series
seriesTableView = self.browserWidget.dicomBrowser.dicomTableManager().seriesTable().tableView()
- foundModelIndex = seriesTableView.model().match(seriesTableView.model().index(0,0), qt.Qt.ItemDataRole(), seriesUID, 1)
+ foundModelIndex = seriesTableView.model().match(seriesTableView.model().index(0, 0), qt.Qt.ItemDataRole(), seriesUID, 1)
if foundModelIndex:
row = foundModelIndex[0].row()
seriesTableView.selectRow(row)
diff --git a/Modules/Scripted/DICOMLib/DICOMSendDialog.py b/Modules/Scripted/DICOMLib/DICOMSendDialog.py
index 703e16212f9..06a1e251a48 100644
--- a/Modules/Scripted/DICOMLib/DICOMSendDialog.py
+++ b/Modules/Scripted/DICOMLib/DICOMSendDialog.py
@@ -33,7 +33,7 @@ def open(self):
self.settings = qt.QSettings()
self.protocolSelectorCombobox = qt.QComboBox()
- self.protocolSelectorCombobox.addItems(["DIMSE","DICOMweb"])
+ self.protocolSelectorCombobox.addItems(["DIMSE", "DICOMweb"])
self.protocolSelectorCombobox.setCurrentText(self.settings.value('DICOM/Send/Protocol', 'DIMSE'))
self.protocolSelectorCombobox.currentIndexChanged.connect(self.onProtocolSelectorChange)
self.dicomFormLayout.addRow("Protocol: ", self.protocolSelectorCombobox)
@@ -79,7 +79,7 @@ def onOk(self):
self.settings.setValue('DICOM/Send/AETitle', aeTitle)
self.settings.setValue('DICOM/Send/Protocol', protocol)
self.progressBar.value = 0
- self.progressBar.maximum = len(self.files)+1
+ self.progressBar.maximum = len(self.files) + 1
self.progressBar.show()
self.cancelRequested = False
okButton = self.bbox.button(self.bbox.Ok)
diff --git a/Modules/Scripted/DICOMLib/DICOMUtils.py b/Modules/Scripted/DICOMLib/DICOMUtils.py
index 05826cd5821..ae29b9c62f2 100644
--- a/Modules/Scripted/DICOMLib/DICOMUtils.py
+++ b/Modules/Scripted/DICOMLib/DICOMUtils.py
@@ -21,7 +21,7 @@
#########################################################
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
def loadPatientByUID(patientUID):
""" Load patient by patient UID from DICOM database.
Returns list of loaded node ids.
@@ -79,7 +79,7 @@ def loadPatientByUID(patientUID):
return loadSeriesByUID(seriesUIDs)
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
def getDatabasePatientUIDByPatientName(name):
""" Get patient UID by patient name for easy loading of a patient
"""
@@ -94,7 +94,7 @@ def getDatabasePatientUIDByPatientName(name):
return None
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
def loadPatientByName(patientName):
""" Load patient by patient name from DICOM database.
Returns list of loaded node ids.
@@ -105,7 +105,7 @@ def loadPatientByName(patientName):
return loadPatientByUID(patientUID)
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
def getDatabasePatientUIDByPatientID(patientID):
""" Get database patient UID by DICOM patient ID for easy loading of a patient
"""
@@ -131,7 +131,7 @@ def getDatabasePatientUIDByPatientID(patientID):
return None
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
def loadPatientByPatientID(patientID):
""" Load patient from DICOM database by DICOM PatientID.
Returns list of loaded node ids.
@@ -142,7 +142,7 @@ def loadPatientByPatientID(patientID):
return loadPatientByUID(patientUID)
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
def loadPatient(uid=None, name=None, patientID=None):
""" Load patient from DICOM database fr uid, name, or patient ID.
Returns list of loaded node ids.
@@ -157,7 +157,7 @@ def loadPatient(uid=None, name=None, patientID=None):
raise ValueError('One of the following arguments needs to be specified: uid, name, patientID')
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
def loadSeriesByUID(seriesUIDs):
""" Load multiple series by UID from DICOM database.
Returns list of loaded node ids.
@@ -218,7 +218,7 @@ def selectHighestConfidenceLoadables(loadablesByPlugin):
loadable.selected = loadable.confidence == highestConfidenceValue
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
def loadByInstanceUID(instanceUID):
""" Load with the most confident loadable that contains the instanceUID from DICOM database.
This helps in the case where an instance is part of a series which may offer multiple
@@ -258,12 +258,12 @@ def loadByInstanceUID(instanceUID):
'loadable': loadable
}
filteredLoadablesByPlugin = {}
- filteredLoadablesByPlugin[highestConfidence['plugin']] = [highestConfidence['loadable'],]
+ filteredLoadablesByPlugin[highestConfidence['plugin']] = [highestConfidence['loadable'], ]
# load the results
return loadLoadables(filteredLoadablesByPlugin)
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
def openDatabase(databaseDir):
"""Open DICOM database in the specified folder"""
if not os.access(databaseDir, os.F_OK):
@@ -277,7 +277,7 @@ def openDatabase(databaseDir):
return True
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
def clearDatabase(dicomDatabase=None):
"""Delete entire content (index and copied files) of the DICOM database"""
# Remove files from index and copied files from disk
@@ -287,7 +287,7 @@ def clearDatabase(dicomDatabase=None):
for patientId in patientIds:
dicomDatabase.removePatient(patientId)
# Delete empty folders remaining after removing copied files
- removeEmptyDirs(dicomDatabase.databaseDirectory+'/dicom')
+ removeEmptyDirs(dicomDatabase.databaseDirectory + '/dicom')
dicomDatabase.databaseChanged()
@@ -301,7 +301,7 @@ def removeEmptyDirs(path):
logging.error("Removing directory failed: " + str(e))
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
def openTemporaryDatabase(directory=None):
""" Temporarily change the main DICOM database folder location,
return current database directory. Useful for tests and demos.
@@ -332,7 +332,7 @@ def openTemporaryDatabase(directory=None):
return originalDatabaseDir
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
def closeTemporaryDatabase(originalDatabaseDir, cleanup=True):
""" Close temporary DICOM database and remove its directory if requested
"""
@@ -369,7 +369,7 @@ def closeTemporaryDatabase(originalDatabaseDir, cleanup=True):
return True
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
def createTemporaryDatabase(directory=None):
""" Open temporary DICOM database, return new database object
"""
@@ -398,7 +398,7 @@ def createTemporaryDatabase(directory=None):
return None
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
def deleteTemporaryDatabase(dicomDatabase, cleanup=True):
""" Close temporary DICOM database and remove its directory if requested
"""
@@ -416,7 +416,7 @@ def deleteTemporaryDatabase(dicomDatabase, cleanup=True):
return True
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
class TemporaryDICOMDatabase:
"""Context manager to conveniently use temporary DICOM database.
It creates a new DICOM database and temporarily sets it as the main
@@ -435,7 +435,7 @@ def __exit__(self, type, value, traceback):
closeTemporaryDatabase(self.originalDatabaseDir)
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
def importDicom(dicomDataDir, dicomDatabase=None, copyFiles=False):
""" Import DICOM files from folder into Slicer database
"""
@@ -454,7 +454,7 @@ def importDicom(dicomDataDir, dicomDatabase=None, copyFiles=False):
return True
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
def loadSeriesWithVerification(seriesUIDs, expectedSelectedPlugins=None, expectedLoadedNodes=None):
""" Load series by UID, and verify loadable selection and loaded nodes.
@@ -487,7 +487,7 @@ def loadSeriesWithVerification(seriesUIDs, expectedSelectedPlugins=None, expecte
if loadable.selected:
if plugin.loadType in actualSelectedPlugins:
count = int(actualSelectedPlugins[plugin.loadType])
- actualSelectedPlugins[plugin.loadType] = count+1
+ actualSelectedPlugins[plugin.loadType] = count + 1
else:
actualSelectedPlugins[plugin.loadType] = 1
for pluginName in expectedSelectedPlugins.keys():
@@ -514,16 +514,16 @@ def loadSeriesWithVerification(seriesUIDs, expectedSelectedPlugins=None, expecte
for nodeType in expectedLoadedNodes.keys():
nodeCollection = slicer.mrmlScene.GetNodesByClass(nodeType)
nodeCollection.UnRegister(None)
- numOfLoadedNodes = nodeCollection.GetNumberOfItems()-actualLoadedNodes[nodeType]
+ numOfLoadedNodes = nodeCollection.GetNumberOfItems() - actualLoadedNodes[nodeType]
if numOfLoadedNodes != expectedLoadedNodes[nodeType]:
logging.error("Number of loaded %s nodes was %d, but %d was expected" % \
- (nodeType, numOfLoadedNodes, expectedLoadedNodes[nodeType]) )
+ (nodeType, numOfLoadedNodes, expectedLoadedNodes[nodeType]))
success = False
return success
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
def allSeriesUIDsInDatabase(database=None):
""" Collect all series instance UIDs in a DICOM database (the Slicer one by default)
@@ -542,7 +542,7 @@ def allSeriesUIDsInDatabase(database=None):
return allSeriesUIDs
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
def seriesUIDsForFiles(files):
""" Collect series instance UIDs belonging to a list of files
"""
@@ -554,11 +554,11 @@ def seriesUIDsForFiles(files):
return seriesUIDs
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
class LoadDICOMFilesToDatabase:
"""Context manager to conveniently load DICOM files downloaded zipped from the internet
"""
- def __init__( self, url, archiveFilePath=None, dicomDataDir=None, \
+ def __init__(self, url, archiveFilePath=None, dicomDataDir=None, \
expectedNumberOfFiles=None, selectedPlugins=None, loadedNodes=None, checksum=None):
from time import gmtime, strftime
if archiveFilePath is None:
@@ -577,7 +577,7 @@ def __init__( self, url, archiveFilePath=None, dicomDataDir=None, \
self.loadedNodes = loadedNodes
def __enter__(self):
- if slicer.util.downloadAndExtractArchive( self.url, self.archiveFilePath, \
+ if slicer.util.downloadAndExtractArchive(self.url, self.archiveFilePath, \
self.dicomDataDir, self.expectedNumberOfExtractedFiles,
checksum=self.checksum):
dicomFiles = slicer.util.getFilesInDirectory(self.dicomDataDir)
@@ -590,7 +590,7 @@ def __exit__(self, type, value, traceback):
pass
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
# TODO: more consistency checks:
# - is there gantry tilt?
# - are the orientations the same for all slices?
@@ -633,15 +633,15 @@ def getSortedImageFiles(filePaths, epsilon=0.01):
sliceAxes = [float(zz) for zz in ref[tags['orientation']].split('\\')]
x = np.array(sliceAxes[:3])
y = np.array(sliceAxes[3:])
- scanAxis = np.cross(x,y)
+ scanAxis = np.cross(x, y)
scanOrigin = np.array([float(zz) for zz in ref[tags['position']].split('\\')])
# For each file in series, calculate the distance along the scan axis, sort files by this
sortList = []
missingGeometry = False
for file in filePaths:
- positionStr = slicer.dicomDatabase.fileValue(file,tags['position'])
- orientationStr = slicer.dicomDatabase.fileValue(file,tags['orientation'])
+ positionStr = slicer.dicomDatabase.fileValue(file, tags['position'])
+ orientationStr = slicer.dicomDatabase.fileValue(file, tags['orientation'])
if not positionStr or positionStr == "" or not orientationStr or orientationStr == "":
missingGeometry = True
break
@@ -658,7 +658,7 @@ def getSortedImageFiles(filePaths, epsilon=0.01):
sortedFiles = sorted(sortList, key=lambda x: x[1])
files = []
distances = {}
- for file,dist in sortedFiles:
+ for file, dist in sortedFiles:
files.append(file)
distances[file] = dist
@@ -677,7 +677,7 @@ def getSortedImageFiles(filePaths, epsilon=0.01):
spacing0 = dist1 - dist0
n = 1
for fileN in files[1:]:
- fileNminus1 = files[n-1]
+ fileNminus1 = files[n - 1]
distN = distances[fileN]
distNminus1 = distances[fileNminus1]
spacingN = distN - distNminus1
@@ -699,7 +699,7 @@ def getSortedImageFiles(filePaths, epsilon=0.01):
return files, distances, warningText
-#------------------------------------------------------------------------------
+# ------------------------------------------------------------------------------
def refreshDICOMWidget():
""" Refresh DICOM browser from database.
It is useful when the database is changed via a database object that is
@@ -735,7 +735,7 @@ def getLoadablesFromFileLists(fileLists, pluginClassNames=None, messages=None, p
pluginInstances[pluginClassName] = slicer.modules.dicomPlugins[pluginClassName]()
plugin = pluginInstances[pluginClassName]
if progressCallback:
- cancelled = progressCallback(pluginClassName, step*100/len(pluginClassNames))
+ cancelled = progressCallback(pluginClassName, step * 100 / len(pluginClassNames))
if cancelled:
break
try:
@@ -782,7 +782,7 @@ def onNodeAdded(caller, event, calldata):
for step, (loadable, plugin) in enumerate(selectedLoadables.items(), start=1):
if progressCallback:
- cancelled = progressCallback(loadable.name, step*100/len(selectedLoadables))
+ cancelled = progressCallback(loadable.name, step * 100 / len(selectedLoadables))
if cancelled:
break
@@ -804,7 +804,7 @@ def onNodeAdded(caller, event, calldata):
for derivedItem in loadable.derivedItems:
indexer = ctk.ctkDICOMIndexer()
if progressCallback:
- cancelled = progressCallback(f"{loadable.name} ({derivedItem})", step*100/len(selectedLoadables))
+ cancelled = progressCallback(f"{loadable.name} ({derivedItem})", step * 100 / len(selectedLoadables))
if cancelled:
break
indexer.addFile(slicer.dicomDatabase, derivedItem)
@@ -855,11 +855,11 @@ def importFromDICOMWeb(dicomWebEndpoint, studyInstanceUID, seriesInstanceUID=Non
slicer.app.processEvents()
if accessToken is None:
- client = DICOMwebClient(url = dicomWebEndpoint)
+ client = DICOMwebClient(url=dicomWebEndpoint)
else:
client = DICOMwebClient(
- url = dicomWebEndpoint,
- headers = { "Authorization": f"Bearer {accessToken}" },
+ url=dicomWebEndpoint,
+ headers={"Authorization": f"Bearer {accessToken}"},
)
seriesList = client.search_for_series(study_instance_uid=studyInstanceUID)
@@ -916,7 +916,7 @@ def importFromDICOMWeb(dicomWebEndpoint, studyInstanceUID, seriesInstanceUID=Non
outputDirectoryPath = outputDirectory.path()
for instanceIndex, instance in enumerate(instances):
- progressDialog.setValue(int(100*instanceIndex/numberOfInstances))
+ progressDialog.setValue(int(100 * instanceIndex / numberOfInstances))
slicer.app.processEvents()
cancelled = progressDialog.wasCanceled
if cancelled:
@@ -963,12 +963,12 @@ def registerSlicerURLHandler():
if os.name == 'nt':
launcherPath = qt.QDir.toNativeSeparators(qt.QFileInfo(slicer.app.launcherExecutableFilePath).absoluteFilePath())
reg = qt.QSettings(f"HKEY_CURRENT_USER\\Software\\Classes", qt.QSettings.NativeFormat)
- reg.setValue(f"{slicer.app.applicationName}/.",f"{slicer.app.applicationName} supported file")
- reg.setValue(f"{slicer.app.applicationName}/URL protocol","")
- reg.setValue(f"{slicer.app.applicationName}/shell/open/command/.",f"\"{launcherPath}\" \"%1\"")
- reg.setValue(f"{slicer.app.applicationName}/DefaultIcon/.",f"{slicer.app.applicationName}.exe,0")
+ reg.setValue(f"{slicer.app.applicationName}/.", f"{slicer.app.applicationName} supported file")
+ reg.setValue(f"{slicer.app.applicationName}/URL protocol", "")
+ reg.setValue(f"{slicer.app.applicationName}/shell/open/command/.", f"\"{launcherPath}\" \"%1\"")
+ reg.setValue(f"{slicer.app.applicationName}/DefaultIcon/.", f"{slicer.app.applicationName}.exe,0")
for ext in ['mrml', 'mrb']:
- reg.setValue(f".{ext}/.",f"{slicer.app.applicationName}")
+ reg.setValue(f".{ext}/.", f"{slicer.app.applicationName}")
reg.setValue(f".{ext}/Content Type", f"application/x-{ext}")
else:
raise NotImplementedError()
diff --git a/Modules/Scripted/DICOMPatcher/DICOMPatcher.py b/Modules/Scripted/DICOMPatcher/DICOMPatcher.py
index e4351f22da0..6a33af2c340 100644
--- a/Modules/Scripted/DICOMPatcher/DICOMPatcher.py
+++ b/Modules/Scripted/DICOMPatcher/DICOMPatcher.py
@@ -137,7 +137,7 @@ def onPatchButton(self):
import tempfile
if not self.outputDirSelector.currentPath:
- self.outputDirSelector.currentPath = tempfile.mkdtemp(prefix="DICOMPatcher-", dir=slicer.app.temporaryPath)
+ self.outputDirSelector.currentPath = tempfile.mkdtemp(prefix="DICOMPatcher-", dir=slicer.app.temporaryPath)
self.inputDirSelector.addCurrentPathToHistory()
self.outputDirSelector.addCurrentPathToHistory()
@@ -167,7 +167,7 @@ def addLog(self, text):
"""Append text to log window
"""
self.statusLabel.appendPlainText(text)
- slicer.app.processEvents() # force update
+ slicer.app.processEvents() # force update
#
@@ -279,8 +279,8 @@ def processDataSet(self, ds):
import pydicom
for tag in self.requiredTags:
- if not hasattr(ds,tag):
- setattr(ds,tag,'')
+ if not hasattr(ds, tag):
+ setattr(ds, tag, '')
# Generate a new SOPInstanceUID to avoid different files having the same SOPInstanceUID
ds.SOPInstanceUID = pydicom.uid.generate_uid(None)
@@ -347,7 +347,7 @@ class AddMissingSliceSpacingToMultiframe(DICOMPatcherRule):
def processDataSet(self, ds):
import pydicom
- if not hasattr(ds,'NumberOfFrames'):
+ if not hasattr(ds, 'NumberOfFrames'):
return
numberOfFrames = ds.NumberOfFrames
if numberOfFrames <= 1:
@@ -356,18 +356,18 @@ def processDataSet(self, ds):
# Multi-frame sequence, we may need to add slice positions
# Error in Dolphin 3D CBCT scanners, they store multiple frames but they keep using CTImageStorage as storage class
- if ds.SOPClassUID == '1.2.840.10008.5.1.4.1.1.2': # Computed Tomography Image IOD
- ds.SOPClassUID = '1.2.840.10008.5.1.4.1.1.2.1' # Enhanced CT Image IOD
+ if ds.SOPClassUID == '1.2.840.10008.5.1.4.1.1.2': # Computed Tomography Image IOD
+ ds.SOPClassUID = '1.2.840.10008.5.1.4.1.1.2.1' # Enhanced CT Image IOD
- sliceStartPosition = ds.ImagePositionPatient if hasattr(ds,'ImagePositionPatient') else [0,0,0]
- sliceAxes = ds.ImageOrientationPatient if hasattr(ds,'ImageOrientationPatient') else [1,0,0,0,1,0]
+ sliceStartPosition = ds.ImagePositionPatient if hasattr(ds, 'ImagePositionPatient') else [0, 0, 0]
+ sliceAxes = ds.ImageOrientationPatient if hasattr(ds, 'ImageOrientationPatient') else [1, 0, 0, 0, 1, 0]
x = sliceAxes[:3]
y = sliceAxes[3:]
- z = [x[1] * y[2] - x[2] * y[1], x[2] * y[0] - x[0] * y[2], x[0] * y[1] - x[1] * y[0]] # cross(x,y)
- sliceSpacing = ds.SliceThickness if hasattr(ds,'SliceThickness') else 1.0
- pixelSpacing = ds.PixelSpacing if hasattr(ds,'PixelSpacing') else [1.0, 1.0]
+ z = [x[1] * y[2] - x[2] * y[1], x[2] * y[0] - x[0] * y[2], x[0] * y[1] - x[1] * y[0]] # cross(x,y)
+ sliceSpacing = ds.SliceThickness if hasattr(ds, 'SliceThickness') else 1.0
+ pixelSpacing = ds.PixelSpacing if hasattr(ds, 'PixelSpacing') else [1.0, 1.0]
- if not (pydicom.tag.Tag(0x5200,0x9229) in ds):
+ if not (pydicom.tag.Tag(0x5200, 0x9229) in ds):
# (5200,9229) SQ (Sequence with undefined length #=1) # u/l, 1 SharedFunctionalGroupsSequence
# (0020,9116) SQ (Sequence with undefined length #=1) # u/l, 1 PlaneOrientationSequence
@@ -379,24 +379,24 @@ def processDataSet(self, ds):
planeOrientationDataSet = pydicom.dataset.Dataset()
planeOrientationDataSet.ImageOrientationPatient = sliceAxes
planeOrientationSequence = pydicom.sequence.Sequence()
- planeOrientationSequence.insert(pydicom.tag.Tag(0x0020,0x9116),planeOrientationDataSet)
+ planeOrientationSequence.insert(pydicom.tag.Tag(0x0020, 0x9116), planeOrientationDataSet)
pixelMeasuresDataSet = pydicom.dataset.Dataset()
pixelMeasuresDataSet.SliceThickness = sliceSpacing
pixelMeasuresDataSet.PixelSpacing = pixelSpacing
pixelMeasuresSequence = pydicom.sequence.Sequence()
- pixelMeasuresSequence.insert(pydicom.tag.Tag(0x0028,0x9110),pixelMeasuresDataSet)
+ pixelMeasuresSequence.insert(pydicom.tag.Tag(0x0028, 0x9110), pixelMeasuresDataSet)
sharedFunctionalGroupsDataSet = pydicom.dataset.Dataset()
sharedFunctionalGroupsDataSet.PlaneOrientationSequence = planeOrientationSequence
sharedFunctionalGroupsDataSet.PixelMeasuresSequence = pixelMeasuresSequence
sharedFunctionalGroupsSequence = pydicom.sequence.Sequence()
- sharedFunctionalGroupsSequence.insert(pydicom.tag.Tag(0x5200,0x9229),sharedFunctionalGroupsDataSet)
+ sharedFunctionalGroupsSequence.insert(pydicom.tag.Tag(0x5200, 0x9229), sharedFunctionalGroupsDataSet)
ds.SharedFunctionalGroupsSequence = sharedFunctionalGroupsSequence
- if not (pydicom.tag.Tag(0x5200,0x9230) in ds):
+ if not (pydicom.tag.Tag(0x5200, 0x9230) in ds):
- #(5200,9230) SQ (Sequence with undefined length #=54) # u/l, 1 PerFrameFunctionalGroupsSequence
+ # (5200,9230) SQ (Sequence with undefined length #=54) # u/l, 1 PerFrameFunctionalGroupsSequence
# (0020,9113) SQ (Sequence with undefined length #=1) # u/l, 1 PlanePositionSequence
# (0020,0032) DS [-94.7012\-312.701\-806.500] # 26, 3 ImagePositionPatient
# (0020,9113) SQ (Sequence with undefined length #=1) # u/l, 1 PlanePositionSequence
@@ -408,15 +408,15 @@ def processDataSet(self, ds):
for frameIndex in range(numberOfFrames):
planePositionDataSet = pydicom.dataset.Dataset()
slicePosition = [
- sliceStartPosition[0]+frameIndex*z[0]*sliceSpacing,
- sliceStartPosition[1]+frameIndex*z[1]*sliceSpacing,
- sliceStartPosition[2]+frameIndex*z[2]*sliceSpacing]
+ sliceStartPosition[0] + frameIndex * z[0] * sliceSpacing,
+ sliceStartPosition[1] + frameIndex * z[1] * sliceSpacing,
+ sliceStartPosition[2] + frameIndex * z[2] * sliceSpacing]
planePositionDataSet.ImagePositionPatient = slicePosition
planePositionSequence = pydicom.sequence.Sequence()
- planePositionSequence.insert(pydicom.tag.Tag(0x0020,0x9113),planePositionDataSet)
+ planePositionSequence.insert(pydicom.tag.Tag(0x0020, 0x9113), planePositionDataSet)
perFrameFunctionalGroupsDataSet = pydicom.dataset.Dataset()
perFrameFunctionalGroupsDataSet.PlanePositionSequence = planePositionSequence
- perFrameFunctionalGroupsSequence.insert(pydicom.tag.Tag(0x5200,0x9230),perFrameFunctionalGroupsDataSet)
+ perFrameFunctionalGroupsSequence.insert(pydicom.tag.Tag(0x5200, 0x9230), perFrameFunctionalGroupsDataSet)
ds.PerFrameFunctionalGroupsSequence = perFrameFunctionalGroupsSequence
@@ -487,12 +487,12 @@ def processStart(self, inputRootDir, outputRootDir):
def getNextItemName(self, prefix, root):
numberOfFilesInFolder = self.numberOfItemsInFolderMap[root] if root in self.numberOfItemsInFolderMap else 0
- self.numberOfItemsInFolderMap[root] = numberOfFilesInFolder+1
+ self.numberOfItemsInFolderMap[root] = numberOfFilesInFolder + 1
return f"{prefix}{numberOfFilesInFolder:03d}"
def generateOutputFilePath(self, ds, filepath):
folderName = ""
- patientNameID = str(ds.PatientName)+"*"+ds.PatientID
+ patientNameID = str(ds.PatientName) + "*" + ds.PatientID
if patientNameID not in self.patientNameIDToFolderMap:
self.patientNameIDToFolderMap[patientNameID] = self.getNextItemName("pa", folderName)
folderName += self.patientNameIDToFolderMap[patientNameID]
@@ -501,9 +501,9 @@ def generateOutputFilePath(self, ds, filepath):
folderName += "/" + self.studyUIDToFolderMap[ds.StudyInstanceUID]
if ds.SeriesInstanceUID not in self.seriesUIDToFolderMap:
self.seriesUIDToFolderMap[ds.SeriesInstanceUID] = self.getNextItemName("se", folderName)
- folderName += "/" +self.seriesUIDToFolderMap[ds.SeriesInstanceUID]
+ folderName += "/" + self.seriesUIDToFolderMap[ds.SeriesInstanceUID]
prefix = ds.Modality.lower() if hasattr(ds, 'Modality') else ""
- filePath = self.outputRootDir + "/" + folderName + "/" + self.getNextItemName(prefix, folderName)+".dcm"
+ filePath = self.outputRootDir + "/" + folderName + "/" + self.getNextItemName(prefix, folderName) + ".dcm"
return filePath
@@ -560,8 +560,8 @@ def patchDicomDir(self, inputDirPath, outputDirPath):
import pydicom
self.addLog('DICOM patching started...')
- logging.debug('DICOM patch input directory: '+inputDirPath)
- logging.debug('DICOM patch output directory: '+outputDirPath)
+ logging.debug('DICOM patch input directory: ' + inputDirPath)
+ logging.debug('DICOM patch output directory: ' + outputDirPath)
for rule in self.patchingRules:
rule.logCallback = self.addLog
@@ -577,8 +577,8 @@ def patchDicomDir(self, inputDirPath, outputDirPath):
rule.processDirectory(currentSubDir)
for file in files:
- filePath = os.path.join(root,file)
- self.addLog('Examining %s...' % os.path.join(currentSubDir,file))
+ filePath = os.path.join(root, file)
+ self.addLog('Examining %s...' % os.path.join(currentSubDir, file))
skipFileRequestingRule = None
for rule in self.patchingRules:
@@ -586,7 +586,7 @@ def patchDicomDir(self, inputDirPath, outputDirPath):
skipFileRequestingRule = rule
break
if skipFileRequestingRule:
- self.addLog(' Rule '+rule.__class__.__name__+' requested to skip this file.')
+ self.addLog(' Rule ' + rule.__class__.__name__ + ' requested to skip this file.')
continue
try:
@@ -600,7 +600,7 @@ def patchDicomDir(self, inputDirPath, outputDirPath):
for rule in self.patchingRules:
rule.processDataSet(ds)
- patchedFilePath = os.path.abspath(os.path.join(rootOutput,file))
+ patchedFilePath = os.path.abspath(os.path.join(rootOutput, file))
for rule in self.patchingRules:
patchedFilePath = rule.generateOutputFilePath(ds, patchedFilePath)
@@ -621,7 +621,7 @@ def importDicomDir(self, outputDirPath):
"""
Utility function to import DICOM files from a directory
"""
- self.addLog('Initiate DICOM importing from folder '+outputDirPath)
+ self.addLog('Initiate DICOM importing from folder ' + outputDirPath)
slicer.util.selectModule('DICOM')
dicomBrowser = slicer.modules.dicom.widgetRepresentation().self().browserWidget.dicomBrowser
dicomBrowser.importDirectory(outputDirPath)
@@ -665,19 +665,19 @@ def test_DICOMPatcher1(self):
testDir = tempfile.mkdtemp(prefix="DICOMPatcherTest-", dir=slicer.app.temporaryPath)
self.assertTrue(os.path.isdir(testDir))
- inputTestDir = testDir+"/input"
+ inputTestDir = testDir + "/input"
os.makedirs(inputTestDir)
- outputTestDir = testDir+"/output"
- self.delayDisplay('Created test directory: '+testDir)
+ outputTestDir = testDir + "/output"
+ self.delayDisplay('Created test directory: ' + testDir)
self.delayDisplay("Generate test files")
- testFileNonDICOM = open(inputTestDir+"/NonDICOMFile.txt", "w")
+ testFileNonDICOM = open(inputTestDir + "/NonDICOMFile.txt", "w")
testFileNonDICOM.write("This is not a DICOM file")
testFileNonDICOM.close()
- testFileDICOMFilename = inputTestDir+"/DICOMFile.dcm"
- self.delayDisplay('Writing test file: '+testFileDICOMFilename)
+ testFileDICOMFilename = inputTestDir + "/DICOMFile.dcm"
+ self.delayDisplay('Writing test file: ' + testFileDICOMFilename)
import pydicom
file_meta = pydicom.dataset.Dataset()
file_meta.MediaStorageSOPClassUID = '1.2.840.10008.5.1.4.1.1.2' # CT Image Storage
@@ -705,10 +705,10 @@ def test_DICOMPatcher1(self):
self.delayDisplay("Verify generated files")
expectedWalk = []
- expectedWalk.append([['pa000'], [ ]])
- expectedWalk.append([['st000'], [ ]])
- expectedWalk.append([['se000'], [ ]])
- expectedWalk.append([[ ], ['000.dcm']])
+ expectedWalk.append([['pa000'], []])
+ expectedWalk.append([['st000'], []])
+ expectedWalk.append([['se000'], []])
+ expectedWalk.append([[], ['000.dcm']])
step = 0
for root, subFolders, files in os.walk(outputTestDir):
self.assertEqual(subFolders, expectedWalk[step][0])
diff --git a/Modules/Scripted/DICOMPlugins/DICOMEnhancedUSVolumePlugin.py b/Modules/Scripted/DICOMPlugins/DICOMEnhancedUSVolumePlugin.py
index bfc7dbde9ac..631368f66f3 100644
--- a/Modules/Scripted/DICOMPlugins/DICOMEnhancedUSVolumePlugin.py
+++ b/Modules/Scripted/DICOMPlugins/DICOMEnhancedUSVolumePlugin.py
@@ -31,7 +31,7 @@ def __init__(self):
self.detailedLogging = False
- def examine(self,fileLists):
+ def examine(self, fileLists):
""" Returns a list of DICOMLoadable instances
corresponding to ways of interpreting the
fileLists parameter.
@@ -42,7 +42,7 @@ def examine(self,fileLists):
return loadables
- def examineFiles(self,files):
+ def examineFiles(self, files):
""" Returns a list of DICOMLoadable instances
corresponding to ways of interpreting the
files parameter.
@@ -100,7 +100,7 @@ def examineFiles(self,files):
return loadables
- def load(self,loadable):
+ def load(self, loadable):
"""Load the selection
"""
diff --git a/Modules/Scripted/DICOMPlugins/DICOMGeAbusPlugin.py b/Modules/Scripted/DICOMPlugins/DICOMGeAbusPlugin.py
index df36f9b8333..c426ff03191 100644
--- a/Modules/Scripted/DICOMPlugins/DICOMGeAbusPlugin.py
+++ b/Modules/Scripted/DICOMPlugins/DICOMGeAbusPlugin.py
@@ -36,7 +36,7 @@ def __init__(self):
# Accepted private creator identifications
self.privateCreators = ["U-Systems", "General Electric Company 01"]
- def examine(self,fileLists):
+ def examine(self, fileLists):
""" Returns a list of DICOMLoadable instances
corresponding to ways of interpreting the
fileLists parameter.
@@ -47,7 +47,7 @@ def examine(self,fileLists):
return loadables
- def examineFiles(self,files):
+ def examineFiles(self, files):
""" Returns a list of DICOMLoadable instances
corresponding to ways of interpreting the
files parameter.
@@ -69,7 +69,7 @@ def examineFiles(self,files):
# Unsupported class
continue
- manufacturerModelName = slicer.dicomDatabase.fileValue(filePath,self.tags['manufacturerModelName'])
+ manufacturerModelName = slicer.dicomDatabase.fileValue(filePath, self.tags['manufacturerModelName'])
if manufacturerModelName != "Invenia":
if detailedLogging:
logging.debug("ManufacturerModelName is not Invenia, the series will not be considered as an ABUS image")
@@ -128,14 +128,14 @@ def getMetadata(self, filePath):
raise ValueError(f"Failed to parse DICOM file: {str(e)}")
fieldsInfo = {
- 'NipplePosition': { 'group': 0x0021, 'element': 0x20, 'private': True, 'required': False},
- 'FirstElementPosition': { 'group': 0x0021, 'element': 0x21, 'private': True, 'required': False},
- 'CurvatureRadiusProbe': { 'group': 0x0021, 'element': 0x40, 'private': True, 'required': True},
- 'CurvatureRadiusTrack': { 'group': 0x0021, 'element': 0x41, 'private': True, 'required': True},
- 'LineDensity': { 'group': 0x0021, 'element': 0x62, 'private': True, 'required': False},
- 'ScanDepthCm': { 'group': 0x0021, 'element': 0x63, 'private': True, 'required': True},
- 'SpacingBetweenSlices': { 'group': 0x0018, 'element': 0x0088, 'private': False, 'required': True},
- 'PixelSpacing': { 'group': 0x0028, 'element': 0x0030, 'private': False, 'required': True},
+ 'NipplePosition': {'group': 0x0021, 'element': 0x20, 'private': True, 'required': False},
+ 'FirstElementPosition': {'group': 0x0021, 'element': 0x21, 'private': True, 'required': False},
+ 'CurvatureRadiusProbe': {'group': 0x0021, 'element': 0x40, 'private': True, 'required': True},
+ 'CurvatureRadiusTrack': {'group': 0x0021, 'element': 0x41, 'private': True, 'required': True},
+ 'LineDensity': {'group': 0x0021, 'element': 0x62, 'private': True, 'required': False},
+ 'ScanDepthCm': {'group': 0x0021, 'element': 0x63, 'private': True, 'required': True},
+ 'SpacingBetweenSlices': {'group': 0x0018, 'element': 0x0088, 'private': False, 'required': True},
+ 'PixelSpacing': {'group': 0x0028, 'element': 0x0030, 'private': False, 'required': True},
}
fieldValues = {}
@@ -161,7 +161,7 @@ def getMetadata(self, filePath):
return fieldValues
- def load(self,loadable):
+ def load(self, loadable):
"""Load the selection
"""
@@ -201,12 +201,12 @@ def load(self,loadable):
sliceSpacing = metadata['SpacingBetweenSlices']
ijkToRas = vtk.vtkMatrix4x4()
- ijkToRas.SetElement(0,0,-1)
- ijkToRas.SetElement(1,1,-1) # so that J axis points toward posterior
+ ijkToRas.SetElement(0, 0, -1)
+ ijkToRas.SetElement(1, 1, -1) # so that J axis points toward posterior
volumeNode.SetIJKToRASMatrix(ijkToRas)
volumeNode.SetSpacing(lateralSpacing, axialSpacing, sliceSpacing)
extent = imageData.GetExtent()
- volumeNode.SetOrigin((extent[1]-extent[0]+1)*0.5*lateralSpacing, 0, -(extent[5]-extent[2]+1)*0.5*sliceSpacing)
+ volumeNode.SetOrigin((extent[1] - extent[0] + 1) * 0.5 * lateralSpacing, 0, -(extent[5] - extent[2] + 1) * 0.5 * sliceSpacing)
volumeNode.SetAndObserveImageData(imageData)
# Apply scan conversion transform
@@ -239,16 +239,16 @@ def createAcquisitionTransform(self, volumeNode, metadata):
# Create a sampling grid for the transform
import numpy as np
spacing = np.array(volumeNode.GetSpacing())
- averageSpacing = (spacing[0]+spacing[1]+spacing[2])/3.0
+ averageSpacing = (spacing[0] + spacing[1] + spacing[2]) / 3.0
voxelsPerTransformControlPoint = 20 # the transform is changing smoothly, so we don't need to add too many control points
gridSpacingMm = averageSpacing * voxelsPerTransformControlPoint
- gridSpacingVoxel = np.floor(gridSpacingMm/spacing).astype(int)
+ gridSpacingVoxel = np.floor(gridSpacingMm / spacing).astype(int)
gridAxesIJK = []
imageData = volumeNode.GetImageData()
extent = imageData.GetExtent()
for axis in range(3):
- gridAxesIJK.append(list(range(extent[axis*2], extent[axis*2+1]+gridSpacingVoxel[axis], gridSpacingVoxel[axis])))
- samplingPoints_shape = [len(gridAxesIJK[0]),len(gridAxesIJK[1]),len(gridAxesIJK[2]),3]
+ gridAxesIJK.append(list(range(extent[axis * 2], extent[axis * 2 + 1] + gridSpacingVoxel[axis], gridSpacingVoxel[axis])))
+ samplingPoints_shape = [len(gridAxesIJK[0]), len(gridAxesIJK[1]), len(gridAxesIJK[2]), 3]
# create a grid transform with one vector at the corner of each slice
# the transform is in the same space and orientation as the volume node
@@ -256,7 +256,7 @@ def createAcquisitionTransform(self, volumeNode, metadata):
gridImage = vtk.vtkImageData()
gridImage.SetOrigin(*volumeNode.GetOrigin())
gridImage.SetDimensions(samplingPoints_shape[:3])
- gridImage.SetSpacing(gridSpacingVoxel[0]*spacing[0], gridSpacingVoxel[1]*spacing[1], gridSpacingVoxel[2]*spacing[2])
+ gridImage.SetSpacing(gridSpacingVoxel[0] * spacing[0], gridSpacingVoxel[1] * spacing[1], gridSpacingVoxel[2] * spacing[2])
gridImage.AllocateScalars(vtk.VTK_DOUBLE, 3)
transform = slicer.vtkOrientedGridTransform()
directionMatrix = vtk.vtkMatrix4x4()
@@ -266,7 +266,7 @@ def createAcquisitionTransform(self, volumeNode, metadata):
# create the grid transform node
gridTransform = slicer.vtkMRMLGridTransformNode()
- gridTransform.SetName(slicer.mrmlScene.GenerateUniqueName(volumeNode.GetName()+' acquisition transform'))
+ gridTransform.SetName(slicer.mrmlScene.GenerateUniqueName(volumeNode.GetName() + ' acquisition transform'))
slicer.mrmlScene.AddNode(gridTransform)
gridTransform.SetAndObserveTransformToParent(transform)
@@ -282,7 +282,7 @@ def createAcquisitionTransform(self, volumeNode, metadata):
ijkToRas = vtk.vtkMatrix4x4()
volumeNode.GetIJKToRASMatrix(ijkToRas)
spacing = volumeNode.GetSpacing()
- center_IJK = [(extent[0]+extent[1])/2.0, extent[2], (extent[4]+extent[5])/2.0]
+ center_IJK = [(extent[0] + extent[1]) / 2.0, extent[2], (extent[4] + extent[5]) / 2.0]
sourcePoints_RAS = numpy.zeros(shape=samplingPoints_shape)
targetPoints_RAS = numpy.zeros(shape=samplingPoints_shape)
for k in range(samplingPoints_shape[2]):
@@ -290,12 +290,12 @@ def createAcquisitionTransform(self, volumeNode, metadata):
for i in range(samplingPoints_shape[0]):
samplingPoint_IJK = [gridAxesIJK[0][i], gridAxesIJK[1][j], gridAxesIJK[2][k], 1]
sourcePoint_RAS = np.array(ijkToRas.MultiplyPoint(samplingPoint_IJK)[:3])
- radius = probeRadius - (samplingPoint_IJK[1]-center_IJK[1]) * spacing[1]
- angleRad = (samplingPoint_IJK[0]-center_IJK[0]) * spacing[0] / probeRadius
+ radius = probeRadius - (samplingPoint_IJK[1] - center_IJK[1]) * spacing[1]
+ angleRad = (samplingPoint_IJK[0] - center_IJK[0]) * spacing[0] / probeRadius
targetPoint_RAS = np.array([
-radius * sin(angleRad),
radius * cos(angleRad) - probeRadius,
- spacing[2] * (samplingPoint_IJK[2]-center_IJK[2])])
+ spacing[2] * (samplingPoint_IJK[2] - center_IJK[2])])
displacements[k][j][i] = targetPoint_RAS - sourcePoint_RAS
return gridTransform
diff --git a/Modules/Scripted/DICOMPlugins/DICOMImageSequencePlugin.py b/Modules/Scripted/DICOMPlugins/DICOMImageSequencePlugin.py
index 1bbd31eefb3..96425c1f792 100644
--- a/Modules/Scripted/DICOMPlugins/DICOMImageSequencePlugin.py
+++ b/Modules/Scripted/DICOMPlugins/DICOMImageSequencePlugin.py
@@ -42,7 +42,7 @@ def __init__(self):
self.detailedLogging = False
- def examine(self,fileLists):
+ def examine(self, fileLists):
""" Returns a list of DICOMLoadable instances
corresponding to ways of interpreting the
fileLists parameter.
@@ -53,7 +53,7 @@ def examine(self,fileLists):
return loadables
- def examineFiles(self,files):
+ def examineFiles(self, files):
""" Returns a list of DICOMLoadable instances
corresponding to ways of interpreting the
files parameter.
@@ -158,7 +158,7 @@ def examineFiles(self,files):
# Add to loadables list
loadables.append(loadable)
- instanceNumberToLoadableIndex[instanceNumber] = len(loadables)-1
+ instanceNumberToLoadableIndex[instanceNumber] = len(loadables) - 1
else:
# existing instance number, add this file
loadableIndex = instanceNumberToLoadableIndex[instanceNumber]
@@ -183,24 +183,24 @@ def examineFiles(self,files):
loadable.name = name.strip() # remove leading and trailing spaces, if any
loadable.tooltip = f"{ds.Modality} image sequence"
loadable.selected = True
- if len(cineMriTriggerTimes)>3:
+ if len(cineMriTriggerTimes) > 3:
if self.detailedLogging:
- logging.debug("Several different trigger times found ("+repr(cineMriTriggerTimes)+") - assuming this series is a cine MRI")
+ logging.debug("Several different trigger times found (" + repr(cineMriTriggerTimes) + ") - assuming this series is a cine MRI")
# This is likely a cardiac cine acquisition.
if len(cineMriImageOrientations) > 1:
if self.detailedLogging:
- logging.debug("Several different image orientations found ("+repr(cineMriImageOrientations)+") - assuming this series is a rotational cine MRI")
+ logging.debug("Several different image orientations found (" + repr(cineMriImageOrientations) + ") - assuming this series is a rotational cine MRI")
# Multivolume importer sets confidence=0.9-1.0, so we need to set a bit higher confidence to be selected by default
loadable.confidence = 1.05
else:
if self.detailedLogging:
- logging.debug("All image orientations are the same ("+repr(cineMriImageOrientations)+") - probably the MultiVolume plugin should load this")
+ logging.debug("All image orientations are the same (" + repr(cineMriImageOrientations) + ") - probably the MultiVolume plugin should load this")
# Multivolume importer sets confidence=0.9-1.0, so we need to set a bit lower confidence to allow multivolume selected by default
loadable.confidence = 0.85
else:
# This may be a 3D acquisition,so set lower confidence than scalar volume's default (0.5)
if self.detailedLogging:
- logging.debug("Only one or few different trigger times found ("+repr(cineMriTriggerTimes)+") - assuming this series is not a cine MRI")
+ logging.debug("Only one or few different trigger times found (" + repr(cineMriTriggerTimes) + ") - assuming this series is not a cine MRI")
loadable.confidence = 0.4
loadable.grayscale = ('MONOCHROME' in ds.PhotometricInterpretation)
@@ -330,7 +330,7 @@ def addSequenceFromImageData(self, imageData, tempFrameVolume, filePath, name, s
return outputSequenceNode, playbackRateFps
- def load(self,loadable):
+ def load(self, loadable):
"""Load the selection
"""
diff --git a/Modules/Scripted/DICOMPlugins/DICOMScalarVolumePlugin.py b/Modules/Scripted/DICOMPlugins/DICOMScalarVolumePlugin.py
index ec14edb5808..01de496c5ff 100644
--- a/Modules/Scripted/DICOMPlugins/DICOMScalarVolumePlugin.py
+++ b/Modules/Scripted/DICOMPlugins/DICOMScalarVolumePlugin.py
@@ -25,12 +25,12 @@ class DICOMScalarVolumePluginClass(DICOMPlugin):
""" ScalarVolume specific interpretation code
"""
- def __init__(self,epsilon=0.01):
+ def __init__(self, epsilon=0.01):
super().__init__()
self.loadType = "Scalar Volume"
self.epsilon = epsilon
self.acquisitionModeling = None
- self.defaultStudyID = 'SLICER10001' #TODO: What should be the new study ID?
+ self.defaultStudyID = 'SLICER10001' # TODO: What should be the new study ID?
self.tags['sopClassUID'] = "0008,0016"
self.tags['photometricInterpretation'] = "0028,0004"
@@ -110,7 +110,7 @@ def settingsPanelEntry(panel, parent):
# DICOM examination settings are cached so we need to restart to make sure changes take effect
@staticmethod
- def compareVolumeNodes(volumeNode1,volumeNode2):
+ def compareVolumeNodes(volumeNode1, volumeNode2):
"""
Given two mrml volume nodes, return true of the numpy arrays have identical data
and other metadata matches. Returns empty string on match, otherwise
@@ -137,7 +137,7 @@ def allowLoadingByTime(self):
settings = qt.QSettings()
return (int(settings.value("DICOM/ScalarVolume/AllowLoadingByTime", "0")) != 0)
- def examineForImport(self,fileLists):
+ def examineForImport(self, fileLists):
""" Returns a sorted list of DICOMLoadable instances
corresponding to ways of interpreting the
fileLists parameter (list of file lists).
@@ -150,10 +150,10 @@ def examineForImport(self,fileLists):
else:
loadablesForFiles = self.examineFiles(files)
loadables += loadablesForFiles
- self.cacheLoadables(files,loadablesForFiles)
+ self.cacheLoadables(files, loadablesForFiles)
# sort the loadables by series number if possible
- loadables.sort(key=cmp_to_key(lambda x,y: self.seriesSorter(x,y)))
+ loadables.sort(key=cmp_to_key(lambda x, y: self.seriesSorter(x, y)))
return loadables
@@ -166,13 +166,13 @@ def cleanNodeName(self, value):
cleanValue = cleanValue.replace("\\", "-")
return cleanValue
- def examineFiles(self,files):
+ def examineFiles(self, files):
""" Returns a list of DICOMLoadable instances
corresponding to ways of interpreting the
files parameter.
"""
- seriesUID = slicer.dicomDatabase.fileValue(files[0],self.tags['seriesUID'])
+ seriesUID = slicer.dicomDatabase.fileValue(files[0], self.tags['seriesUID'])
seriesName = self.defaultSeriesNodeName(seriesUID)
# default loadable includes all files for series
@@ -217,15 +217,15 @@ def examineFiles(self,files):
for file in allFilesLoadable.files:
# check for subseries values
for tag in subseriesTags:
- value = slicer.dicomDatabase.fileValue(file,self.tags[tag])
- value = value.replace(",","_") # remove commas so it can be used as an index
+ value = slicer.dicomDatabase.fileValue(file, self.tags[tag])
+ value = value.replace(",", "_") # remove commas so it can be used as an index
if tag not in subseriesValues:
subseriesValues[tag] = []
if not subseriesValues[tag].__contains__(value):
subseriesValues[tag].append(value)
- if (tag,value) not in subseriesFiles:
- subseriesFiles[tag,value] = []
- subseriesFiles[tag,value].append(file)
+ if (tag, value) not in subseriesFiles:
+ subseriesFiles[tag, value] = []
+ subseriesFiles[tag, value].append(file)
loadables = []
@@ -245,11 +245,11 @@ def examineFiles(self,files):
for valueIndex, value in enumerate(subseriesValues[tag]):
# default loadable includes all files for series
loadable = DICOMLoadable()
- loadable.files = subseriesFiles[tag,value]
+ loadable.files = subseriesFiles[tag, value]
# value can be a long string (and it will be used for generating node name)
# therefore use just an index instead
if tag in subseriesTagsToEnumerateValues:
- loadable.name = seriesName + " - %s %d" % (tag, valueIndex+1)
+ loadable.name = seriesName + " - %s %d" % (tag, valueIndex + 1)
else:
loadable.name = seriesName + f" - {tag} {value}"
loadable.name = self.cleanNodeName(loadable.name)
@@ -257,8 +257,8 @@ def examineFiles(self,files):
loadable.selected = False
loadables.append(loadable)
if len(subseriesValues[tag]) == 2:
- otherValue = subseriesValues[tag][1-valueIndex]
- if len(subseriesFiles[tag,value]) > 1 and len(subseriesFiles[tag, otherValue]) == 1:
+ otherValue = subseriesValues[tag][1 - valueIndex]
+ if len(subseriesFiles[tag, value]) > 1 and len(subseriesFiles[tag, otherValue]) == 1:
# this looks like a subseries without a localizer image
probableLocalizerFreeLoadables.append(loadable)
@@ -269,19 +269,19 @@ def examineFiles(self,files):
newFiles = []
excludedLoadable = False
for file in loadable.files:
- if slicer.dicomDatabase.fileValueExists(file,self.tags['pixelData']):
+ if slicer.dicomDatabase.fileValueExists(file, self.tags['pixelData']):
newFiles.append(file)
- if slicer.dicomDatabase.fileValue(file,self.tags['sopClassUID'])=='1.2.840.10008.5.1.4.1.1.66.4':
+ if slicer.dicomDatabase.fileValue(file, self.tags['sopClassUID']) == '1.2.840.10008.5.1.4.1.1.66.4':
excludedLoadable = True
if 'DICOMSegmentationPlugin' not in slicer.modules.dicomPlugins:
logging.warning('Please install Quantitative Reporting extension to enable loading of DICOM Segmentation objects')
- elif slicer.dicomDatabase.fileValue(file,self.tags['sopClassUID'])=='1.2.840.10008.5.1.4.1.1.481.3':
+ elif slicer.dicomDatabase.fileValue(file, self.tags['sopClassUID']) == '1.2.840.10008.5.1.4.1.1.481.3':
excludedLoadable = True
if 'DicomRtImportExportPlugin' not in slicer.modules.dicomPlugins:
logging.warning('Please install SlicerRT extension to enable loading of DICOM RT Structure Set objects')
if len(newFiles) > 0 and not excludedLoadable:
loadable.files = newFiles
- loadable.grayscale = ('MONOCHROME' in slicer.dicomDatabase.fileValue(newFiles[0],self.tags['photometricInterpretation']))
+ loadable.grayscale = ('MONOCHROME' in slicer.dicomDatabase.fileValue(newFiles[0], self.tags['photometricInterpretation']))
newLoadables.append(loadable)
elif excludedLoadable:
continue
@@ -291,7 +291,7 @@ def examineFiles(self,files):
# them through with a warning and low confidence
loadable.warning += "There is no pixel data attribute for the DICOM objects, but they might be readable as secondary capture images. "
loadable.confidence = 0.2
- loadable.grayscale = ('MONOCHROME' in slicer.dicomDatabase.fileValue(loadable.files[0],self.tags['photometricInterpretation']))
+ loadable.grayscale = ('MONOCHROME' in slicer.dicomDatabase.fileValue(loadable.files[0], self.tags['photometricInterpretation']))
newLoadables.append(loadable)
loadables = newLoadables
@@ -330,11 +330,11 @@ def examineFiles(self,files):
return loadables
- def seriesSorter(self,x,y):
+ def seriesSorter(self, x, y):
""" returns -1, 0, 1 for sorting of strings like: "400: series description"
Works for DICOMLoadable or other objects with name attribute
"""
- if not (hasattr(x,'name') and hasattr(y,'name')):
+ if not (hasattr(x, 'name') and hasattr(y, 'name')):
return 0
xName = x.name
yName = y.name
@@ -356,7 +356,7 @@ def seriesSorter(self,x,y):
# - GDCM: explicitly uses the GDCMImageIO
#
- def loadFilesWithArchetype(self,files,name):
+ def loadFilesWithArchetype(self, files, name):
"""Load files in the traditional Slicer manner
using the volume logic helper class
and the vtkITK archetype helper code
@@ -365,9 +365,9 @@ def loadFilesWithArchetype(self,files,name):
for f in files:
fileList.InsertNextValue(f)
volumesLogic = slicer.modules.volumes.logic()
- return(volumesLogic.AddArchetypeScalarVolume(files[0],name,0,fileList))
+ return(volumesLogic.AddArchetypeScalarVolume(files[0], name, 0, fileList))
- def loadFilesWithSeriesReader(self,imageIOName,files,name,grayscale=True):
+ def loadFilesWithSeriesReader(self, imageIOName, files, name, grayscale=True):
""" Explicitly use the named imageIO to perform the loading
"""
@@ -399,8 +399,8 @@ def loadFilesWithSeriesReader(self,imageIOName,files,name,grayscale=True):
imageChangeInformation = vtk.vtkImageChangeInformation()
imageChangeInformation.SetInputConnection(reader.GetOutputPort())
- imageChangeInformation.SetOutputSpacing( 1, 1, 1 )
- imageChangeInformation.SetOutputOrigin( 0, 0, 0 )
+ imageChangeInformation.SetOutputSpacing(1, 1, 1)
+ imageChangeInformation.SetOutputOrigin(0, 0, 0)
imageChangeInformation.Update()
name = slicer.mrmlScene.GenerateUniqueName(name)
@@ -418,7 +418,7 @@ def loadFilesWithSeriesReader(self,imageIOName,files,name,grayscale=True):
return(volumeNode)
- def setVolumeNodeProperties(self,volumeNode,loadable):
+ def setVolumeNodeProperties(self, volumeNode, loadable):
"""After the scalar volume has been loaded, populate the node
attributes and display node with values extracted from the dicom instances
"""
@@ -426,7 +426,7 @@ def setVolumeNodeProperties(self,volumeNode,loadable):
#
# create subject hierarchy items for the loaded series
#
- self.addSeriesInSubjectHierarchy(loadable,volumeNode)
+ self.addSeriesInSubjectHierarchy(loadable, volumeNode)
#
# add list of DICOM instance UIDs to the volume node
@@ -434,7 +434,7 @@ def setVolumeNodeProperties(self,volumeNode,loadable):
#
instanceUIDs = ""
for file in loadable.files:
- uid = slicer.dicomDatabase.fileValue(file,self.tags['instanceUID'])
+ uid = slicer.dicomDatabase.fileValue(file, self.tags['instanceUID'])
if uid == "":
uid = "Unknown"
instanceUIDs += uid + " "
@@ -444,7 +444,7 @@ def setVolumeNodeProperties(self,volumeNode,loadable):
# Choose a file in the middle of the series as representative frame,
# because that is more likely to contain the object of interest than the first or last frame.
# This is important for example for getting a relevant window/center value for the series.
- file = loadable.files[int(len(loadable.files)/2)]
+ file = loadable.files[int(len(loadable.files) / 2)]
#
# automatically select the volume to display
@@ -463,8 +463,8 @@ def setVolumeNodeProperties(self,volumeNode,loadable):
# [2] https://github.com/Slicer/Slicer/blob/3bfa2fc2b310d41c09b7a9e8f8f6c4f43d3bd1e2/Libs/MRML/Core/vtkMRMLScalarVolumeDisplayNode.h#L172
#
try:
- windowCenter = float( slicer.dicomDatabase.fileValue(file,self.tags['windowCenter']) )
- windowWidth = float( slicer.dicomDatabase.fileValue(file,self.tags['windowWidth']) )
+ windowCenter = float(slicer.dicomDatabase.fileValue(file, self.tags['windowCenter']))
+ windowWidth = float(slicer.dicomDatabase.fileValue(file, self.tags['windowWidth']))
displayNode = volumeNode.GetDisplayNode()
if displayNode:
logging.info('Window/level found in DICOM tags (center=' + str(windowCenter) + ', width=' + str(windowWidth) + ') has been applied to volume ' + volumeNode.GetName())
@@ -473,9 +473,9 @@ def setVolumeNodeProperties(self,volumeNode,loadable):
else:
logging.info('No display node: cannot use window/level found in DICOM tags')
except ValueError:
- pass # DICOM tags cannot be parsed to floating point numbers
+ pass # DICOM tags cannot be parsed to floating point numbers
- sopClassUID = slicer.dicomDatabase.fileValue(file,self.tags['sopClassUID'])
+ sopClassUID = slicer.dicomDatabase.fileValue(file, self.tags['sopClassUID'])
# initialize color lookup table
modality = self.mapSOPClassUIDToModality(sopClassUID)
@@ -485,25 +485,25 @@ def setVolumeNodeProperties(self,volumeNode,loadable):
displayNode.SetAndObserveColorNodeID(slicer.modules.colors.logic().GetPETColorNodeID(slicer.vtkMRMLPETProceduralColorNode.PETheat))
# initialize quantity and units codes
- (quantity,units) = self.mapSOPClassUIDToDICOMQuantityAndUnits(sopClassUID)
+ (quantity, units) = self.mapSOPClassUIDToDICOMQuantityAndUnits(sopClassUID)
if quantity is not None:
volumeNode.SetVoxelValueQuantity(quantity)
if units is not None:
volumeNode.SetVoxelValueUnits(units)
- def loadWithMultipleLoaders(self,loadable):
+ def loadWithMultipleLoaders(self, loadable):
"""Load using multiple paths (for testing)
"""
- volumeNode = self.loadFilesWithArchetype(loadable.files, loadable.name+"-archetype")
+ volumeNode = self.loadFilesWithArchetype(loadable.files, loadable.name + "-archetype")
self.setVolumeNodeProperties(volumeNode, loadable)
- volumeNode = self.loadFilesWithSeriesReader("GDCM", loadable.files, loadable.name+"-gdcm", loadable.grayscale)
+ volumeNode = self.loadFilesWithSeriesReader("GDCM", loadable.files, loadable.name + "-gdcm", loadable.grayscale)
self.setVolumeNodeProperties(volumeNode, loadable)
- volumeNode = self.loadFilesWithSeriesReader("DCMTK", loadable.files, loadable.name+"-dcmtk", loadable.grayscale)
+ volumeNode = self.loadFilesWithSeriesReader("DCMTK", loadable.files, loadable.name + "-dcmtk", loadable.grayscale)
self.setVolumeNodeProperties(volumeNode, loadable)
return volumeNode
- def load(self,loadable,readerApproach=None):
+ def load(self, loadable, readerApproach=None):
"""Load the select as a scalar volume using desired approach
"""
# first, determine which reader approach the user prefers
@@ -534,7 +534,7 @@ def load(self,loadable,readerApproach=None):
return volumeNode
- def examineForExport(self,subjectHierarchyItemID):
+ def examineForExport(self, subjectHierarchyItemID):
"""Return a list of DICOMExportable instances that describe the
available techniques that this plugin offers to convert MRML
data into DICOM data
@@ -551,7 +551,7 @@ def examineForExport(self,subjectHierarchyItemID):
exportable.tooltip = "Creates a series of DICOM files from scalar volumes"
exportable.subjectHierarchyItemID = subjectHierarchyItemID
exportable.pluginClass = self.__module__
- exportable.confidence = 0.5 # There could be more specialized volume types
+ exportable.confidence = 0.5 # There could be more specialized volume types
# Define required tags and default values
exportable.setTag('SeriesDescription', 'No series description')
@@ -571,7 +571,7 @@ def examineForExport(self,subjectHierarchyItemID):
return [exportable]
- def export(self,exportables):
+ def export(self, exportables):
for exportable in exportables:
# Get volume node to export
shNode = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)
@@ -661,13 +661,13 @@ def export(self,exportables):
studyInstanceUID = db.studyForSeries(seriesInstanceUID)
if studyInstanceUID:
# This seriesInstanceUID is already found in the database
- if len(seriesInstanceUID)>25:
+ if len(seriesInstanceUID) > 25:
seriesInstanceUID = seriesInstanceUID[:20] + "..."
error = f"A series already exists in the database by SeriesInstanceUID {seriesInstanceUID}."
logging.error(error)
return error
- #TODO: more tag checks
+ # TODO: more tag checks
# Perform export
exporter = DICOMExportScalarVolume(tags['Study ID'], volumeNode, tags, directory)
@@ -686,7 +686,7 @@ class AcquisitionModeling:
flags in each instance (not on multiframe with per-frame positions).
"""
- def __init__(self,cornerEpsilon=1e-3,zeroEpsilon=1e-6):
+ def __init__(self, cornerEpsilon=1e-3, zeroEpsilon=1e-6):
"""cornerEpsilon sets the threshold for the amount of difference between the
vtkITK generated volume geometry vs the DICOM geometry. Any spatial dimension with
a difference larger than cornerEpsilon will trigger the addition of a grid transform.
@@ -695,7 +695,7 @@ def __init__(self,cornerEpsilon=1e-3,zeroEpsilon=1e-6):
self.cornerEpsilon = cornerEpsilon
self.zeroEpsilon = zeroEpsilon
- def gridTransformFromCorners(self,volumeNode,sourceCorners,targetCorners):
+ def gridTransformFromCorners(self, volumeNode, sourceCorners, targetCorners):
"""Create a grid transform that maps between the current and the desired corners.
"""
# sanity check
@@ -707,7 +707,7 @@ def gridTransformFromCorners(self,volumeNode,sourceCorners,targetCorners):
# create the grid transform node
gridTransform = slicer.vtkMRMLGridTransformNode()
- gridTransform.SetName(slicer.mrmlScene.GenerateUniqueName(volumeNode.GetName()+' acquisition transform'))
+ gridTransform.SetName(slicer.mrmlScene.GenerateUniqueName(volumeNode.GetName() + ' acquisition transform'))
slicer.mrmlScene.AddNode(gridTransform)
# place grid transform in the same subject hierarchy folder as the volume node
@@ -739,7 +739,7 @@ def gridTransformFromCorners(self,volumeNode,sourceCorners,targetCorners):
for column in range(2):
displacements[sliceIndex][row][column] = targetCorners[sliceIndex][row][column] - sourceCorners[sliceIndex][row][column]
- def sliceCornersFromDICOM(self,volumeNode):
+ def sliceCornersFromDICOM(self, volumeNode):
"""Calculate the RAS position of each of the four corners of each
slice of a volume node based on the dicom headers
@@ -753,13 +753,13 @@ def sliceCornersFromDICOM(self,volumeNode):
orientationTag = "0020,0037"
columns, rows, slices = volumeNode.GetImageData().GetDimensions()
- corners = numpy.zeros(shape=[slices,2,2,3])
+ corners = numpy.zeros(shape=[slices, 2, 2, 3])
instanceUIDsAttribute = volumeNode.GetAttribute('DICOM.instanceUIDs')
uids = instanceUIDsAttribute.split() if instanceUIDsAttribute else []
if len(uids) != slices:
# There is no uid for each slice, so most likely all frames are in a single file
# or maybe there is a problem with the sequence
- logging.warning("Cannot get DICOM slice positions for volume "+volumeNode.GetName())
+ logging.warning("Cannot get DICOM slice positions for volume " + volumeNode.GetName())
return None
for sliceIndex in range(slices):
uid = uids[sliceIndex]
@@ -777,11 +777,11 @@ def sliceCornersFromDICOM(self,volumeNode):
columnOrientation = numpy.array(orientation[3:])
spacing = numpy.array(list(map(float, spacingString.split('\\'))))
# map from LPS to RAS
- lpsToRAS = numpy.array([-1,-1,1])
+ lpsToRAS = numpy.array([-1, -1, 1])
position *= lpsToRAS
rowOrientation *= lpsToRAS
columnOrientation *= lpsToRAS
- rowVector = columns * spacing[1] * rowOrientation # dicom PixelSpacing is between rows first, then columns
+ rowVector = columns * spacing[1] * rowOrientation # dicom PixelSpacing is between rows first, then columns
columnVector = rows * spacing[0] * columnOrientation
# apply the transform to the four corners
for column in range(2):
@@ -791,34 +791,34 @@ def sliceCornersFromDICOM(self,volumeNode):
corners[sliceIndex][row][column] += row * columnVector
return corners
- def sliceCornersFromIJKToRAS(self,volumeNode):
+ def sliceCornersFromIJKToRAS(self, volumeNode):
"""Calculate the RAS position of each of the four corners of each
slice of a volume node based on the ijkToRAS matrix of the volume node
"""
ijkToRAS = vtk.vtkMatrix4x4()
volumeNode.GetIJKToRASMatrix(ijkToRAS)
columns, rows, slices = volumeNode.GetImageData().GetDimensions()
- corners = numpy.zeros(shape=[slices,2,2,3])
+ corners = numpy.zeros(shape=[slices, 2, 2, 3])
for sliceIndex in range(slices):
for column in range(2):
for row in range(2):
corners[sliceIndex][row][column] = numpy.array(ijkToRAS.MultiplyPoint([column * columns, row * rows, sliceIndex, 1])[:3])
return corners
- def cornersToWorld(self,volumeNode,corners):
+ def cornersToWorld(self, volumeNode, corners):
"""Map corners through the volumeNodes transform to world
This can be used to confirm that an acquisition transform has correctly
mapped the slice corners to match the dicom acquisition.
"""
columns, rows, slices = volumeNode.GetImageData().GetDimensions()
- worldCorners = numpy.zeros(shape=[slices,2,2,3])
+ worldCorners = numpy.zeros(shape=[slices, 2, 2, 3])
for slice in range(slices):
for row in range(2):
for column in range(2):
- volumeNode.TransformPointToWorld(corners[slice,row,column], worldCorners[slice,row,column])
+ volumeNode.TransformPointToWorld(corners[slice, row, column], worldCorners[slice, row, column])
return worldCorners
- def createAcquisitionTransform(self, volumeNode, addAcquisitionTransformIfNeeded = True):
+ def createAcquisitionTransform(self, volumeNode, addAcquisitionTransformIfNeeded=True):
"""Creates the actual transform if needed.
Slice corners are cached for inpection by tests
"""
@@ -840,7 +840,7 @@ def createAcquisitionTransform(self, volumeNode, addAcquisitionTransformIfNeeded
else:
logging.warning(warningText + " Regularization transform is not added, as the option is disabled.")
elif maxError > 0 and maxError > self.zeroEpsilon:
- logging.debug("Irregular volume geometry detected, but maximum error is within tolerance"+
+ logging.debug("Irregular volume geometry detected, but maximum error is within tolerance" +
f" (maximum error of {maxError:g} mm, tolerance threshold is {self.cornerEpsilon:g} mm).")
diff --git a/Modules/Scripted/DICOMPlugins/DICOMVolumeSequencePlugin.py b/Modules/Scripted/DICOMPlugins/DICOMVolumeSequencePlugin.py
index 7c0cb0d68d1..3348a8aaeb3 100644
--- a/Modules/Scripted/DICOMPlugins/DICOMVolumeSequencePlugin.py
+++ b/Modules/Scripted/DICOMPlugins/DICOMVolumeSequencePlugin.py
@@ -94,7 +94,7 @@ def examineForExport(self, subjectHierarchyItemID):
exportable.tooltip = "Creates a series of DICOM files from volume sequences"
exportable.subjectHierarchyItemID = subjectHierarchyItemID
exportable.pluginClass = self.__module__
- exportable.confidence = 0.6 # Simple volume has confidence of 0.5, use a slightly higher value here
+ exportable.confidence = 0.6 # Simple volume has confidence of 0.5, use a slightly higher value here
# Define required tags and default values
exportable.setTag('SeriesDescription', f'Volume sequence of {sequenceItemCount} frames')
@@ -112,42 +112,42 @@ def datetimeFromDicom(self, dt, tm):
year = 0
month = 0
day = 0
- if len(dt)==8: # YYYYMMDD
+ if len(dt) == 8: # YYYYMMDD
year = int(dt[0:4])
month = int(dt[4:6])
day = int(dt[6:8])
else:
- raise OSError("Invalid DICOM date string: "+tm+" (failed to parse YYYYMMDD)")
+ raise OSError("Invalid DICOM date string: " + tm + " (failed to parse YYYYMMDD)")
hour = 0
minute = 0
second = 0
microsecond = 0
- if len(tm)>=6:
+ if len(tm) >= 6:
try:
- hhmmss = str.split(tm,'.')[0]
+ hhmmss = str.split(tm, '.')[0]
except:
hhmmss = tm
try:
- microsecond = int(float('0.'+str.split(tm,'.')[1]) * 1e6)
+ microsecond = int(float('0.' + str.split(tm, '.')[1]) * 1e6)
except:
microsecond = 0
- if len(hhmmss)==6: # HHMMSS
+ if len(hhmmss) == 6: # HHMMSS
hour = int(hhmmss[0:2])
minute = int(hhmmss[2:4])
second = int(hhmmss[4:6])
- elif len(hhmmss)==4: # HHMM
+ elif len(hhmmss) == 4: # HHMM
hour = int(hhmmss[0:2])
minute = int(hhmmss[2:4])
- elif len(hhmmss)==2: # HH
+ elif len(hhmmss) == 2: # HH
hour = int(hhmmss[0:2])
else:
- raise OSError("Invalid DICOM time string: "+tm+" (failed to parse HHMMSS)")
+ raise OSError("Invalid DICOM time string: " + tm + " (failed to parse HHMMSS)")
import datetime
return datetime.datetime(year, month, day, hour, minute, second, microsecond)
- def export(self,exportables):
+ def export(self, exportables):
for exportable in exportables:
# Get volume node to export
shNode = slicer.vtkMRMLSubjectHierarchyNode.GetSubjectHierarchyNode(slicer.mrmlScene)
@@ -167,7 +167,7 @@ def export(self,exportables):
logging.error(error)
return error
- volumeSequenceNode = sequenceBrowserNode.GetSequenceNode(volumeNode)
+ volumeSequenceNode = sequenceBrowserNode.GetSequenceNode(volumeNode)
if not volumeSequenceNode:
error = "Series '" + shNode.GetItemName(exportable.subjectHierarchyItemID) + "' cannot be exported as volume sequence"
logging.error(error)
@@ -213,7 +213,7 @@ def export(self,exportables):
error = "Empty modality for series '" + volumeNode.GetName() + "'"
logging.error(error)
return error
- #TODO: more tag checks
+ # TODO: more tag checks
sequenceItemCount = sequenceBrowserNode.GetMasterSequenceNode().GetNumberOfDataNodes()
originalSelectedSequenceItemNumber = sequenceBrowserNode.GetSelectedItemNumber()
@@ -247,7 +247,7 @@ def export(self,exportables):
slicer.app.processEvents()
# Compute content date&time
# TODO: verify that unit in sequence node is "second" (and convert to seconds if not)
- timeOffsetSec = float(masterVolumeNode.GetNthIndexValue(sequenceItemIndex))-float(masterVolumeNode.GetNthIndexValue(0))
+ timeOffsetSec = float(masterVolumeNode.GetNthIndexValue(sequenceItemIndex)) - float(masterVolumeNode.GetNthIndexValue(0))
contentDatetime = contentStartDatetime + datetime.timedelta(seconds=timeOffsetSec)
tags['Content Date'] = contentDatetime.strftime("%Y%m%d")
tags['Content Time'] = contentDatetime.strftime("%H%M%S.%f")
diff --git a/Modules/Scripted/DMRIInstall/DMRIInstall.py b/Modules/Scripted/DMRIInstall/DMRIInstall.py
index e7f11abe83b..adc885ee92c 100644
--- a/Modules/Scripted/DMRIInstall/DMRIInstall.py
+++ b/Modules/Scripted/DMRIInstall/DMRIInstall.py
@@ -52,8 +52,8 @@ class DMRIInstall(ScriptedLoadableModule):
Slicer revision: {revision}
Platform: {platform}
""").format(builddate=slicer.app.applicationVersion,
- revision = slicer.app.repositoryRevision,
- platform = slicer.app.platform)
+ revision=slicer.app.repositoryRevision,
+ platform=slicer.app.platform)
def __init__(self, parent):
@@ -87,7 +87,7 @@ def setup(self):
ScriptedLoadableModuleWidget.setup(self)
self.textBox = ctk.ctkFittedTextBrowser()
- self.textBox.setOpenExternalLinks(True) # Open links in default browser
+ self.textBox.setOpenExternalLinks(True) # Open links in default browser
self.textBox.setHtml(DMRIInstall.helpText)
self.parent.layout().addWidget(self.textBox)
diff --git a/Modules/Scripted/DataProbe/DataProbe.py b/Modules/Scripted/DataProbe/DataProbe.py
index a5730ee6120..514a81ff17f 100644
--- a/Modules/Scripted/DataProbe/DataProbe.py
+++ b/Modules/Scripted/DataProbe/DataProbe.py
@@ -28,14 +28,14 @@ def __init__(self, parent):
self.parent.helpText += self.getDefaultModuleDocumentationLink()
parent.acknowledgementText = """This work is supported by NA-MIC, NAC, NCIGT, NIH U24 CA180918 (PIs Kikinis and Fedorov) and the Slicer Community."""
# TODO: need a DataProbe icon
- #parent.icon = qt.QIcon(':Icons/XLarge/SlicerDownloadMRHead.png')
+ # parent.icon = qt.QIcon(':Icons/XLarge/SlicerDownloadMRHead.png')
self.infoWidget = None
- if slicer.mrmlScene.GetTagByClassName( "vtkMRMLScriptedModuleNode" ) != 'ScriptedModule':
+ if slicer.mrmlScene.GetTagByClassName("vtkMRMLScriptedModuleNode") != 'ScriptedModule':
slicer.mrmlScene.RegisterNodeClass(vtkMRMLScriptedModuleNode())
# Trigger the menu to be added when application has started up
- if not slicer.app.commandOptions().noMainWindow :
+ if not slicer.app.commandOptions().noMainWindow:
slicer.app.connect("startupCompleted()", self.addView)
def __del__(self):
@@ -55,7 +55,7 @@ def addView(self):
print("No Data Probe frame - cannot create DataProbe")
return
self.infoWidget = DataProbeInfoWidget(parent)
- parent.layout().insertWidget(0,self.infoWidget.frame)
+ parent.layout().insertWidget(0, self.infoWidget.frame)
def showZoomedSlice(self, value=False):
self.showZoomedSlice = value
@@ -82,7 +82,7 @@ def __init__(self, parent=None):
qSize.setVerticalPolicy(qt.QSizePolicy.Preferred)
self.frame.setSizePolicy(qSize)
- modulePath = slicer.modules.dataprobe.path.replace("DataProbe.py","")
+ modulePath = slicer.modules.dataprobe.path.replace("DataProbe.py", "")
self.iconsDIR = modulePath + '/Resources/Icons'
self.showImage = False
@@ -95,7 +95,7 @@ def __init__(self, parent=None):
self._createSmall()
- #Helper class to calculate and display tensor scalars
+ # Helper class to calculate and display tensor scalars
self.calculateTensorScalars = CalculateTensorScalars()
# Observe the crosshair node to get the current cursor position
@@ -106,7 +106,7 @@ def __init__(self, parent=None):
def __del__(self):
self.removeObservers()
- def fitName(self,name,nameSize=None):
+ def fitName(self, name, nameSize=None):
if not nameSize:
nameSize = self.nameSize
if len(name) > nameSize:
@@ -121,7 +121,7 @@ def removeObservers(self):
self.CrosshairNode.RemoveObserver(self.CrosshairNodeObserverTag)
self.CrosshairNodeObserverTag = None
- def getPixelString(self,volumeNode,ijk):
+ def getPixelString(self, volumeNode, ijk):
"""Given a volume node, create a human readable
string describing the contents"""
# TODO: the volume nodes should have a way to generate
@@ -169,7 +169,7 @@ def getPixelString(self,volumeNode,ijk):
value = self.calculateTensorScalars(tensor, operation=operation)
if value is not None:
valueString = ("%f" % value).rstrip('0').rstrip('.')
- return "%s %s"%(scalarVolumeDisplayNode.GetScalarInvariantAsString(), valueString)
+ return "%s %s" % (scalarVolumeDisplayNode.GetScalarInvariantAsString(), valueString)
else:
return scalarVolumeDisplayNode.GetScalarInvariantAsString()
@@ -178,7 +178,7 @@ def getPixelString(self,volumeNode,ijk):
if numberOfComponents > 3:
return "%d components" % numberOfComponents
for c in range(numberOfComponents):
- component = imageData.GetScalarComponentAsDouble(ijk[0],ijk[1],ijk[2],c)
+ component = imageData.GetScalarComponentAsDouble(ijk[0], ijk[1], ijk[2], c)
if component.is_integer():
component = int(component)
# format string according to suggestion here:
@@ -188,11 +188,11 @@ def getPixelString(self,volumeNode,ijk):
pixel += ("%s, " % componentString)
return pixel[:-2]
- def processEvent(self,observee,event):
+ def processEvent(self, observee, event):
# TODO: use a timer to delay calculation and compress events
insideView = False
- ras = [0.0,0.0,0.0]
- xyz = [0.0,0.0,0.0]
+ ras = [0.0, 0.0, 0.0]
+ xyz = [0.0, 0.0, 0.0]
sliceNode = None
if self.CrosshairNode:
insideView = self.CrosshairNode.GetCursorPositionRAS(ras)
@@ -207,12 +207,12 @@ def processEvent(self,observee,event):
if not insideView or not sliceNode or not sliceLogic:
# reset all the readouts
self.viewerColor.text = ""
- self.viewInfo.text = ""
+ self.viewInfo.text = ""
layers = ('L', 'F', 'B')
for layer in layers:
- self.layerNames[layer].setText( "" )
- self.layerIJKs[layer].setText( "" )
- self.layerValues[layer].setText( "" )
+ self.layerNames[layer].setText("")
+ self.layerIJKs[layer].setText("")
+ self.layerValues[layer].setText("")
self.imageLabel.hide()
self.viewerColor.hide()
self.viewInfo.hide()
@@ -226,7 +226,7 @@ def processEvent(self,observee,event):
self.showImageFrame.hide()
# populate the widgets
- self.viewerColor.setText( " " )
+ self.viewerColor.setText(" ")
rgbColor = sliceNode.GetLayoutColor()
color = qt.QColor.fromRgbF(rgbColor[0], rgbColor[1], rgbColor[2])
if hasattr(color, 'name'):
@@ -244,7 +244,7 @@ def _roundInt(value):
layerLogicCalls = (('L', sliceLogic.GetLabelLayer),
('F', sliceLogic.GetForegroundLayer),
('B', sliceLogic.GetBackgroundLayer))
- for layer,logicCall in layerLogicCalls:
+ for layer, logicCall in layerLogicCalls:
layerLogic = logicCall()
volumeNode = layerLogic.GetVolumeNode()
ijk = [0, 0, 0]
@@ -288,7 +288,7 @@ def _roundInt(value):
if hasattr(self.frame.parent(), 'text'):
sceneName = slicer.mrmlScene.GetURL()
if sceneName != "":
- self.frame.parent().text = "Data Probe: %s" % self.fitName(sceneName,nameSize=2*self.nameSize)
+ self.frame.parent().text = "Data Probe: %s" % self.fitName(sceneName, nameSize=2 * self.nameSize)
else:
self.frame.parent().text = "Data Probe"
@@ -310,9 +310,9 @@ def generateViewDescription(self, xyz, ras, sliceNode, sliceLogic):
return \
" {layoutName: <8s} ({rLabel} {ras_x:3.1f}, {aLabel} {ras_y:3.1f}, {sLabel} {ras_z:3.1f}) {orient: >8s} Sp: {spacing:s}" \
.format(layoutName=sliceNode.GetLayoutName(),
- rLabel=sliceNode.GetAxisLabel(1) if ras[0]>=0 else sliceNode.GetAxisLabel(0),
- aLabel=sliceNode.GetAxisLabel(3) if ras[1]>=0 else sliceNode.GetAxisLabel(2),
- sLabel=sliceNode.GetAxisLabel(5) if ras[2]>=0 else sliceNode.GetAxisLabel(4),
+ rLabel=sliceNode.GetAxisLabel(1) if ras[0] >= 0 else sliceNode.GetAxisLabel(0),
+ aLabel=sliceNode.GetAxisLabel(3) if ras[1] >= 0 else sliceNode.GetAxisLabel(2),
+ sLabel=sliceNode.GetAxisLabel(5) if ras[2] >= 0 else sliceNode.GetAxisLabel(4),
ras_x=abs(ras[0]),
ras_y=abs(ras[1]),
ras_z=abs(ras[2]),
@@ -330,7 +330,7 @@ def generateIJKPixelDescription(self, ijk, slicerLayerLogic):
def generateIJKPixelValueDescription(self, ijk, slicerLayerLogic):
volumeNode = slicerLayerLogic.GetVolumeNode()
- return "%s" % self.getPixelString(volumeNode,ijk) if volumeNode else ""
+ return "%s" % self.getPixelString(volumeNode, ijk) if volumeNode else ""
def _createMagnifiedPixmap(self, xyz, inputImageDataConnection, outputSize, crosshairColor, imageZoom=10):
@@ -350,30 +350,30 @@ def _roundInt(value):
xyzInt = [_roundInt(value) for value in xyz]
producer = inputImageDataConnection.GetProducer()
dims = producer.GetOutput().GetDimensions()
- minDim = min(dims[0],dims[1])
- imageSize = _roundInt(minDim/imageZoom/2.0)
- imin = xyzInt[0]-imageSize
- imax = xyzInt[0]+imageSize
- jmin = xyzInt[1]-imageSize
- jmax = xyzInt[1]+imageSize
- imin_trunc = max(0,imin)
- imax_trunc = min(dims[0]-1, imax)
+ minDim = min(dims[0], dims[1])
+ imageSize = _roundInt(minDim / imageZoom / 2.0)
+ imin = xyzInt[0] - imageSize
+ imax = xyzInt[0] + imageSize
+ jmin = xyzInt[1] - imageSize
+ jmax = xyzInt[1] + imageSize
+ imin_trunc = max(0, imin)
+ imax_trunc = min(dims[0] - 1, imax)
jmin_trunc = max(0, jmin)
- jmax_trunc = min(dims[1]-1, jmax)
+ jmax_trunc = min(dims[1] - 1, jmax)
# The extra complexity of the canvas is used here to maintain a fixed size
# output due to the imageCrop returning a smaller image if the limits are
# outside the input image bounds. Specially useful when zooming at the borders.
canvas = self.canvas
canvas.SetScalarType(producer.GetOutput().GetScalarType())
canvas.SetNumberOfScalarComponents(producer.GetOutput().GetNumberOfScalarComponents())
- canvas.SetExtent(imin, imax, jmin , jmax, 0 ,0)
- canvas.FillBox(imin, imax, jmin , jmax)
+ canvas.SetExtent(imin, imax, jmin, jmax, 0, 0)
+ canvas.FillBox(imin, imax, jmin, jmax)
canvas.Update()
if (imin_trunc <= imax_trunc) and (jmin_trunc <= jmax_trunc):
- imageCrop.SetVOI(imin_trunc, imax_trunc, jmin_trunc, jmax_trunc, 0,0)
+ imageCrop.SetVOI(imin_trunc, imax_trunc, jmin_trunc, jmax_trunc, 0, 0)
imageCrop.Update()
vtkImageCropped = imageCrop.GetOutput()
- xyzBounds = [0]*6
+ xyzBounds = [0] * 6
vtkImageCropped.GetBounds(xyzBounds)
xyzBounds = [_roundInt(value) for value in xyzBounds]
canvas.DrawImage(xyzBounds[0], xyzBounds[2], vtkImageCropped)
@@ -390,8 +390,8 @@ def _roundInt(value):
pen = qt.QPen()
pen.setColor(crosshairColor)
painter.setPen(pen)
- painter.drawLine(0, int(imagePixmap.height()/2), imagePixmap.width(), int(imagePixmap.height()/2))
- painter.drawLine(int(imagePixmap.width()/2), 0, int(imagePixmap.width()/2), imagePixmap.height())
+ painter.drawLine(0, int(imagePixmap.height() / 2), imagePixmap.width(), int(imagePixmap.height() / 2))
+ painter.drawLine(int(imagePixmap.width() / 2), 0, int(imagePixmap.width() / 2), imagePixmap.height())
painter.end()
return imagePixmap
return None
@@ -432,7 +432,7 @@ def _createSmall(self):
qSize.setHorizontalPolicy(qt.QSizePolicy.Expanding)
qSize.setVerticalPolicy(qt.QSizePolicy.Expanding)
self.imageLabel.setSizePolicy(qSize)
- #self.imageLabel.setScaledContents(True)
+ # self.imageLabel.setScaledContents(True)
self.frame.layout().addWidget(self.imageLabel)
self.onShowImage(False)
diff --git a/Modules/Scripted/DataProbe/DataProbeLib/DataProbeUtil.py b/Modules/Scripted/DataProbe/DataProbeLib/DataProbeUtil.py
index 43b07683754..07353c6093e 100644
--- a/Modules/Scripted/DataProbe/DataProbeLib/DataProbeUtil.py
+++ b/Modules/Scripted/DataProbe/DataProbeLib/DataProbeUtil.py
@@ -27,9 +27,9 @@ def getParameterNode(self):
def _findParameterNodeInScene(self):
node = None
- size = slicer.mrmlScene.GetNumberOfNodesByClass("vtkMRMLScriptedModuleNode")
+ size = slicer.mrmlScene.GetNumberOfNodesByClass("vtkMRMLScriptedModuleNode")
for i in range(size):
- n = slicer.mrmlScene.GetNthNodeByClass( i, "vtkMRMLScriptedModuleNode" )
+ n = slicer.mrmlScene.GetNthNodeByClass(i, "vtkMRMLScriptedModuleNode")
if n.GetModuleName() == "DataProbe":
node = n
return node
@@ -40,9 +40,9 @@ def _createParameterNode(self):
be called for any other reason.
"""
node = slicer.vtkMRMLScriptedModuleNode()
- node.SetSingletonTag( "DataProbe" )
- node.SetModuleName( "DataProbe" )
- #node.SetParameter( "label", "1" )
+ node.SetSingletonTag("DataProbe")
+ node.SetModuleName("DataProbe")
+ # node.SetParameter( "label", "1" )
slicer.mrmlScene.AddNode(node)
# Since we are a singleton, the scene won't add our node into the scene,
# but will instead insert a copy, so we find that and return it
diff --git a/Modules/Scripted/DataProbe/DataProbeLib/SliceViewAnnotations.py b/Modules/Scripted/DataProbe/DataProbeLib/SliceViewAnnotations.py
index 7ceb27d32ad..185808f27c3 100644
--- a/Modules/Scripted/DataProbe/DataProbeLib/SliceViewAnnotations.py
+++ b/Modules/Scripted/DataProbe/DataProbeLib/SliceViewAnnotations.py
@@ -37,40 +37,40 @@ def __init__(self, layoutManager=None):
self.sliceViewNames = []
self.popupGeometry = qt.QRect()
- self.cornerTexts =[]
+ self.cornerTexts = []
# Bottom Left Corner Text
self.cornerTexts.append({
- '1-Label':{'text':'','category':'A'},
- '2-Foreground':{'text':'','category':'A'},
- '3-Background':{'text':'','category':'A'}
+ '1-Label': {'text': '', 'category': 'A'},
+ '2-Foreground': {'text': '', 'category': 'A'},
+ '3-Background': {'text': '', 'category': 'A'}
})
# Bottom Right Corner Text
# Not used - orientation figure may be drawn there
self.cornerTexts.append({
- '1-TR':{'text':'','category':'A'},
- '2-TE':{'text':'','category':'A'}
+ '1-TR': {'text': '', 'category': 'A'},
+ '2-TE': {'text': '', 'category': 'A'}
})
# Top Left Corner Text
self.cornerTexts.append({
- '1-PatientName':{'text':'','category':'B'},
- '2-PatientID':{'text':'','category':'A'},
- '3-PatientInfo':{'text':'','category':'B'},
- '4-Bg-SeriesDate':{'text':'','category':'B'},
- '5-Fg-SeriesDate':{'text':'','category':'B'},
- '6-Bg-SeriesTime':{'text':'','category':'C'},
- '7-Bg-SeriesTime':{'text':'','category':'C'},
- '8-Bg-SeriesDescription':{'text':'','category':'C'},
- '9-Fg-SeriesDescription':{'text':'','category':'C'}
+ '1-PatientName': {'text': '', 'category': 'B'},
+ '2-PatientID': {'text': '', 'category': 'A'},
+ '3-PatientInfo': {'text': '', 'category': 'B'},
+ '4-Bg-SeriesDate': {'text': '', 'category': 'B'},
+ '5-Fg-SeriesDate': {'text': '', 'category': 'B'},
+ '6-Bg-SeriesTime': {'text': '', 'category': 'C'},
+ '7-Bg-SeriesTime': {'text': '', 'category': 'C'},
+ '8-Bg-SeriesDescription': {'text': '', 'category': 'C'},
+ '9-Fg-SeriesDescription': {'text': '', 'category': 'C'}
})
# Top Right Corner Text
self.cornerTexts.append({
- '1-Institution-Name':{'text':'','category':'B'},
- '2-Referring-Phisycian':{'text':'','category':'B'},
- '3-Manufacturer':{'text':'','category':'C'},
- '4-Model':{'text':'','category':'C'},
- '5-Patient-Position':{'text':'','category':'A'},
- '6-TR':{'text':'','category':'A'},
- '7-TE':{'text':'','category':'A'}
+ '1-Institution-Name': {'text': '', 'category': 'B'},
+ '2-Referring-Phisycian': {'text': '', 'category': 'B'},
+ '3-Manufacturer': {'text': '', 'category': 'C'},
+ '4-Model': {'text': '', 'category': 'C'},
+ '5-Patient-Position': {'text': '', 'category': 'A'},
+ '6-TR': {'text': '', 'category': 'A'},
+ '7-TE': {'text': '', 'category': 'A'}
})
self.annotationsDisplayAmount = 0
@@ -103,7 +103,7 @@ def __init__(self, layoutManager=None):
def create(self):
# Instantiate and connect widgets ...
loader = qt.QUiLoader()
- path = os.path.join(os.path.dirname(__file__), 'Resources', 'UI','settings.ui')
+ path = os.path.join(os.path.dirname(__file__), 'Resources', 'UI', 'settings.ui')
qfile = qt.QFile(path)
qfile.open(qt.QFile.ReadOnly)
self.window = loader.load(qfile)
@@ -111,37 +111,37 @@ def create(self):
find = slicer.util.findChildren
self.cornerTextParametersCollapsibleButton = find(window, 'cornerTextParametersCollapsibleButton')[0]
- self.sliceViewAnnotationsCheckBox = find(window,'sliceViewAnnotationsCheckBox')[0]
+ self.sliceViewAnnotationsCheckBox = find(window, 'sliceViewAnnotationsCheckBox')[0]
self.sliceViewAnnotationsCheckBox.checked = self.sliceViewAnnotationsEnabled
- self.activateCornersGroupBox = find(window,'activateCornersGroupBox')[0]
- self.topLeftCheckBox = find(window,'topLeftCheckBox')[0]
+ self.activateCornersGroupBox = find(window, 'activateCornersGroupBox')[0]
+ self.topLeftCheckBox = find(window, 'topLeftCheckBox')[0]
self.topLeftCheckBox.checked = self.topLeft
- self.topRightCheckBox = find(window,'topRightCheckBox')[0]
+ self.topRightCheckBox = find(window, 'topRightCheckBox')[0]
self.topRightCheckBox.checked = self.topRight
self.bottomLeftCheckBox = find(window, 'bottomLeftCheckBox')[0]
self.bottomLeftCheckBox.checked = self.bottomLeft
- self.level1RadioButton = find(window,'level1RadioButton')[0]
- self.level2RadioButton = find(window,'level2RadioButton')[0]
- self.level3RadioButton = find(window,'level3RadioButton')[0]
+ self.level1RadioButton = find(window, 'level1RadioButton')[0]
+ self.level2RadioButton = find(window, 'level2RadioButton')[0]
+ self.level3RadioButton = find(window, 'level3RadioButton')[0]
- self.fontPropertiesGroupBox = find(window,'fontPropertiesGroupBox')[0]
- self.timesFontRadioButton = find(window,'timesFontRadioButton')[0]
- self.arialFontRadioButton = find(window,'arialFontRadioButton')[0]
+ self.fontPropertiesGroupBox = find(window, 'fontPropertiesGroupBox')[0]
+ self.timesFontRadioButton = find(window, 'timesFontRadioButton')[0]
+ self.arialFontRadioButton = find(window, 'arialFontRadioButton')[0]
if self.fontFamily == 'Times':
self.timesFontRadioButton.checked = True
else:
self.arialFontRadioButton.checked = True
- self.fontSizeSpinBox = find(window,'fontSizeSpinBox')[0]
+ self.fontSizeSpinBox = find(window, 'fontSizeSpinBox')[0]
self.fontSizeSpinBox.value = self.fontSize
- self.backgroundPersistenceCheckBox = find(window,'backgroundPersistenceCheckBox')[0]
+ self.backgroundPersistenceCheckBox = find(window, 'backgroundPersistenceCheckBox')[0]
self.backgroundPersistenceCheckBox.checked = self.backgroundDICOMAnnotationsPersistence
- self.annotationsAmountGroupBox = find(window,'annotationsAmountGroupBox')[0]
+ self.annotationsAmountGroupBox = find(window, 'annotationsAmountGroupBox')[0]
self.restoreDefaultsButton = find(window, 'restoreDefaultsButton')[0]
@@ -243,14 +243,14 @@ def restoreDefaultValues(self):
settings.setValue('DataProbe/sliceViewAnnotations.topLeft', self.topLeft)
settings.setValue('DataProbe/sliceViewAnnotations.topRight', self.topRight)
settings.setValue('DataProbe/sliceViewAnnotations.bottomLeft', self.bottomLeft)
- settings.setValue('DataProbe/sliceViewAnnotations.fontFamily',self.fontFamily)
- settings.setValue('DataProbe/sliceViewAnnotations.fontSize',self.fontSize)
+ settings.setValue('DataProbe/sliceViewAnnotations.fontFamily', self.fontFamily)
+ settings.setValue('DataProbe/sliceViewAnnotations.fontSize', self.fontSize)
settings.setValue('DataProbe/sliceViewAnnotations.bgDICOMAnnotationsPersistence',
self.backgroundDICOMAnnotationsPersistence)
self.updateSliceViewFromGUI()
- def updateGUIFromMRML(self,caller,event):
+ def updateGUIFromMRML(self, caller, event):
if self.parameterNode.GetParameter(self.sliceViewAnnotationsEnabledparameter) == '':
# parameter does not exist - probably initializing
return
@@ -320,7 +320,7 @@ def createActors(self, sliceViewName):
sliceWidget = self.layoutManager.sliceWidget(sliceViewName)
self.sliceWidgets[sliceViewName] = sliceWidget
- def updateViewAnnotations(self,caller,event):
+ def updateViewAnnotations(self, caller, event):
if not self.sliceViewAnnotationsEnabled:
# when self.sliceViewAnnotationsEnabled is set to false
# then annotation and scalar bar gets hidden, therefore
@@ -394,14 +394,14 @@ def makeAnnotationText(self, sliceLogic):
# Update slice corner annotations
#
# Case I: Both background and foregraound
- if ( backgroundVolume is not None and foregroundVolume is not None):
+ if (backgroundVolume is not None and foregroundVolume is not None):
if self.bottomLeft:
foregroundOpacity = sliceCompositeNode.GetForegroundOpacity()
backgroundVolumeName = backgroundVolume.GetName()
foregroundVolumeName = foregroundVolume.GetName()
self.cornerTexts[0]['3-Background']['text'] = 'B: ' + backgroundVolumeName
- self.cornerTexts[0]['2-Foreground']['text'] = 'F: ' + foregroundVolumeName + ' (' + str(
- "%d"%(foregroundOpacity*100)) + '%)'
+ self.cornerTexts[0]['2-Foreground']['text'] = 'F: ' + foregroundVolumeName + ' (' + str(
+ "%d" % (foregroundOpacity * 100)) + '%)'
bgUids = backgroundVolume.GetAttribute('DICOM.instanceUIDs')
fgUids = foregroundVolume.GetAttribute('DICOM.instanceUIDs')
@@ -409,11 +409,11 @@ def makeAnnotationText(self, sliceLogic):
bgUid = bgUids.partition(' ')[0]
fgUid = fgUids.partition(' ')[0]
self.dicomVolumeNode = 1
- self.makeDicomAnnotation(bgUid,fgUid,sliceViewName)
+ self.makeDicomAnnotation(bgUid, fgUid, sliceViewName)
elif (bgUids and self.backgroundDICOMAnnotationsPersistence):
uid = bgUids.partition(' ')[0]
self.dicomVolumeNode = 1
- self.makeDicomAnnotation(uid,None,sliceViewName)
+ self.makeDicomAnnotation(uid, None, sliceViewName)
else:
for key in self.cornerTexts[2]:
self.cornerTexts[2][key]['text'] = ''
@@ -428,7 +428,7 @@ def makeAnnotationText(self, sliceLogic):
uids = backgroundVolume.GetAttribute('DICOM.instanceUIDs')
if uids:
uid = uids.partition(' ')[0]
- self.makeDicomAnnotation(uid,None,sliceViewName)
+ self.makeDicomAnnotation(uid, None, sliceViewName)
self.dicomVolumeNode = 1
else:
self.dicomVolumeNode = 0
@@ -443,7 +443,7 @@ def makeAnnotationText(self, sliceLogic):
if uids:
uid = uids.partition(' ')[0]
# passed UID as bg
- self.makeDicomAnnotation(uid,None,sliceViewName)
+ self.makeDicomAnnotation(uid, None, sliceViewName)
self.dicomVolumeNode = 1
else:
self.dicomVolumeNode = 0
@@ -452,11 +452,11 @@ def makeAnnotationText(self, sliceLogic):
labelOpacity = sliceCompositeNode.GetLabelOpacity()
labelVolumeName = labelVolume.GetName()
self.cornerTexts[0]['1-Label']['text'] = 'L: ' + labelVolumeName + ' (' + str(
- "%d"%(labelOpacity*100)) + '%)'
+ "%d" % (labelOpacity * 100)) + '%)'
self.drawCornerAnnotations(sliceViewName)
- def makeDicomAnnotation(self,bgUid,fgUid,sliceViewName):
+ def makeDicomAnnotation(self, bgUid, fgUid, sliceViewName):
# Do not attempt to retrieve dicom values if no local database exists
if not slicer.dicomDatabase.isOpen:
return
@@ -475,7 +475,7 @@ def makeDicomAnnotation(self,bgUid,fgUid,sliceViewName):
self.cornerTexts[2][key]['text'] = ''
else:
if '1-PatientName' in self.cornerTexts[2]:
- self.cornerTexts[2]['1-PatientName']['text'] = backgroundDicomDic['Patient Name'].replace('^',', ')
+ self.cornerTexts[2]['1-PatientName']['text'] = backgroundDicomDic['Patient Name'].replace('^', ', ')
if '2-PatientID' in self.cornerTexts[2]:
self.cornerTexts[2]['2-PatientID']['text'] = 'ID: ' + backgroundDicomDic['Patient ID']
backgroundDicomDic['Patient Birth Date'] = self.formatDICOMDate(backgroundDicomDic['Patient Birth Date'])
@@ -489,7 +489,7 @@ def makeDicomAnnotation(self,bgUid,fgUid,sliceViewName):
self.cornerTexts[2]['5-Fg-SeriesDate']['text'] = 'F: ' + self.formatDICOMDate(foregroundDicomDic['Series Date'])
else:
if '4-Bg-SeriesDate' in self.cornerTexts[2]:
- self.cornerTexts[2]['4-Bg-SeriesDate']['text'] = self.formatDICOMDate(backgroundDicomDic['Series Date'])
+ self.cornerTexts[2]['4-Bg-SeriesDate']['text'] = self.formatDICOMDate(backgroundDicomDic['Series Date'])
if (backgroundDicomDic['Series Time'] != foregroundDicomDic['Series Time']):
if '6-Bg-SeriesTime' in self.cornerTexts[2]:
@@ -515,8 +515,8 @@ def makeDicomAnnotation(self,bgUid,fgUid,sliceViewName):
dicomDic = self.extractDICOMValues(uid)
if self.topLeft and viewHeight > 150:
- self.cornerTexts[2]['1-PatientName']['text'] = dicomDic['Patient Name'].replace('^',', ')
- self.cornerTexts[2]['2-PatientID']['text'] = 'ID: ' + dicomDic ['Patient ID']
+ self.cornerTexts[2]['1-PatientName']['text'] = dicomDic['Patient Name'].replace('^', ', ')
+ self.cornerTexts[2]['2-PatientID']['text'] = 'ID: ' + dicomDic['Patient ID']
dicomDic['Patient Birth Date'] = self.formatDICOMDate(dicomDic['Patient Birth Date'])
self.cornerTexts[2]['3-PatientInfo']['text'] = self.makePatientInfo(dicomDic)
self.cornerTexts[2]['4-Bg-SeriesDate']['text'] = self.formatDICOMDate(dicomDic['Series Date'])
@@ -526,13 +526,13 @@ def makeDicomAnnotation(self,bgUid,fgUid,sliceViewName):
# top right corner annotation would be hidden if view height is less than 260 pixels
if (self.topRight):
self.cornerTexts[3]['1-Institution-Name']['text'] = dicomDic['Institution Name']
- self.cornerTexts[3]['2-Referring-Phisycian']['text'] = dicomDic['Referring Physician Name'].replace('^',', ')
+ self.cornerTexts[3]['2-Referring-Phisycian']['text'] = dicomDic['Referring Physician Name'].replace('^', ', ')
self.cornerTexts[3]['3-Manufacturer']['text'] = dicomDic['Manufacturer']
self.cornerTexts[3]['4-Model']['text'] = dicomDic['Model']
self.cornerTexts[3]['5-Patient-Position']['text'] = dicomDic['Patient Position']
modality = dicomDic['Modality']
if modality == 'MR':
- self.cornerTexts[3]['6-TR']['text'] = 'TR ' + dicomDic['Repetition Time']
+ self.cornerTexts[3]['6-TR']['text'] = 'TR ' + dicomDic['Repetition Time']
self.cornerTexts[3]['7-TE']['text'] = 'TE ' + dicomDic['Echo Time']
@staticmethod
@@ -550,7 +550,7 @@ def formatDICOMDate(date):
if date != '':
date = date.rstrip()
# convert to ISO 8601 Date format
- standardDate = date[:4] + '-' + date[4:6]+ '-' + date[6:]
+ standardDate = date[:4] + '-' + date[4:6] + '-' + date[6:]
return standardDate
@staticmethod
@@ -559,20 +559,20 @@ def formatDICOMTime(time):
# time field is empty
return ''
studyH = time[:2]
- if int(studyH) > 12 :
- studyH = str (int(studyH) - 12)
+ if int(studyH) > 12:
+ studyH = str(int(studyH) - 12)
clockTime = ' PM'
else:
studyH = studyH
clockTime = ' AM'
studyM = time[2:4]
studyS = time[4:6]
- return studyH + ':' + studyM + ':' + studyS +clockTime
+ return studyH + ':' + studyM + ':' + studyS + clockTime
@staticmethod
- def fitText(text,textSize):
+ def fitText(text, textSize):
if len(text) > textSize:
- preSize = int(textSize/2)
+ preSize = int(textSize / 2)
postSize = preSize - 3
text = text[:preSize] + "..." + text[-postSize:]
return text
@@ -590,19 +590,19 @@ def drawCornerAnnotations(self, sliceViewName):
cornerAnnotation = ''
for key in keys:
text = cornerText[key]['text']
- if ( text != ''):
+ if (text != ''):
text = self.fitText(text, self.maximumTextLength)
# level 1: All categories will be displayed
if self.annotationsDisplayAmount == 0:
- cornerAnnotation = cornerAnnotation+ text + '\n'
+ cornerAnnotation = cornerAnnotation + text + '\n'
# level 2: Category A and B will be displayed
elif self.annotationsDisplayAmount == 1:
if (cornerText[key]['category'] != 'C'):
- cornerAnnotation = cornerAnnotation+ text + '\n'
+ cornerAnnotation = cornerAnnotation + text + '\n'
# level 3 only Category A will be displayed
elif self.annotationsDisplayAmount == 2:
if (cornerText[key]['category'] == 'A'):
- cornerAnnotation = cornerAnnotation+ text + '\n'
+ cornerAnnotation = cornerAnnotation + text + '\n'
sliceCornerAnnotation = self.sliceViews[sliceViewName].cornerAnnotation()
# encode to avoid 'unicode conversion error' for patient names containing international characters
cornerAnnotation = cornerAnnotation
@@ -625,7 +625,7 @@ def extractDICOMValues(self, uid):
if uid in self.extractedDICOMValuesCache.keys():
return self.extractedDICOMValuesCache[uid]
- p ={}
+ p = {}
tags = {
"0008,0021": "Series Date",
"0008,0031": "Series Time",
@@ -645,7 +645,7 @@ def extractDICOMValues(self, uid):
"0018,0081": "Echo Time"
}
for tag in tags.keys():
- value = slicer.dicomDatabase.instanceValue(uid,tag)
+ value = slicer.dicomDatabase.instanceValue(uid, tag)
p[tags[tag]] = value
# Store DICOM tags in cache
diff --git a/Modules/Scripted/Endoscopy/Endoscopy.py b/Modules/Scripted/Endoscopy/Endoscopy.py
index 52d1771d585..f90c6ab4cc0 100644
--- a/Modules/Scripted/Endoscopy/Endoscopy.py
+++ b/Modules/Scripted/Endoscopy/Endoscopy.py
@@ -52,7 +52,7 @@ def __init__(self, parent=None):
ScriptedLoadableModuleWidget.__init__(self, parent)
self.cameraNode = None
self.cameraNodeObserverTag = None
- self.cameraObserverTag= None
+ self.cameraObserverTag = None
# Flythough variables
self.transform = None
self.path = None
@@ -252,21 +252,21 @@ def onCreatePathButtonClicked(self):
self.flythroughCollapsibleButton.enabled = len(result.path) > 0
def frameSliderValueChanged(self, newValue):
- #print "frameSliderValueChanged:", newValue
+ # print "frameSliderValueChanged:", newValue
self.flyTo(newValue)
def frameSkipSliderValueChanged(self, newValue):
- #print "frameSkipSliderValueChanged:", newValue
+ # print "frameSkipSliderValueChanged:", newValue
self.skip = int(newValue)
def frameDelaySliderValueChanged(self, newValue):
- #print "frameDelaySliderValueChanged:", newValue
+ # print "frameDelaySliderValueChanged:", newValue
self.timer.interval = newValue
def viewAngleSliderValueChanged(self, newValue):
if not self.cameraNode:
return
- #print "viewAngleSliderValueChanged:", newValue
+ # print "viewAngleSliderValueChanged:", newValue
self.cameraNode.GetCamera().SetViewAngle(newValue)
def onPlayButtonToggled(self, checked):
@@ -295,13 +295,13 @@ def flyTo(self, pathPointIndex):
wasModified = self.cameraNode.StartModify()
self.camera.SetPosition(cameraPosition)
- focalPointPosition = self.path[pathPointIndex+1]
+ focalPointPosition = self.path[pathPointIndex + 1]
self.camera.SetFocalPoint(*focalPointPosition)
self.camera.OrthogonalizeViewUp()
toParent = vtk.vtkMatrix4x4()
self.transform.GetMatrixTransformToParent(toParent)
- toParent.SetElement(0 ,3, cameraPosition[0])
+ toParent.SetElement(0, 3, cameraPosition[0])
toParent.SetElement(1, 3, cameraPosition[1])
toParent.SetElement(2, 3, cameraPosition[2])
@@ -311,7 +311,7 @@ def flyTo(self, pathPointIndex):
# This can be used for example to show a reformatted slice
# using with SlicerIGT extension's VolumeResliceDriver module.
import numpy as np
- zVec = (focalPointPosition-cameraPosition)/np.linalg.norm(focalPointPosition-cameraPosition)
+ zVec = (focalPointPosition - cameraPosition) / np.linalg.norm(focalPointPosition - cameraPosition)
yVec = self.pathPlaneNormal
xVec = np.cross(yVec, zVec)
xVec /= np.linalg.norm(xVec)
@@ -344,10 +344,10 @@ class EndoscopyComputePath:
"""
- def __init__(self, fiducialListNode, dl = 0.5):
+ def __init__(self, fiducialListNode, dl=0.5):
import numpy
- self.dl = dl # desired world space step size (in mm)
- self.dt = dl # current guess of parametric stepsize
+ self.dl = dl # desired world space step size (in mm)
+ self.dt = dl # current guess of parametric stepsize
self.fids = fiducialListNode
# Already a curve, just get the points, sampled at equal distances.
@@ -356,23 +356,23 @@ def __init__(self, fiducialListNode, dl = 0.5):
# Temporarily increase the number of points per segment, to get a very smooth curve
pointsPerSegment = int(self.fids.GetCurveLengthWorld() / self.dl / self.fids.GetNumberOfControlPoints()) + 1
originalPointsPerSegment = self.fids.GetNumberOfPointsPerInterpolatingSegment()
- if originalPointsPerSegment 0.05:
t1 = t + self.dt
- pguess = self.point(segment,t1)
+ pguess = self.point(segment, t1)
dist = numpy.linalg.norm(pguess - p0)
ratio = self.dl / dist
self.dt *= ratio
@@ -523,7 +523,7 @@ def __init__(self, path, fiducialListNode, outputPathNode=None, cursorType=None)
linesIDArray.InsertNextTuple1(0)
polygons = vtk.vtkCellArray()
- polyData.SetPolys( polygons )
+ polyData.SetPolys(polygons)
idArray = polygons.GetData()
idArray.Reset()
idArray.InsertNextTuple1(0)
@@ -531,7 +531,7 @@ def __init__(self, path, fiducialListNode, outputPathNode=None, cursorType=None)
for point in path:
pointIndex = points.InsertNextPoint(*point)
linesIDArray.InsertNextTuple1(pointIndex)
- linesIDArray.SetTuple1( 0, linesIDArray.GetNumberOfTuples() - 1 )
+ linesIDArray.SetTuple1(0, linesIDArray.GetNumberOfTuples() - 1)
lines.SetNumberOfCells(1)
pointsArray = vtk.util.numpy_support.vtk_to_numpy(points.GetData())
@@ -542,7 +542,7 @@ def __init__(self, path, fiducialListNode, outputPathNode=None, cursorType=None)
if not model:
model = scene.AddNewNodeByClass("vtkMRMLModelNode", scene.GenerateUniqueName("Path-%s" % fids.GetName()))
model.CreateDefaultDisplayNodes()
- model.GetDisplayNode().SetColor(1,1,0) # yellow
+ model.GetDisplayNode().SetColor(1, 1, 0) # yellow
model.SetAndObservePolyData(polyData)
@@ -554,15 +554,15 @@ def __init__(self, path, fiducialListNode, outputPathNode=None, cursorType=None)
# Markups cursor
cursor = scene.AddNewNodeByClass("vtkMRMLMarkupsFiducialNode", scene.GenerateUniqueName("Cursor-%s" % fids.GetName()))
cursor.CreateDefaultDisplayNodes()
- cursor.GetDisplayNode().SetSelectedColor(1,0,0) # red
+ cursor.GetDisplayNode().SetSelectedColor(1, 0, 0) # red
cursor.GetDisplayNode().SetSliceProjection(True)
- cursor.AddControlPoint(vtk.vtkVector3d(0,0,0)," ") # do not show any visible label
+ cursor.AddControlPoint(vtk.vtkVector3d(0, 0, 0), " ") # do not show any visible label
cursor.SetNthControlPointLocked(0, True)
else:
# Model cursor
cursor = scene.AddNewNodeByClass("vtkMRMLMarkupsModelNode", scene.GenerateUniqueName("Cursor-%s" % fids.GetName()))
cursor.CreateDefaultDisplayNodes()
- cursor.GetDisplayNode().SetColor(1,0,0) # red
+ cursor.GetDisplayNode().SetColor(1, 0, 0) # red
cursor.GetDisplayNode().BackfaceCullingOn() # so that the camera can see through the cursor from inside
# Add a sphere as cursor
sphere = vtk.vtkSphereSource()
@@ -593,9 +593,9 @@ def planeFit(self, points):
"""
import numpy as np
from numpy.linalg import svd
- points = np.reshape(points, (np.shape(points)[0], -1)) # Collapse trialing dimensions
+ points = np.reshape(points, (np.shape(points)[0], -1)) # Collapse trialing dimensions
assert points.shape[0] <= points.shape[1], f"There are only {points.shape[1]} points in {points.shape[0]} dimensions."
ctr = points.mean(axis=1)
- x = points - ctr[:,np.newaxis]
- M = np.dot(x, x.T) # Could also use np.cov(x) here.
- return ctr, svd(M)[0][:,-1]
+ x = points - ctr[:, np.newaxis]
+ M = np.dot(x, x.T) # Could also use np.cov(x) here.
+ return ctr, svd(M)[0][:, -1]
diff --git a/Modules/Scripted/ExtensionWizard/ExtensionWizard.py b/Modules/Scripted/ExtensionWizard/ExtensionWizard.py
index e1fc4255025..cc2a55c097d 100644
--- a/Modules/Scripted/ExtensionWizard/ExtensionWizard.py
+++ b/Modules/Scripted/ExtensionWizard/ExtensionWizard.py
@@ -14,7 +14,7 @@
from ExtensionWizardLib import *
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def _settingsList(settings, key, convertToAbsolutePaths=False):
# Return a settings value as a list (even if empty or a single value)
@@ -33,13 +33,13 @@ def _settingsList(settings, key, convertToAbsolutePaths=False):
return value
-#=============================================================================
+# =============================================================================
#
# ExtensionWizard
#
-#=============================================================================
+# =============================================================================
class ExtensionWizard:
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, parent):
parent.title = "Extension Wizard"
parent.icon = qt.QIcon(":/Icons/Medium/ExtensionWizard.png")
@@ -58,14 +58,14 @@ def __init__(self, parent):
slicer.app.settingsDialog().addPanel("Extension Wizard", self.settingsPanel)
-#=============================================================================
+# =============================================================================
#
# ExtensionWizardWidget
#
-#=============================================================================
+# =============================================================================
class ExtensionWizardWidget:
- #---------------------------------------------------------------------------
- def __init__(self, parent = None):
+ # ---------------------------------------------------------------------------
+ def __init__(self, parent=None):
if not parent:
self.parent = qt.QWidget()
self.parent.setLayout(qt.QVBoxLayout())
@@ -86,7 +86,7 @@ def __init__(self, parent = None):
self.templateManager = None
self.setupTemplates()
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def setup(self):
# Instantiate and connect widgets ...
@@ -173,11 +173,11 @@ def createReadOnlyLineEdit():
# Add vertical spacer
self.layout.addStretch(1)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def cleanup(self):
pass
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def setupTemplates(self):
self.templateManager = SlicerWizard.TemplateManager()
@@ -209,7 +209,7 @@ def setupTemplates(self):
qt.qWarning("failed to add template path %r for category %r" % mp)
qt.qWarning(traceback.format_exc())
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def createExtension(self):
dlg = CreateComponentDialog("extension", self.parent.window())
dlg.setTemplates(self.templateManager.templates("extensions"))
@@ -234,8 +234,8 @@ def createExtension(self):
else:
destination = SlicerWizard.Utilities.localRoot(repo)
cmakeFile = os.path.join(destination, "CMakeLists.txt")
- createInSubdirectory = False # create the files in the destination directory
- requireEmptyDirectory = False # we only check if no CMakeLists.txt file exists
+ createInSubdirectory = False # create the files in the destination directory
+ requireEmptyDirectory = False # we only check if no CMakeLists.txt file exists
if os.path.exists(cmakeFile):
raise OSError("create extension: refusing to overwrite"
" directory containing CMakeLists.txt file at '%s'" % dlg.destination)
@@ -257,7 +257,7 @@ def createExtension(self):
return
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def selectExtension(self, path=None):
if path is None or isinstance(path, bool):
path = qt.QFileDialog.getExistingDirectory(
@@ -328,7 +328,7 @@ def selectExtension(self, path=None):
self.extensionLocation = path
return True
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def loadModules(self, path, depth=1):
# Get list of modules in specified path
modules = ModuleInfo.findModules(path, depth)
@@ -401,7 +401,7 @@ def loadModules(self, path, depth=1):
slicer.util.errorDisplay(text, parent=self.parent.window(), windowTitle="Error loading module(s)",
standardButtons=qt.QMessageBox.Close)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def createExtensionModule(self):
if (self.extensionLocation is None):
# Action shouldn't be enabled if no extension is selected, but guard
@@ -439,13 +439,13 @@ def createExtensionModule(self):
" to include the module in the extension build," \
" you will need to update the extension" \
" CMakeLists.txt by hand."
- slicer.util.errorDisplay(text, parent=self.parent.window(), detailedText = traceback.format_exc(),
+ slicer.util.errorDisplay(text, parent=self.parent.window(), detailedText=traceback.format_exc(),
standardButtons=qt.QMessageBox.Close, informativeText=detailedInformation)
self.loadModules(os.path.join(self.extensionLocation, name), depth=0)
return
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def editExtensionMetadata(self):
xd = self.extensionDescription
xp = self.extensionProject
diff --git a/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/CreateComponentDialog.py b/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/CreateComponentDialog.py
index 5121b21bb48..5b6e1980ca8 100644
--- a/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/CreateComponentDialog.py
+++ b/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/CreateComponentDialog.py
@@ -6,13 +6,13 @@
import slicer
-#=============================================================================
+# =============================================================================
#
# _ui_CreateComponentDialog
#
-#=============================================================================
+# =============================================================================
class _ui_CreateComponentDialog:
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, parent):
self.vLayout = qt.QVBoxLayout(parent)
self.formLayout = qt.QFormLayout()
@@ -40,13 +40,13 @@ def __init__(self, parent):
self.vLayout.addWidget(self.buttonBox)
-#=============================================================================
+# =============================================================================
#
# CreateComponentDialog
#
-#=============================================================================
+# =============================================================================
class CreateComponentDialog:
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, componenttype, parent):
self.dialog = qt.QDialog(parent)
self.ui = _ui_CreateComponentDialog(self.dialog)
@@ -57,7 +57,7 @@ def __init__(self, componenttype, parent):
self._typelc = componenttype.lower()
self._typetc = componenttype.title()
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def accept(self):
if not len(self.componentName):
slicer.util.errorDisplay("%s name may not be empty." % self._typetc,
@@ -73,7 +73,7 @@ def accept(self):
self.dialog.accept()
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def setTemplates(self, templates, default="default"):
self.ui.componentType.clear()
self.ui.componentType.addItems(templates)
@@ -83,16 +83,16 @@ def setTemplates(self, templates, default="default"):
except ValueError:
pass
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def exec_(self):
return self.dialog.exec_()
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@property
def showDestination(self):
return self.ui.destination.visible
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@showDestination.setter
def showDestination(self, value):
field = self.ui.destination
@@ -101,17 +101,17 @@ def showDestination(self, value):
label.visible = value
field.visible = value
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@property
def componentName(self):
return self.ui.componentName.text
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@property
def componentType(self):
return self.ui.componentType.currentText
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@property
def destination(self):
return self.ui.destination.currentPath
diff --git a/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/DirectoryListWidget.py b/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/DirectoryListWidget.py
index b83d6577187..991004de891 100644
--- a/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/DirectoryListWidget.py
+++ b/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/DirectoryListWidget.py
@@ -3,13 +3,13 @@
import slicer
-#=============================================================================
+# =============================================================================
#
# _ui_DirectoryListWidget
#
-#=============================================================================
+# =============================================================================
class _ui_DirectoryListWidget:
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, parent):
layout = qt.QGridLayout(parent)
@@ -27,13 +27,13 @@ def __init__(self, parent):
layout.addWidget(self.removePathButton, 1, 1)
-#=============================================================================
+# =============================================================================
#
# DirectoryListWidget
#
-#=============================================================================
+# =============================================================================
class DirectoryListWidget(qt.QWidget):
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, *args, **kwargs):
qt.QWidget.__init__(self, *args, **kwargs)
self.ui = _ui_DirectoryListWidget(self)
@@ -42,7 +42,7 @@ def __init__(self, *args, **kwargs):
self.ui.removePathButton.connect('clicked()', self.ui.pathList,
'removeSelectedDirectories()')
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def addDirectory(self):
path = qt.QFileDialog.getExistingDirectory(self.window(), "Select folder")
if len(path):
diff --git a/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/EditExtensionMetadataDialog.py b/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/EditExtensionMetadataDialog.py
index 96b7037671e..62d9d307b26 100644
--- a/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/EditExtensionMetadataDialog.py
+++ b/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/EditExtensionMetadataDialog.py
@@ -7,19 +7,19 @@
from .EditableTreeWidget import EditableTreeWidget
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def _map_property(objfunc, name):
return property(lambda self: getattr(objfunc(self), name),
lambda self, value: setattr(objfunc(self), name, value))
-#=============================================================================
+# =============================================================================
#
# _ui_EditExtensionMetadataDialog
#
-#=============================================================================
+# =============================================================================
class _ui_EditExtensionMetadataDialog:
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, parent):
vLayout = qt.QVBoxLayout(parent)
formLayout = qt.QFormLayout()
@@ -50,17 +50,17 @@ def __init__(self, parent):
vLayout.addWidget(self.buttonBox)
-#=============================================================================
+# =============================================================================
#
# EditExtensionMetadataDialog
#
-#=============================================================================
+# =============================================================================
class EditExtensionMetadataDialog:
project = _map_property(lambda self: self.ui.nameEdit, "text")
category = _map_property(lambda self: self.ui.categoryEdit, "text")
description = _map_property(lambda self: self.ui.descriptionEdit, "plainText")
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, parent):
self.dialog = qt.QDialog(parent)
self.ui = _ui_EditExtensionMetadataDialog(self.dialog)
@@ -68,7 +68,7 @@ def __init__(self, parent):
self.ui.buttonBox.connect("accepted()", self.accept)
self.ui.buttonBox.connect("rejected()", self.dialog, "reject()")
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def accept(self):
if not len(self.project):
slicer.util.errorDisplay("Extension name may not be empty.", windowTitle="Invalid metadata", parent=self.dialog)
@@ -81,11 +81,11 @@ def accept(self):
self.dialog.accept()
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def exec_(self):
return self.dialog.exec_()
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@property
def contributors(self):
result = []
@@ -99,7 +99,7 @@ def contributors(self):
result.append(name)
return ", ".join(result)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@contributors.setter
def contributors(self, value):
self.ui.contributorsList.clear()
@@ -110,7 +110,7 @@ def contributors(self, value):
try:
n = c.index("(")
item.setText(0, c[:n].strip())
- item.setText(1, c[n+1:-1].strip())
+ item.setText(1, c[n + 1:-1].strip())
except ValueError:
qt.qWarning("%r: badly formatted contributor" % c)
diff --git a/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/EditableTreeWidget.py b/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/EditableTreeWidget.py
index 061f30ab100..6491f4e4aa9 100644
--- a/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/EditableTreeWidget.py
+++ b/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/EditableTreeWidget.py
@@ -1,7 +1,7 @@
import qt
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def _makeAction(parent, text, icon=None, shortcut=None, slot=None):
action = qt.QAction(text, parent)
@@ -20,7 +20,7 @@ def _makeAction(parent, text, icon=None, shortcut=None, slot=None):
return action
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def _newItemPlaceholderItem(parent):
palette = parent.palette
color = qt.QColor(palette.text().color())
@@ -33,13 +33,13 @@ def _newItemPlaceholderItem(parent):
return item
-#=============================================================================
+# =============================================================================
#
# EditableTreeWidget
#
-#=============================================================================
+# =============================================================================
class EditableTreeWidget(qt.QTreeWidget):
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, *args, **kwargs):
qt.QTreeWidget.__init__(self, *args, **kwargs)
@@ -67,7 +67,7 @@ def __init__(self, *args, **kwargs):
self.connect('itemChanged(QTreeWidgetItem*,int)', self.updateItemData)
self.connect('itemSelectionChanged()', self.updateActions)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def addItem(self, item, placeholder=False):
item.setFlags(item.flags() | qt.Qt.ItemIsEditable)
@@ -79,24 +79,24 @@ def addItem(self, item, placeholder=False):
self._items.insert(pos, item)
self.insertTopLevelItem(pos, item)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def clear(self):
# Delete all but placeholder item
while len(self._items) > 1:
del self._items[0]
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@property
def itemCount(self):
return self.topLevelItemCount - 1
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def selectedRows(self):
placeholder = self._items[-1]
items = self.selectedItems()
return [self.indexOfTopLevelItem(i) for i in items if i is not placeholder]
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def setSelectedRows(self, rows):
sm = self.selectionModel()
sm.clear()
@@ -104,7 +104,7 @@ def setSelectedRows(self, rows):
for item in (self.topLevelItem(row) for row in rows):
item.setSelected(True)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def updateActions(self):
placeholder = self._items[-1]
@@ -117,7 +117,7 @@ def updateActions(self):
self._shiftDownAction.enabled = len(rows) and not last in rows
self._deleteAction.enabled = True if len(rows) else False
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def updateItemData(self, item, column):
# Create new placeholder item if edited item is current placeholder
if item is self._items[-1]:
@@ -131,7 +131,7 @@ def updateItemData(self, item, column):
# Update actions so new item can be moved/deleted
self.updateActions()
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def shiftSelection(self, delta):
current = self.currentItem()
@@ -145,15 +145,15 @@ def shiftSelection(self, delta):
self.setSelectedRows(row + delta for row in rows)
self.setCurrentItem(current)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def shiftSelectionUp(self):
self.shiftSelection(-1)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def shiftSelectionDown(self):
self.shiftSelection(+1)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def deleteSelection(self):
rows = self.selectedRows()
for row in reversed(sorted(rows)):
diff --git a/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/LoadModulesDialog.py b/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/LoadModulesDialog.py
index 1236da150ae..d31ae2a3e95 100644
--- a/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/LoadModulesDialog.py
+++ b/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/LoadModulesDialog.py
@@ -3,20 +3,20 @@
import slicer
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def _dialogIcon(icon):
s = slicer.app.style()
i = s.standardIcon(icon)
return i.pixmap(qt.QSize(64, 64))
-#=============================================================================
+# =============================================================================
#
# _ui_LoadModulesDialog
#
-#=============================================================================
+# =============================================================================
class _ui_LoadModulesDialog:
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, parent):
vLayout = qt.QVBoxLayout(parent)
hLayout = qt.QHBoxLayout()
@@ -51,13 +51,13 @@ def __init__(self, parent):
vLayout.addWidget(self.buttonBox)
-#=============================================================================
+# =============================================================================
#
# LoadModulesDialog
#
-#=============================================================================
+# =============================================================================
class LoadModulesDialog:
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, parent):
self.dialog = qt.QDialog(parent)
self.ui = _ui_LoadModulesDialog(self.dialog)
@@ -66,7 +66,7 @@ def __init__(self, parent):
self.ui.buttonBox.connect("rejected()", self.dialog, "reject()")
self.ui.moduleList.connect("itemChanged(QListWidgetItem*)", self.validate)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def validate(self):
moduleCount = len(self.selectedModules)
@@ -91,11 +91,11 @@ def validate(self):
self.ui.enableDeveloperMode.visible = False
self.ui.enableDeveloperMode.checked = False
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def exec_(self):
return self.dialog.exec_()
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def setModules(self, modules):
self.ui.moduleList.clear()
self._moduleItems = {}
@@ -122,17 +122,17 @@ def setModules(self, modules):
self.validate()
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@property
def addToSearchPaths(self):
return self.ui.addToSearchPaths.checked
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@property
def enableDeveloperMode(self):
return self.ui.enableDeveloperMode.checked
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@property
def selectedModules(self):
result = []
diff --git a/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/ModuleInfo.py b/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/ModuleInfo.py
index faa811f5db3..d7b0fe15945 100644
--- a/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/ModuleInfo.py
+++ b/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/ModuleInfo.py
@@ -1,18 +1,18 @@
import os
-#=============================================================================
+# =============================================================================
#
# _ui_CreateComponentDialog
#
-#=============================================================================
-#=============================================================================
+# =============================================================================
+# =============================================================================
#
# ModuleInfo
#
-#=============================================================================
+# =============================================================================
class ModuleInfo:
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, path, key=None):
self.path = path
self.searchPath = os.path.dirname(path)
@@ -22,15 +22,15 @@ def __init__(self, path, key=None):
else:
self.key = key
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __repr__(self):
return "ModuleInfo(key=%(key)r, path=%(path)r)" % self.__dict__
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __str__(self):
return self.path
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@staticmethod
def findModules(path, depth):
result = []
diff --git a/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/SettingsPanel.py b/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/SettingsPanel.py
index 166ad1bc5ec..cf065dcda88 100644
--- a/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/SettingsPanel.py
+++ b/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/SettingsPanel.py
@@ -7,13 +7,13 @@
from .TemplatePathUtilities import *
-#=============================================================================
+# =============================================================================
#
# _ui_SettingsPanel
#
-#=============================================================================
+# =============================================================================
class _ui_SettingsPanel:
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, parent):
self.formLayout = qt.QFormLayout(parent)
@@ -37,20 +37,20 @@ def __init__(self, parent):
self.addRow("Additional template\npaths for %s:" % category,
self.paths[category])
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def addRow(self, label, widget):
self.formLayout.addRow(label, widget)
label = self.formLayout.labelForField(widget)
label.alignment = self.formLayout.labelAlignment
-#=============================================================================
+# =============================================================================
#
# SettingsPanel
#
-#=============================================================================
+# =============================================================================
class SettingsPanel(ctk.ctkSettingsPanel):
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, *args, **kwargs):
ctk.ctkSettingsPanel.__init__(self, *args, **kwargs)
self.ui = _ui_SettingsPanel(self)
diff --git a/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/TemplatePathUtilities.py b/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/TemplatePathUtilities.py
index 03d77b0c2f4..9d5d49c62a8 100644
--- a/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/TemplatePathUtilities.py
+++ b/Modules/Scripted/ExtensionWizard/ExtensionWizardLib/TemplatePathUtilities.py
@@ -5,7 +5,7 @@
_userTemplatePathKey = "ExtensionWizard/TemplatePaths"
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def userTemplatePathKey(category=None):
if category is None:
return _userTemplatePathKey
@@ -13,7 +13,7 @@ def userTemplatePathKey(category=None):
return f"{_userTemplatePathKey}/{category}"
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def builtinTemplatePath():
# Look for templates in source directory first
path = slicer.util.sourceDir()
diff --git a/Modules/Scripted/PerformanceTests/PerformanceTests.py b/Modules/Scripted/PerformanceTests/PerformanceTests.py
index 3b6d690fd66..a93ad575e9e 100644
--- a/Modules/Scripted/PerformanceTests/PerformanceTests.py
+++ b/Modules/Scripted/PerformanceTests/PerformanceTests.py
@@ -32,12 +32,12 @@ class PerformanceTestsWidget(ScriptedLoadableModuleWidget):
def setup(self):
ScriptedLoadableModuleWidget.setup(self)
tests = (
- ( 'Get Sample Data', self.downloadMRHead ),
- ( 'Reslicing', self.reslicing ),
- ( 'Crosshair Jump', self.crosshairJump ),
- ( 'Web View Test', self.webViewTest ),
- ( 'Fill Out Web Form Test', self.webViewFormTest ),
- ( 'Memory Check', self.memoryCheck ),
+ ('Get Sample Data', self.downloadMRHead),
+ ('Reslicing', self.reslicing),
+ ('Crosshair Jump', self.crosshairJump),
+ ('Web View Test', self.webViewTest),
+ ('Fill Out Web Form Test', self.webViewFormTest),
+ ('Memory Check', self.memoryCheck),
)
for test in tests:
@@ -80,8 +80,8 @@ def timeSteps(self, iters, f):
endTime = time.time()
elapsedTime += (endTime - startTime)
fps = int(iters / elapsedTime)
- result = f"fps = {fps:g} ({1000./fps:g} ms per frame)"
- print (result)
+ result = f"fps = {fps:g} ({1000./fps:g} ms per frame)"
+ print(result)
self.log.insertHtml('%s' % result)
self.log.insertPlainText('\n')
self.log.ensureCursorVisible()
@@ -99,16 +99,16 @@ def reslicing(self, iters=100):
sliceOffset = 5
offsetSteps = 10
numerOfSweeps = int(math.ceil(iters / offsetSteps))
- renderingTimesSec = np.zeros(numerOfSweeps*offsetSteps*2)
+ renderingTimesSec = np.zeros(numerOfSweeps * offsetSteps * 2)
sampleIndex = 0
startOffset = sliceNode.GetSliceOffset()
for i in range(numerOfSweeps):
- for offset in ([sliceOffset]*offsetSteps + [-sliceOffset]*offsetSteps):
+ for offset in ([sliceOffset] * offsetSteps + [-sliceOffset] * offsetSteps):
startTime = time.time()
- sliceNode.SetSliceOffset(sliceNode.GetSliceOffset()+offset)
+ sliceNode.SetSliceOffset(sliceNode.GetSliceOffset() + offset)
slicer.app.processEvents()
endTime = time.time()
- renderingTimesSec[sampleIndex] = (endTime-startTime)
+ renderingTimesSec[sampleIndex] = (endTime - startTime)
sampleIndex += 1
sliceNode.SetSliceOffset(startOffset)
@@ -119,8 +119,8 @@ def reslicing(self, iters=100):
renderingTimeMean = np.mean(renderingTimesSec)
renderingTimeStd = np.std(renderingTimesSec)
result = ("%d x %d, fps = %.1f (%.1f +/- %.2f ms per frame) - see details in table '%s'"
- % (dims[0], dims[1], 1.0/renderingTimeMean, 1000. * renderingTimeMean, 1000. * renderingTimeStd, resultTableNode.GetName()))
- print (result)
+ % (dims[0], dims[1], 1.0 / renderingTimeMean, 1000. * renderingTimeMean, 1000. * renderingTimeStd, resultTableNode.GetName()))
+ print(result)
self.log.insertHtml('%s' % result)
self.log.insertPlainText('\n')
self.log.ensureCursorVisible()
@@ -138,27 +138,27 @@ def crosshairJump(self, iters=15):
firstSliceViewName = 'Red' if 'Red' in sliceViewNames else sliceViewNames[0]
firstSliceWidget = layoutManager.sliceWidget(firstSliceViewName)
elapsedTime = 0
- startPoint = (int(dims[0]*0.3), int(dims[1]*0.3))
- endPoint = (int(dims[0]*0.6), int(dims[1]*0.6))
+ startPoint = (int(dims[0] * 0.3), int(dims[1] * 0.3))
+ endPoint = (int(dims[0] * 0.6), int(dims[1] * 0.6))
for i in range(iters):
startTime = time.time()
- slicer.util.clickAndDrag(firstSliceWidget, button = None, modifiers = ['Shift'], start=startPoint, end=endPoint, steps=2)
+ slicer.util.clickAndDrag(firstSliceWidget, button=None, modifiers=['Shift'], start=startPoint, end=endPoint, steps=2)
slicer.app.processEvents()
endTime1 = time.time()
- slicer.util.clickAndDrag(firstSliceWidget, button = None, modifiers = ['Shift'], start=endPoint, end=startPoint, steps=2)
+ slicer.util.clickAndDrag(firstSliceWidget, button=None, modifiers=['Shift'], start=endPoint, end=startPoint, steps=2)
slicer.app.processEvents()
endTime2 = time.time()
- delta = ((endTime1-startTime) + (endTime2 - endTime1)) / 2.
+ delta = ((endTime1 - startTime) + (endTime2 - endTime1)) / 2.
elapsedTime += delta
fps = int(iters / elapsedTime)
- result = "number of slice views = %d, fps = %g (%g ms per frame)" % (len(sliceViewNames), fps, 1000./fps)
- print (result)
+ result = "number of slice views = %d, fps = %g (%g ms per frame)" % (len(sliceViewNames), fps, 1000. / fps)
+ print(result)
self.log.insertHtml('%s' % result)
self.log.insertPlainText('\n')
self.log.ensureCursorVisible()
self.log.repaint()
- def webViewCallback(self,qurl):
+ def webViewCallback(self, qurl):
url = qurl.toString()
print(url)
if url == 'reslicing':
@@ -190,7 +190,7 @@ def webViewFormTest(self):
u = qt.QUrl('https://www.google.com')
self.webView.setUrl(u)
- def webViewFormLoadedCallback(self,ok):
+ def webViewFormLoadedCallback(self, ok):
if not ok:
print('page did not load')
return
@@ -209,11 +209,11 @@ def memoryCallback(self):
self.sysInfo.GetAvailableVirtualMemory(),
self.sysInfo.GetTotalVirtualMemory(),
))
- qt.QTimer.singleShot(1000,self.memoryCallback)
+ qt.QTimer.singleShot(1000, self.memoryCallback)
def memoryCheck(self):
"""Run a periodic memory check in a window"""
- if not hasattr(self,'sysInfo'):
+ if not hasattr(self, 'sysInfo'):
self.sysInfo = slicer.vtkSystemInformation()
self.sysInfoWindow = qt.QTextBrowser()
if self.sysInfoWindow.visible:
@@ -233,8 +233,8 @@ def __init__(self):
self.sliceLogic.SetSliceNode(self.sliceNode)
def stepSliceLogic(self):
- self.sliceNode.SetSliceOffset( -1*self.step*10)
- self.step = 1^self.step
+ self.sliceNode.SetSliceOffset(-1 * self.step * 10)
+ self.step = 1 ^ self.step
def testSliceLogic(self, iters):
timeSteps(iters, self.stepSliceLogic)
diff --git a/Modules/Scripted/SampleData/SampleData.py b/Modules/Scripted/SampleData/SampleData.py
index 383996f431c..4c3903cb61d 100644
--- a/Modules/Scripted/SampleData/SampleData.py
+++ b/Modules/Scripted/SampleData/SampleData.py
@@ -91,11 +91,11 @@ def __init__(self, parent):
use it for commercial purposes.
"""
- if slicer.mrmlScene.GetTagByClassName( "vtkMRMLScriptedModuleNode" ) != 'ScriptedModule':
+ if slicer.mrmlScene.GetTagByClassName("vtkMRMLScriptedModuleNode") != 'ScriptedModule':
slicer.mrmlScene.RegisterNodeClass(vtkMRMLScriptedModuleNode())
# Trigger the menu to be added when application has started up
- if not slicer.app.commandOptions().noMainWindow :
+ if not slicer.app.commandOptions().noMainWindow:
slicer.app.connect("startupCompleted()", self.addMenu)
# allow other modules to register sample data sources by appending
@@ -170,12 +170,12 @@ def __init__(self, sampleName=None, sampleDescription=None, uris=None, fileNames
if checksums is None:
checksums = [None] * len(uris)
elif isinstance(uris, str):
- uris = [uris,]
- fileNames = [fileNames,]
- nodeNames = [nodeNames,]
- loadFiles = [loadFiles,]
- loadFileType = [loadFileType,]
- checksums = [checksums,]
+ uris = [uris, ]
+ fileNames = [fileNames, ]
+ nodeNames = [nodeNames, ]
+ loadFiles = [loadFiles, ]
+ loadFileType = [loadFileType, ]
+ checksums = [checksums, ]
updatedFileType = []
for fileName, nodeName, fileType in zip(fileNames, nodeNames, loadFileType):
@@ -297,15 +297,15 @@ def setCategoriesFromSampleDataSources(categoryLayout, dataSources, logic):
Download buttons are organized in collapsible GroupBox with one GroupBox
per category.
"""
- iconPath = os.path.join(os.path.dirname(__file__).replace('\\','/'), 'Resources','Icons')
+ iconPath = os.path.join(os.path.dirname(__file__).replace('\\', '/'), 'Resources', 'Icons')
mainWindow = slicer.util.mainWindow()
if mainWindow:
- iconSize = qt.QSize(int(mainWindow.width/8),int(mainWindow.height/6))
+ iconSize = qt.QSize(int(mainWindow.width / 8), int(mainWindow.height / 6))
else:
# There is no main window in the automated tests
desktop = qt.QDesktopWidget()
mainScreenSize = desktop.availableGeometry(desktop.primaryScreen)
- iconSize = qt.QSize(int(mainScreenSize.width()/15),int(mainScreenSize.height()/10))
+ iconSize = qt.QSize(int(mainScreenSize.width() / 15), int(mainScreenSize.height() / 10))
categories = sorted(dataSources.keys())
@@ -344,7 +344,7 @@ def setCategoriesFromSampleDataSources(categoryLayout, dataSources, logic):
for nodeName in source.nodeNames:
if not nodeName:
continue
- thumbnailImageAttempt = os.path.join(iconPath, nodeName+'.png')
+ thumbnailImageAttempt = os.path.join(iconPath, nodeName + '.png')
if os.path.exists(thumbnailImageAttempt):
thumbnailImage = thumbnailImageAttempt
break
@@ -373,7 +373,7 @@ def logMessage(self, message, logLevel=logging.DEBUG):
# Show message in status bar
doc = qt.QTextDocument()
doc.setHtml(message)
- slicer.util.showStatusMessage(doc.toPlainText(),3000)
+ slicer.util.showStatusMessage(doc.toPlainText(), 3000)
# Show message in log window at the bottom of the module widget
self.log.insertHtml(message)
self.log.insertPlainText('\n')
@@ -596,7 +596,7 @@ def registerBuiltInSampleDataSources(self):
def registerDevelopmentSampleDataSources(self):
"""Fills in the sample data sources displayed only if developer mode is enabled."""
- iconPath = os.path.join(os.path.dirname(__file__).replace('\\','/'), 'Resources','Icons')
+ iconPath = os.path.join(os.path.dirname(__file__).replace('\\', '/'), 'Resources', 'Icons')
self.registerCustomSampleDataSource(
category=self.developmentCategoryName, sampleName='TinyPatient',
uris=[TESTING_DATA_URL + 'SHA256/c0743772587e2dd4c97d4e894f5486f7a9a202049c8575e032114c0a5c935c3b',
@@ -630,7 +630,7 @@ def downloadSourceIntoCache(self, source):
"""Download all files for the given source and return a
list of file paths for the results"""
filePaths = []
- for uri,fileName,checksum in zip(source.uris,source.fileNames,source.checksums):
+ for uri, fileName, checksum in zip(source.uris, source.fileNames, source.checksums):
filePaths.append(self.downloadFileIntoCache(uri, fileName, checksum))
return filePaths
@@ -657,7 +657,7 @@ def downloadFromSource(self, source, maximumAttemptsCount=3):
resultNodes = []
resultFilePaths = []
- for uri,fileName,nodeName,checksum,loadFile,loadFileType in zip(source.uris,source.fileNames,source.nodeNames,source.checksums,source.loadFiles,source.loadFileType):
+ for uri, fileName, nodeName, checksum, loadFile, loadFileType in zip(source.uris, source.fileNames, source.nodeNames, source.checksums, source.loadFiles, source.loadFileType):
current_source = SampleDataSource(uris=uri, fileNames=fileName, nodeNames=nodeName, checksums=checksum, loadFiles=loadFile, loadFileType=loadFileType, loadFileProperties=source.loadFileProperties)
@@ -667,7 +667,7 @@ def downloadFromSource(self, source, maximumAttemptsCount=3):
try:
filePath = self.downloadFileIntoCache(uri, fileName, checksum)
except ValueError:
- self.logMessage('Download failed (attempt %d of %d)...' % (attemptsCount+1, maximumAttemptsCount), logging.ERROR)
+ self.logMessage('Download failed (attempt %d of %d)...' % (attemptsCount + 1, maximumAttemptsCount), logging.ERROR)
continue
resultFilePaths.append(filePath)
@@ -706,17 +706,17 @@ def downloadFromSource(self, source, maximumAttemptsCount=3):
file = qt.QFile(filePath)
if file.exists() and not file.remove():
self.logMessage('Load failed (attempt %d of %d). Unable to delete and try again loading %s'
- % (attemptsCount+1, maximumAttemptsCount, filePath), logging.ERROR)
+ % (attemptsCount + 1, maximumAttemptsCount, filePath), logging.ERROR)
resultNodes.append(loadedNode)
break
- self.logMessage('Load failed (attempt %d of %d)...' % (attemptsCount+1, maximumAttemptsCount), logging.ERROR)
+ self.logMessage('Load failed (attempt %d of %d)...' % (attemptsCount + 1, maximumAttemptsCount), logging.ERROR)
if resultNodes:
return resultNodes
else:
return resultFilePaths
- def sourceForSampleName(self,sampleName):
+ def sourceForSampleName(self, sampleName):
"""For a given sample name this will search the available sources.
Returns SampleDataSource instance."""
for category in slicer.modules.sampleDataSources.keys():
@@ -766,12 +766,12 @@ def downloadFromURL(self, uris=None, fileNames=None, nodeNames=None, checksums=N
loadFileType=loadFileTypes, loadFileProperties=loadFileProperties, checksums=checksums
))
- def downloadSample(self,sampleName):
+ def downloadSample(self, sampleName):
"""For a given sample name this will search the available sources
and load it if it is available. Returns the first loaded node."""
return self.downloadSamples(sampleName)[0]
- def downloadSamples(self,sampleName):
+ def downloadSamples(self, sampleName):
"""For a given sample name this will search the available sources
and load it if it is available. Returns the loaded nodes."""
source = self.sourceForSampleName(sampleName)
@@ -823,15 +823,15 @@ def downloadMRUSPostate(self):
# returns list since that's what earlier method did
return self.downloadSamples('MRUSProstate')
- def humanFormatSize(self,size):
+ def humanFormatSize(self, size):
""" from https://stackoverflow.com/questions/1094841/reusable-library-to-get-human-readable-version-of-file-size"""
- for x in ['bytes','KB','MB','GB']:
+ for x in ['bytes', 'KB', 'MB', 'GB']:
if size < 1024.0 and size > -1024.0:
return f"{size:3.1f} {x}"
size /= 1024.0
return "{:3.1f} {}".format(size, 'TB')
- def reportHook(self,blocksSoFar,blockSize,totalSize):
+ def reportHook(self, blocksSoFar, blockSize, totalSize):
# we clamp to 100% because the blockSize might be larger than the file itself
percent = min(int((100. * blocksSoFar * blockSize) / totalSize), 100)
if percent == 100 or (percent - self.downloadPercent >= 10):
@@ -886,7 +886,7 @@ def downloadFile(self, uri, destFolderPath, name, checksum=None):
self.logMessage('File already exists in cache - reusing it.')
return filePath
- def loadScene(self, uri, fileProperties = {}):
+ def loadScene(self, uri, fileProperties={}):
self.logMessage('Requesting load %s ...' % uri)
fileProperties['fileName'] = uri
success = slicer.app.coreIOManager().loadNodes('SceneFile', fileProperties)
@@ -896,7 +896,7 @@ def loadScene(self, uri, fileProperties = {}):
self.logMessage('Load finished')
return True
- def loadNode(self, uri, name, fileType = 'VolumeFile', fileProperties = {}):
+ def loadNode(self, uri, name, fileType='VolumeFile', fileProperties={}):
self.logMessage(f'Requesting load {name} from {uri} ...')
fileProperties['fileName'] = uri
@@ -905,7 +905,7 @@ def loadNode(self, uri, name, fileType = 'VolumeFile', fileProperties = {}):
loadedNodes = vtk.vtkCollection()
success = slicer.app.coreIOManager().loadNodes(fileType, fileProperties, loadedNodes)
- if not success or loadedNodes.GetNumberOfItems()<1:
+ if not success or loadedNodes.GetNumberOfItems() < 1:
self.logMessage('\tLoad failed!', logging.ERROR)
return None
@@ -1161,7 +1161,7 @@ def test_customDownloader(self):
return
slicer.util.selectModule("SampleData")
widget = slicer.modules.SampleDataWidget
- button = slicer.util.findChild(widget.parent,'customDownloaderPushButton')
+ button = slicer.util.findChild(widget.parent, 'customDownloaderPushButton')
self.assertEqual(self.customDownloads, [])
diff --git a/Modules/Scripted/ScreenCapture/ScreenCapture.py b/Modules/Scripted/ScreenCapture/ScreenCapture.py
index 95f426053f7..e20a4cb32a0 100644
--- a/Modules/Scripted/ScreenCapture/ScreenCapture.py
+++ b/Modules/Scripted/ScreenCapture/ScreenCapture.py
@@ -60,7 +60,7 @@ def setup(self):
self.animationMode = None
self.createdOutputFile = None
- self.snapshotIndex = 0 # this counter is used for determining file names for single-image snapshots
+ self.snapshotIndex = 0 # this counter is used for determining file names for single-image snapshots
self.snapshotOutputDir = None
self.snapshotFileNamePattern = None
@@ -82,9 +82,9 @@ def setup(self):
self.viewNodeSelector.noneEnabled = False
self.viewNodeSelector.showHidden = False
self.viewNodeSelector.showChildNodeTypes = False
- self.viewNodeSelector.setMRMLScene( slicer.mrmlScene )
+ self.viewNodeSelector.setMRMLScene(slicer.mrmlScene)
self.viewNodeSelector.setToolTip("This slice or 3D view will be updated during capture."
- "Only this view will be captured unless 'Capture of all views' option in output section is enabled." )
+ "Only this view will be captured unless 'Capture of all views' option in output section is enabled.")
inputFormLayout.addRow("Master view: ", self.viewNodeSelector)
self.captureAllViewsCheckBox = qt.QCheckBox(" ")
@@ -144,8 +144,8 @@ def setup(self):
self.sequenceBrowserNodeSelectorWidget.removeEnabled = False
self.sequenceBrowserNodeSelectorWidget.noneEnabled = False
self.sequenceBrowserNodeSelectorWidget.showHidden = False
- self.sequenceBrowserNodeSelectorWidget.setMRMLScene( slicer.mrmlScene )
- self.sequenceBrowserNodeSelectorWidget.setToolTip( "Items defined by this sequence browser will be replayed." )
+ self.sequenceBrowserNodeSelectorWidget.setMRMLScene(slicer.mrmlScene)
+ self.sequenceBrowserNodeSelectorWidget.setToolTip("Items defined by this sequence browser will be replayed.")
inputFormLayout.addRow(self.sequenceBrowserNodeSelectorLabel, self.sequenceBrowserNodeSelectorWidget)
# Sequence start index
@@ -207,7 +207,7 @@ def setup(self):
self.outputDirSelector.settingKey = 'ScreenCaptureOutputDir'
outputFormLayout.addRow("Output directory:", self.outputDirSelector)
if not self.outputDirSelector.currentPath:
- defaultOutputPath = os.path.abspath(os.path.join(slicer.app.defaultScenePath,'SlicerCapture'))
+ defaultOutputPath = os.path.abspath(os.path.join(slicer.app.defaultScenePath, 'SlicerCapture'))
self.outputDirSelector.setCurrentPath(defaultOutputPath)
self.videoFileNameWidget = qt.QLineEdit()
@@ -287,7 +287,7 @@ def setup(self):
self.ffmpegPathSelector.setToolTip("Set the path to ffmpeg executable. Download from: https://www.ffmpeg.org/")
advancedFormLayout.addRow("ffmpeg executable:", self.ffmpegPathSelector)
- self.videoExportFfmpegWarning = qt.QLabel('Set valid ffmpeg executable path! '+
+ self.videoExportFfmpegWarning = qt.QLabel('Set valid ffmpeg executable path! ' +
'Help...')
self.videoExportFfmpegWarning.connect('linkActivated(QString)', self.openURL)
self.videoExportFfmpegWarning.setVisible(False)
@@ -295,8 +295,8 @@ def setup(self):
self.extraVideoOptionsWidget = qt.QLineEdit()
self.extraVideoOptionsWidget.setToolTip('Additional video conversion options passed to ffmpeg. Parameters -i (input files), -y'
- +'(overwrite without asking), -r (frame rate), -start_number are specified by the module and therefore'
- +'should not be included in this list.')
+ + '(overwrite without asking), -r (frame rate), -start_number are specified by the module and therefore'
+ + 'should not be included in this list.')
advancedFormLayout.addRow("Video extra options:", self.extraVideoOptionsWidget)
self.fileNamePatternWidget = qt.QLineEdit()
@@ -399,7 +399,7 @@ def setup(self):
hbox.addWidget(self.watermarkSizeSliderWidget)
hbox.addWidget(qt.QLabel("Opacity:"))
hbox.addWidget(self.watermarkOpacitySliderWidget)
- #hbox.addStretch()
+ # hbox.addStretch()
advancedFormLayout.addRow("Watermark image:", hbox)
hbox = qt.QHBoxLayout()
@@ -451,7 +451,7 @@ def setup(self):
self.watermarkEnabledCheckBox.connect('toggled(bool)', self.watermarkSizeSliderWidget, 'setEnabled(bool)')
self.watermarkEnabledCheckBox.connect('toggled(bool)', self.watermarkPathSelector, 'setEnabled(bool)')
- self.setVideoLength() # update frame rate based on video length
+ self.setVideoLength() # update frame rate based on video length
self.updateOutputType()
self.updateVideoFormat(0)
self.updateViewOptions()
@@ -466,7 +466,7 @@ def openURL(self, URL):
def onShowCreatedOutputFile(self):
if not self.createdOutputFile:
return
- qt.QDesktopServices().openUrl(qt.QUrl("file:///"+self.createdOutputFile, qt.QUrl.TolerantMode))
+ qt.QDesktopServices().openUrl(qt.QUrl("file:///" + self.createdOutputFile, qt.QUrl.TolerantMode))
def updateOutputType(self, selectionIndex=0):
isVideo = self.outputTypeWidget.currentText == "video"
@@ -506,7 +506,7 @@ def addLog(self, text):
"""
self.statusLabel.appendPlainText(text)
self.statusLabel.ensureCursorVisible()
- slicer.app.processEvents() # force update
+ slicer.app.processEvents() # force update
def cleanup(self):
pass
@@ -515,7 +515,7 @@ def updateViewOptions(self):
sequencesModuleAvailable = hasattr(slicer.modules, 'sequences')
- if self.viewNodeType != self.currentViewNodeType():
+ if self.viewNodeType != self.currentViewNodeType():
self.viewNodeType = self.currentViewNodeType()
self.animationModeWidget.clear()
@@ -573,19 +573,19 @@ def updateViewOptions(self):
if sequenceBrowserNode and sequenceBrowserNode.GetMasterSequenceNode():
sequenceItemCount = sequenceBrowserNode.GetMasterSequenceNode().GetNumberOfDataNodes()
- if sequenceItemCount>0:
+ if sequenceItemCount > 0:
wasBlocked = self.sequenceStartItemIndexWidget.blockSignals(True)
- self.sequenceStartItemIndexWidget.maximum = sequenceItemCount-1
+ self.sequenceStartItemIndexWidget.maximum = sequenceItemCount - 1
self.sequenceStartItemIndexWidget.value = 0
self.sequenceStartItemIndexWidget.blockSignals(wasBlocked)
wasBlocked = self.sequenceEndItemIndexWidget.blockSignals(True)
- self.sequenceEndItemIndexWidget.maximum = sequenceItemCount-1
- self.sequenceEndItemIndexWidget.value = sequenceItemCount-1
+ self.sequenceEndItemIndexWidget.maximum = sequenceItemCount - 1
+ self.sequenceEndItemIndexWidget.value = sequenceItemCount - 1
self.sequenceEndItemIndexWidget.blockSignals(wasBlocked)
- self.sequenceStartItemIndexWidget.enabled = sequenceItemCount>0
- self.sequenceEndItemIndexWidget.enabled = sequenceItemCount>0
+ self.sequenceStartItemIndexWidget.enabled = sequenceItemCount > 0
+ self.sequenceEndItemIndexWidget.enabled = sequenceItemCount > 0
numberOfSteps = int(self.numberOfStepsSliderWidget.value)
forceSingleStep = self.singleStepButton.checked
@@ -673,7 +673,7 @@ def onCaptureButton(self):
if not self.logic.isFfmpegPathValid():
# ffmpeg not found, try to automatically find it at common locations
self.logic.findFfmpeg()
- if not self.logic.isFfmpegPathValid() and os.name == 'nt': # TODO: implement download for Linux/MacOS?
+ if not self.logic.isFfmpegPathValid() and os.name == 'nt': # TODO: implement download for Linux/MacOS?
# ffmpeg not found, offer downloading it
if slicer.util.confirmOkCancelDisplay(
'Video encoder not detected on your system. '
@@ -713,30 +713,30 @@ def onCaptureButton(self):
else:
filename = None
view = None if captureAllViews else self.logic.viewFromNode(viewNode)
- volumeNode = None if numberOfSteps>1 else self.volumeNodeComboBox.currentNode()
+ volumeNode = None if numberOfSteps > 1 else self.volumeNodeComboBox.currentNode()
self.logic.captureImageFromView(view, filename, transparentBackground, volumeNode=volumeNode)
if filename:
- self.logic.addLog("Write "+filename)
+ self.logic.addLog("Write " + filename)
if volumeNode:
self.logic.addLog(f"Write to volume node '{volumeNode.GetName()}'")
elif self.animationModeWidget.currentText == "slice sweep":
self.logic.captureSliceSweep(viewNode, self.sliceStartOffsetSliderWidget.value,
self.sliceEndOffsetSliderWidget.value, numberOfSteps, outputDir, imageFileNamePattern,
- captureAllViews = captureAllViews, transparentBackground = transparentBackground)
+ captureAllViews=captureAllViews, transparentBackground=transparentBackground)
elif self.animationModeWidget.currentText == "slice fade":
self.logic.captureSliceFade(viewNode, numberOfSteps, outputDir, imageFileNamePattern,
- captureAllViews = captureAllViews, transparentBackground = transparentBackground)
+ captureAllViews=captureAllViews, transparentBackground=transparentBackground)
elif self.animationModeWidget.currentText == "3D rotation":
self.logic.capture3dViewRotation(viewNode, self.rotationSliderWidget.minimumValue,
self.rotationSliderWidget.maximumValue, numberOfSteps,
self.rotationAxisWidget.itemData(self.rotationAxisWidget.currentIndex),
outputDir, imageFileNamePattern,
- captureAllViews = captureAllViews, transparentBackground = transparentBackground)
+ captureAllViews=captureAllViews, transparentBackground=transparentBackground)
elif self.animationModeWidget.currentText == "sequence":
self.logic.captureSequence(viewNode, self.sequenceBrowserNodeSelectorWidget.currentNode(),
self.sequenceStartItemIndexWidget.value, self.sequenceEndItemIndexWidget.value,
numberOfSteps, outputDir, imageFileNamePattern,
- captureAllViews = captureAllViews, transparentBackground = transparentBackground)
+ captureAllViews=captureAllViews, transparentBackground=transparentBackground)
else:
raise ValueError('Unsupported view node type.')
@@ -751,17 +751,17 @@ def onCaptureButton(self):
fileIndex = numberOfSteps
for repeatIndex in range(numberOfRepeats):
if forwardBackward:
- for step in reversed(range(1, numberOfSteps-1)):
+ for step in reversed(range(1, numberOfSteps - 1)):
sourceFilename = filePathPattern % step
destinationFilename = filePathPattern % fileIndex
- self.logic.addLog("Copy to "+destinationFilename)
+ self.logic.addLog("Copy to " + destinationFilename)
shutil.copyfile(sourceFilename, destinationFilename)
fileIndex += 1
if repeatIndex < numberOfRepeats - 1:
for step in range(numberOfSteps):
sourceFilename = filePathPattern % step
destinationFilename = filePathPattern % fileIndex
- self.logic.addLog("Copy to "+destinationFilename)
+ self.logic.addLog("Copy to " + destinationFilename)
shutil.copyfile(sourceFilename, destinationFilename)
fileIndex += 1
if forwardBackward and (numberOfSteps > 2):
@@ -815,21 +815,21 @@ def __init__(self):
self.cancelRequested = False
self.videoFormatPresets = [
- {"name": "H.264", "fileExtension": "mp4", "extraVideoOptions": "-codec libx264 -preset slower -pix_fmt yuv420p"},
- {"name": "H.264 (high-quality)", "fileExtension": "mp4", "extraVideoOptions": "-codec libx264 -preset slower -crf 18 -pix_fmt yuv420p"},
- {"name": "MPEG-4", "fileExtension": "mp4", "extraVideoOptions": "-codec mpeg4 -qscale 5"},
- {"name": "MPEG-4 (high-quality)", "fileExtension": "mp4", "extraVideoOptions": "-codec mpeg4 -qscale 3"},
- {"name": "Animated GIF", "fileExtension": "gif", "extraVideoOptions": "-filter_complex palettegen,[v]paletteuse"},
- {"name": "Animated GIF (grayscale)", "fileExtension": "gif", "extraVideoOptions": "-vf format=gray"} ]
+ {"name": "H.264", "fileExtension": "mp4", "extraVideoOptions": "-codec libx264 -preset slower -pix_fmt yuv420p"},
+ {"name": "H.264 (high-quality)", "fileExtension": "mp4", "extraVideoOptions": "-codec libx264 -preset slower -crf 18 -pix_fmt yuv420p"},
+ {"name": "MPEG-4", "fileExtension": "mp4", "extraVideoOptions": "-codec mpeg4 -qscale 5"},
+ {"name": "MPEG-4 (high-quality)", "fileExtension": "mp4", "extraVideoOptions": "-codec mpeg4 -qscale 3"},
+ {"name": "Animated GIF", "fileExtension": "gif", "extraVideoOptions": "-filter_complex palettegen,[v]paletteuse"},
+ {"name": "Animated GIF (grayscale)", "fileExtension": "gif", "extraVideoOptions": "-vf format=gray"}]
self.watermarkPositionPresets = [
{"name": "bottom-left", "position": lambda capturedImageSize, watermarkSize, spacing: [-2, -2]},
{"name": "bottom-right", "position": lambda capturedImageSize, watermarkSize, spacing: [
- -capturedImageSize[0]*spacing+watermarkSize[0]+2, -2]},
+ -capturedImageSize[0] * spacing + watermarkSize[0] + 2, -2]},
{"name": "top-left", "position": lambda capturedImageSize, watermarkSize, spacing: [
- -2, -capturedImageSize[1]*spacing+watermarkSize[1]+2]},
+ -2, -capturedImageSize[1] * spacing + watermarkSize[1] + 2]},
{"name": "top-right", "position": lambda capturedImageSize, watermarkSize, spacing: [
- -capturedImageSize[0]*spacing+watermarkSize[0]+2, -capturedImageSize[1]*spacing+watermarkSize[1]+2]} ]
+ -capturedImageSize[0] * spacing + watermarkSize[0] + 2, -capturedImageSize[1] * spacing + watermarkSize[1] + 2]}]
self.watermarkPosition = -1
self.watermarkSizePercent = 100
@@ -851,9 +851,9 @@ def showViewControllers(self, show):
def getRandomFilePattern(self):
import string
import random
- numberOfRandomChars=5
+ numberOfRandomChars = 5
randomString = ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(numberOfRandomChars))
- filePathPattern = "tmp-"+randomString+"-%05d.png"
+ filePathPattern = "tmp-" + randomString + "-%05d.png"
return filePathPattern
def isFfmpegPathValid(self):
@@ -862,7 +862,7 @@ def isFfmpegPathValid(self):
return os.path.isfile(ffmpegPath)
def getDownloadedFfmpegDirectory(self):
- return os.path.dirname(slicer.app.slicerUserSettingsFilePath)+'/ffmpeg'
+ return os.path.dirname(slicer.app.slicerUserSettingsFilePath) + '/ffmpeg'
def getFfmpegExecutableFilename(self):
if os.name == 'nt':
@@ -896,8 +896,8 @@ def findFfmpegInDirectory(self, ffmpegDir):
ffmpegExecutableFilename = self.getFfmpegExecutableFilename()
for dirpath, dirnames, files in os.walk(ffmpegDir):
for name in files:
- if name==ffmpegExecutableFilename:
- ffmpegExecutablePath = (dirpath + '/' + name).replace('\\','/')
+ if name == ffmpegExecutableFilename:
+ ffmpegExecutablePath = (dirpath + '/' + name).replace('\\', '/')
self.setFfmpegPath(ffmpegExecutablePath)
return True
return False
@@ -940,7 +940,7 @@ def ffmpegDownload(self):
try:
logging.info('Requesting download ffmpeg from %s...' % url)
import urllib.request, urllib.error, urllib.parse
- req = urllib.request.Request(url, headers={ 'User-Agent': 'Mozilla/5.0' })
+ req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'})
data = urllib.request.urlopen(req).read()
with open(filePath, "wb") as f:
f.write(data)
@@ -997,8 +997,8 @@ def getSliceOffsetRange(self, sliceNode):
# increase range if it is empty
# to allow capturing even when no volumes are shown in slice views
if sliceOffsetMin == sliceOffsetMax:
- sliceOffsetMin = sliceLogic.GetSliceOffset()-100
- sliceOffsetMax = sliceLogic.GetSliceOffset()+100
+ sliceOffsetMin = sliceLogic.GetSliceOffset() - 100
+ sliceOffsetMax = sliceLogic.GetSliceOffset() + 100
return sliceOffsetMin, sliceOffsetMax
@@ -1007,7 +1007,7 @@ def getSliceOffsetResolution(self, sliceNode):
sliceOffsetResolution = 1.0
sliceSpacing = sliceLogic.GetLowestVolumeSliceSpacing()
- if sliceSpacing is not None and sliceSpacing[2]>0:
+ if sliceSpacing is not None and sliceSpacing[2] > 0:
sliceOffsetResolution = sliceSpacing[2]
return sliceOffsetResolution
@@ -1023,7 +1023,7 @@ def captureImageFromView(self, view, filename=None, transparentBackground=False,
"""
slicer.app.processEvents()
if view:
- if type(view)==slicer.qMRMLSliceView or type(view)==slicer.qMRMLThreeDView:
+ if type(view) == slicer.qMRMLSliceView or type(view) == slicer.qMRMLThreeDView:
view.forceRender()
else:
view.repaint()
@@ -1041,11 +1041,11 @@ def captureImageFromView(self, view, filename=None, transparentBackground=False,
# Grab the main window and use only the viewport's area
allViews = slicer.app.layoutManager().viewport()
- topLeft = allViews.mapTo(slicer.util.mainWindow(),allViews.rect.topLeft())
- bottomRight = allViews.mapTo(slicer.util.mainWindow(),allViews.rect.bottomRight())
+ topLeft = allViews.mapTo(slicer.util.mainWindow(), allViews.rect.topLeft())
+ bottomRight = allViews.mapTo(slicer.util.mainWindow(), allViews.rect.bottomRight())
imageSize = bottomRight - topLeft
- if imageSize.x()<2 or imageSize.y()<2:
+ if imageSize.x() < 2 or imageSize.y() < 2:
# image is too small, most likely it is invalid
raise ValueError('Capture image from view failed')
@@ -1063,11 +1063,11 @@ def captureImageFromView(self, view, filename=None, transparentBackground=False,
if transparentBackground:
originalAlphaBitPlanes = rw.GetAlphaBitPlanes()
rw.SetAlphaBitPlanes(1)
- ren=rw.GetRenderers().GetFirstRenderer()
+ ren = rw.GetRenderers().GetFirstRenderer()
originalGradientBackground = ren.GetGradientBackground()
ren.SetGradientBackground(False)
wti.SetInputBufferTypeToRGBA()
- rw.Render() # need to render after changing bit planes
+ rw.Render() # need to render after changing bit planes
wti.SetInput(rw)
wti.Update()
@@ -1080,7 +1080,7 @@ def captureImageFromView(self, view, filename=None, transparentBackground=False,
imageSize = capturedImage.GetDimensions()
- if imageSize[0]<2 or imageSize[1]<2:
+ if imageSize[0] < 2 or imageSize[1] < 2:
# image is too small, most likely it is invalid
raise ValueError('Capture image from view failed')
@@ -1092,8 +1092,8 @@ def captureImageFromView(self, view, filename=None, transparentBackground=False,
imageClipper.SetClipData(True)
imageClipper.SetInputData(capturedImage)
extent = capturedImage.GetExtent()
- imageClipper.SetOutputWholeExtent(extent[0], extent[1]-1 if imageWidthOdd else extent[1],
- extent[2], extent[3]-1 if imageHeightOdd else extent[3],
+ imageClipper.SetOutputWholeExtent(extent[0], extent[1] - 1 if imageWidthOdd else extent[1],
+ extent[2], extent[3] - 1 if imageHeightOdd else extent[3],
extent[4], extent[5])
imageClipper.Update()
capturedImage = imageClipper.GetOutput()
@@ -1174,8 +1174,8 @@ def addWatermark(self, capturedImage):
watermarkResize.Update()
blend = vtk.vtkImageBlend()
- blend.SetOpacity(0, 1.0-self.watermarkOpacityPercent*0.01)
- blend.SetOpacity(1, self.watermarkOpacityPercent*0.01)
+ blend.SetOpacity(0, 1.0 - self.watermarkOpacityPercent * 0.01)
+ blend.SetOpacity(1, self.watermarkOpacityPercent * 0.01)
blend.AddInputData(capturedImage)
blend.AddInputData(watermarkResize.GetOutput())
blend.Update()
@@ -1212,7 +1212,7 @@ def viewFromNode(self, viewNode):
raise ValueError('Invalid view node.')
def captureSliceSweep(self, sliceNode, startSliceOffset, endSliceOffset, numberOfImages,
- outputDir, outputFilenamePattern, captureAllViews = None, transparentBackground = False):
+ outputDir, outputFilenamePattern, captureAllViews=None, transparentBackground=False):
self.cancelRequested = False
@@ -1221,18 +1221,18 @@ def captureSliceSweep(self, sliceNode, startSliceOffset, endSliceOffset, numberO
if not os.path.exists(outputDir):
os.makedirs(outputDir)
- filePathPattern = os.path.join(outputDir,outputFilenamePattern)
+ filePathPattern = os.path.join(outputDir, outputFilenamePattern)
sliceLogic = self.getSliceLogicFromSliceNode(sliceNode)
originalSliceOffset = sliceLogic.GetSliceOffset()
sliceView = self.viewFromNode(sliceNode)
compositeNode = sliceLogic.GetSliceCompositeNode()
- offsetStepSize = (endSliceOffset-startSliceOffset)/(numberOfImages-1)
+ offsetStepSize = (endSliceOffset - startSliceOffset) / (numberOfImages - 1)
for offsetIndex in range(numberOfImages):
filename = filePathPattern % offsetIndex
- self.addLog("Write "+filename)
- sliceLogic.SetSliceOffset(startSliceOffset+offsetIndex*offsetStepSize)
+ self.addLog("Write " + filename)
+ sliceLogic.SetSliceOffset(startSliceOffset + offsetIndex * offsetStepSize)
self.captureImageFromView(None if captureAllViews else sliceView, filename, transparentBackground)
if self.cancelRequested:
break
@@ -1242,7 +1242,7 @@ def captureSliceSweep(self, sliceNode, startSliceOffset, endSliceOffset, numberO
raise ValueError('User requested cancel.')
def captureSliceFade(self, sliceNode, numberOfImages, outputDir,
- outputFilenamePattern, captureAllViews = None, transparentBackground = False):
+ outputFilenamePattern, captureAllViews=None, transparentBackground=False):
self.cancelRequested = False
@@ -1262,7 +1262,7 @@ def captureSliceFade(self, sliceNode, numberOfImages, outputDir,
opacityStepSize = (endForegroundOpacity - startForegroundOpacity) / (numberOfImages - 1)
for offsetIndex in range(numberOfImages):
filename = filePathPattern % offsetIndex
- self.addLog("Write "+filename)
+ self.addLog("Write " + filename)
compositeNode.SetForegroundOpacity(startForegroundOpacity + offsetIndex * opacityStepSize)
self.captureImageFromView(None if captureAllViews else sliceView, filename, transparentBackground)
if self.cancelRequested:
@@ -1274,7 +1274,7 @@ def captureSliceFade(self, sliceNode, numberOfImages, outputDir,
raise ValueError('User requested cancel.')
def capture3dViewRotation(self, viewNode, startRotation, endRotation, numberOfImages, rotationAxis,
- outputDir, outputFilenamePattern, captureAllViews = None, transparentBackground = False):
+ outputDir, outputFilenamePattern, captureAllViews=None, transparentBackground=False):
"""
Acquire a set of screenshots of the 3D view while rotating it.
"""
@@ -1336,7 +1336,7 @@ def capture3dViewRotation(self, viewNode, startRotation, endRotation, numberOfIm
def captureSequence(self, viewNode, sequenceBrowserNode, sequenceStartIndex,
sequenceEndIndex, numberOfImages, outputDir, outputFilenamePattern,
- captureAllViews = None, transparentBackground = False):
+ captureAllViews=None, transparentBackground=False):
"""
Acquire a set of screenshots of a view while iterating through a sequence.
"""
@@ -1352,7 +1352,7 @@ def captureSequence(self, viewNode, sequenceBrowserNode, sequenceStartIndex,
renderView = self.viewFromNode(viewNode)
stepSize = (sequenceEndIndex - sequenceStartIndex) / (numberOfImages - 1)
for offsetIndex in range(numberOfImages):
- sequenceBrowserNode.SetSelectedItemNumber(int(sequenceStartIndex+offsetIndex*stepSize))
+ sequenceBrowserNode.SetSelectedItemNumber(int(sequenceStartIndex + offsetIndex * stepSize))
filename = filePathPattern % offsetIndex
self.addLog("Write " + filename)
self.captureImageFromView(None if captureAllViews else renderView, filename, transparentBackground)
@@ -1367,7 +1367,7 @@ def createLightboxImage(self, numberOfColumns, outputDir, imageFileNamePattern,
self.addLog("Export to lightbox image...")
filePathPattern = os.path.join(outputDir, imageFileNamePattern)
import math
- numberOfRows = int(math.ceil(numberOfImages/numberOfColumns))
+ numberOfRows = int(math.ceil(numberOfImages / numberOfColumns))
imageMarginSizePixels = 5
for row in range(numberOfRows):
for column in range(numberOfColumns):
@@ -1405,7 +1405,7 @@ def createLightboxImage(self, numberOfColumns, outputDir, imageFileNamePattern,
writer.SetInputData(lightboxCanvas.GetOutput())
writer.Write()
- self.addLog("Lighbox image saved to file: "+outputLightboxImageFilePath)
+ self.addLog("Lighbox image saved to file: " + outputLightboxImageFilePath)
def createVideo(self, frameRate, extraOptions, outputDir, imageFileNamePattern, videoFileName):
self.addLog("Export to video...")
@@ -1416,20 +1416,20 @@ def createVideo(self, frameRate, extraOptions, outputDir, imageFileNamePattern,
if not ffmpegPath:
raise ValueError("Video creation failed: ffmpeg executable path is not defined")
if not os.path.isfile(ffmpegPath):
- raise ValueError("Video creation failed: ffmpeg executable path is invalid: "+ffmpegPath)
+ raise ValueError("Video creation failed: ffmpeg executable path is invalid: " + ffmpegPath)
filePathPattern = os.path.join(outputDir, imageFileNamePattern)
outputVideoFilePath = os.path.join(outputDir, videoFileName)
ffmpegParams = [ffmpegPath,
"-nostdin", # disable stdin (to prevent hang when running Slicer as background process)
- "-y", # overwrite without asking
+ "-y", # overwrite without asking
"-r", str(frameRate),
"-start_number", "0",
"-i", str(filePathPattern)]
ffmpegParams += [_f for _f in extraOptions.split(' ') if _f]
ffmpegParams.append(outputVideoFilePath)
- self.addLog("Start ffmpeg:\n"+' '.join(ffmpegParams))
+ self.addLog("Start ffmpeg:\n" + ' '.join(ffmpegParams))
import subprocess
p = subprocess.Popen(ffmpegParams, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=outputDir)
@@ -1438,7 +1438,7 @@ def createVideo(self, frameRate, extraOptions, outputDir, imageFileNamePattern,
self.addLog("ffmpeg error output: " + stderr.decode())
raise ValueError("ffmpeg returned with error")
else:
- self.addLog("Video export succeeded to file: "+outputVideoFilePath)
+ self.addLog("Video export succeeded to file: " + outputVideoFilePath)
logging.debug("ffmpeg standard output: " + stdout.decode())
logging.debug("ffmpeg error output: " + stderr.decode())
@@ -1459,7 +1459,7 @@ def getNextAvailableFileName(self, outputDir, outputFilenamePattern, snapshotInd
"""
if not os.path.exists(outputDir):
os.makedirs(outputDir)
- filePathPattern = os.path.join(outputDir,outputFilenamePattern)
+ filePathPattern = os.path.join(outputDir, outputFilenamePattern)
filename = None
while True:
filename = filePathPattern % snapshotIndex
@@ -1497,7 +1497,7 @@ def setUp(self):
for sliceViewNodeId in ['vtkMRMLSliceNodeRed', 'vtkMRMLSliceNodeYellow', 'vtkMRMLSliceNodeGreen']:
slicer.mrmlScene.GetNodeByID(sliceViewNodeId).SetSliceVisible(True)
- self.tempDir= slicer.app.temporaryPath + '/ScreenCaptureTest'
+ self.tempDir = slicer.app.temporaryPath + '/ScreenCaptureTest'
self.numberOfImages = 10
self.imageFileNamePattern = "image_%05d.png"
diff --git a/Modules/Scripted/SegmentEditor/SegmentEditor.py b/Modules/Scripted/SegmentEditor/SegmentEditor.py
index 1d5d140cf1b..64e93128a96 100644
--- a/Modules/Scripted/SegmentEditor/SegmentEditor.py
+++ b/Modules/Scripted/SegmentEditor/SegmentEditor.py
@@ -47,7 +47,7 @@ def setup(self):
ScriptedLoadableModuleWidget.setup(self)
# Add margin to the sides
- self.layout.setContentsMargins(4,0,4,0)
+ self.layout.setContentsMargins(4, 0, 4, 0)
#
# Segment editor widget
diff --git a/Modules/Scripted/SegmentEditor/SubjectHierarchyPlugins/SegmentEditorSubjectHierarchyPlugin.py b/Modules/Scripted/SegmentEditor/SubjectHierarchyPlugins/SegmentEditorSubjectHierarchyPlugin.py
index 74c2e86a0b0..c56b5c70254 100644
--- a/Modules/Scripted/SegmentEditor/SubjectHierarchyPlugins/SegmentEditorSubjectHierarchyPlugin.py
+++ b/Modules/Scripted/SegmentEditor/SubjectHierarchyPlugins/SegmentEditorSubjectHierarchyPlugin.py
@@ -121,8 +121,8 @@ def showContextMenuActionsForItem(self, itemID):
# Volume but not LabelMap
pluginHandlerSingleton = slicer.qSlicerSubjectHierarchyPluginHandler.instance()
- if ( pluginHandlerSingleton.pluginByName('Volumes').canOwnSubjectHierarchyItem(itemID)
- and not pluginHandlerSingleton.pluginByName('LabelMaps').canOwnSubjectHierarchyItem(itemID) ):
+ if (pluginHandlerSingleton.pluginByName('Volumes').canOwnSubjectHierarchyItem(itemID)
+ and not pluginHandlerSingleton.pluginByName('LabelMaps').canOwnSubjectHierarchyItem(itemID)):
# Get current item
currentItemID = pluginHandlerSingleton.currentItem()
if not currentItemID:
diff --git a/Modules/Scripted/SegmentStatistics/SegmentStatistics.py b/Modules/Scripted/SegmentStatistics/SegmentStatistics.py
index b035eb22954..2673b66396f 100644
--- a/Modules/Scripted/SegmentStatistics/SegmentStatistics.py
+++ b/Modules/Scripted/SegmentStatistics/SegmentStatistics.py
@@ -64,7 +64,7 @@ def setup(self):
# Parameter set selector
self.parameterNodeSelector = slicer.qMRMLNodeComboBox()
self.parameterNodeSelector.nodeTypes = ["vtkMRMLScriptedModuleNode"]
- self.parameterNodeSelector.addAttribute( "vtkMRMLScriptedModuleNode", "ModuleName", "SegmentStatistics" )
+ self.parameterNodeSelector.addAttribute("vtkMRMLScriptedModuleNode", "ModuleName", "SegmentStatistics")
self.parameterNodeSelector.selectNodeUponCreation = True
self.parameterNodeSelector.addEnabled = True
self.parameterNodeSelector.renameEnabled = True
@@ -73,8 +73,8 @@ def setup(self):
self.parameterNodeSelector.showHidden = True
self.parameterNodeSelector.showChildNodeTypes = False
self.parameterNodeSelector.baseName = "SegmentStatistics"
- self.parameterNodeSelector.setMRMLScene( slicer.mrmlScene )
- self.parameterNodeSelector.setToolTip( "Pick parameter set" )
+ self.parameterNodeSelector.setMRMLScene(slicer.mrmlScene)
+ self.parameterNodeSelector.setToolTip("Pick parameter set")
self.layout.addWidget(self.parameterNodeSelector)
# Inputs
@@ -89,8 +89,8 @@ def setup(self):
self.segmentationSelector.addEnabled = False
self.segmentationSelector.removeEnabled = True
self.segmentationSelector.renameEnabled = True
- self.segmentationSelector.setMRMLScene( slicer.mrmlScene )
- self.segmentationSelector.setToolTip( "Pick the segmentation to compute statistics for" )
+ self.segmentationSelector.setMRMLScene(slicer.mrmlScene)
+ self.segmentationSelector.setToolTip("Pick the segmentation to compute statistics for")
inputsFormLayout.addRow("Segmentation:", self.segmentationSelector)
# Scalar volume selector
@@ -101,8 +101,8 @@ def setup(self):
self.scalarSelector.renameEnabled = True
self.scalarSelector.noneEnabled = True
self.scalarSelector.showChildNodeTypes = False
- self.scalarSelector.setMRMLScene( slicer.mrmlScene )
- self.scalarSelector.setToolTip( "Select the scalar volume for intensity statistics calculations")
+ self.scalarSelector.setMRMLScene(slicer.mrmlScene)
+ self.scalarSelector.setToolTip("Select the scalar volume for intensity statistics calculations")
inputsFormLayout.addRow("Scalar volume:", self.scalarSelector)
# Output table selector
@@ -134,10 +134,10 @@ def setup(self):
# Edit parameter set button to open SegmentStatisticsParameterEditorDialog
# Note: we add the plugins' option widgets to the module widget instead of using the editor dialog
- #self.editParametersButton = qt.QPushButton("Edit Parameter Set")
- #self.editParametersButton.toolTip = "Editor Statistics Plugin Parameter Set."
- #self.parametersLayout.addRow(self.editParametersButton)
- #self.editParametersButton.connect('clicked()', self.onEditParameters)
+ # self.editParametersButton = qt.QPushButton("Edit Parameter Set")
+ # self.editParametersButton.toolTip = "Editor Statistics Plugin Parameter Set."
+ # self.parametersLayout.addRow(self.editParametersButton)
+ # self.editParametersButton.connect('clicked()', self.onEditParameters)
# add caclulator's option widgets
self.addPluginOptionWidgets()
@@ -214,18 +214,18 @@ def onApply(self):
def onEditParameters(self, pluginName=None):
"""Open dialog box to edit plugin's parameters"""
if self.parameterNodeSelector.currentNode():
- SegmentStatisticsParameterEditorDialog.editParameters(self.parameterNodeSelector.currentNode(),pluginName)
+ SegmentStatisticsParameterEditorDialog.editParameters(self.parameterNodeSelector.currentNode(), pluginName)
def addPluginOptionWidgets(self):
self.pluginEnabledCheckboxes = {}
self.parametersLayout.addRow(qt.QLabel("Enabled segment statistics plugins:"))
for plugin in self.logic.plugins:
- checkbox = qt.QCheckBox(plugin.name+" Statistics")
+ checkbox = qt.QCheckBox(plugin.name + " Statistics")
checkbox.checked = True
checkbox.connect('stateChanged(int)', self.updateParameterNodeFromGui)
optionButton = qt.QPushButton("Options")
from functools import partial
- optionButton.connect('clicked()',partial(self.onEditParameters, plugin.name))
+ optionButton.connect('clicked()', partial(self.onEditParameters, plugin.name))
editWidget = qt.QWidget()
editWidget.setLayout(qt.QHBoxLayout())
editWidget.layout().margin = 0
@@ -235,7 +235,7 @@ def addPluginOptionWidgets(self):
self.pluginEnabledCheckboxes[plugin.name] = checkbox
self.parametersLayout.addRow(editWidget)
# embed widgets for editing plugin' parameters
- #for plugin in self.logic.plugins:
+ # for plugin in self.logic.plugins:
# pluginOptionsCollapsibleButton = ctk.ctkCollapsibleGroupBox()
# pluginOptionsCollapsibleButton.setTitle( plugin.name )
# pluginOptionsFormLayout = qt.QFormLayout(pluginOptionsCollapsibleButton)
@@ -257,10 +257,10 @@ def updateGuiFromParameterNode(self, caller=None, event=None):
return
for plugin in self.logic.plugins:
pluginName = plugin.__class__.__name__
- parameter = pluginName+'.enabled'
+ parameter = pluginName + '.enabled'
checkbox = self.pluginEnabledCheckboxes[plugin.name]
- value = self.parameterNode.GetParameter(parameter)=='True'
- if checkbox.checked!=value:
+ value = self.parameterNode.GetParameter(parameter) == 'True'
+ if checkbox.checked != value:
previousState = checkbox.blockSignals(True)
checkbox.checked = value
checkbox.blockSignals(previousState)
@@ -270,7 +270,7 @@ def updateParameterNodeFromGui(self):
return
for plugin in self.logic.plugins:
pluginName = plugin.__class__.__name__
- parameter = pluginName+'.enabled'
+ parameter = pluginName + '.enabled'
checkbox = self.pluginEnabledCheckboxes[plugin.name]
self.parameterNode.SetParameter(parameter, str(checkbox.checked))
@@ -289,18 +289,18 @@ def editParameters(parameterNode, pluginName=None):
pluginName=pluginName)
return dialog.exec_()
- def __init__(self,parent=None, parameterNode=None, pluginName=None):
- super(qt.QDialog,self).__init__(parent)
+ def __init__(self, parent=None, parameterNode=None, pluginName=None):
+ super(qt.QDialog, self).__init__(parent)
self.title = "Edit Segment Statistics Parameters"
self.parameterNode = parameterNode
self.pluginName = pluginName
- self.logic = SegmentStatisticsLogic() # for access to plugins and editor widgets
+ self.logic = SegmentStatisticsLogic() # for access to plugins and editor widgets
self.logic.setParameterNode(self.parameterNode)
self.setup()
def setParameterNode(self, parameterNode):
"""Set the parameter node the dialog will operate on"""
- if parameterNode==self.parameterNode:
+ if parameterNode == self.parameterNode:
return
self.parameterNode = parameterNode
self.logic.setParameterNode(self.parameterNode)
@@ -308,7 +308,7 @@ def setParameterNode(self, parameterNode):
def setup(self):
self.setLayout(qt.QVBoxLayout())
- self.descriptionLabel = qt.QLabel("Edit segment statistics plugin parameters:",0)
+ self.descriptionLabel = qt.QLabel("Edit segment statistics plugin parameters:", 0)
self.doneButton = qt.QPushButton("Done")
self.doneButton.toolTip = "Finish editing."
@@ -323,10 +323,10 @@ def setup(self):
self._addPluginOptionWidgets()
parametersScrollArea.setWidget(self.parametersWidget)
parametersScrollArea.widgetResizable = True
- parametersScrollArea.setVerticalScrollBarPolicy(qt.Qt.ScrollBarAsNeeded )
+ parametersScrollArea.setVerticalScrollBarPolicy(qt.Qt.ScrollBarAsNeeded)
parametersScrollArea.setHorizontalScrollBarPolicy(qt.Qt.ScrollBarAsNeeded)
- self.layout().addWidget(self.descriptionLabel,0)
+ self.layout().addWidget(self.descriptionLabel, 0)
self.layout().addWidget(parametersScrollArea, 1)
self.layout().addWidget(doneWidget, 0)
self.doneButton.connect('clicked()', lambda: self.done(1))
@@ -334,16 +334,16 @@ def setup(self):
def _addPluginOptionWidgets(self):
description = "Edit segment statistics plugin parameters:"
if self.pluginName:
- description = "Edit "+self.pluginName+" plugin parameters:"
+ description = "Edit " + self.pluginName + " plugin parameters:"
self.descriptionLabel.text = description
if self.pluginName:
for plugin in self.logic.plugins:
- if plugin.name==self.pluginName:
+ if plugin.name == self.pluginName:
self.parametersLayout.addRow(plugin.optionsWidget)
else:
for plugin in self.logic.plugins:
pluginOptionsCollapsibleButton = ctk.ctkCollapsibleGroupBox(self.parametersWidget)
- pluginOptionsCollapsibleButton.setTitle( plugin.name )
+ pluginOptionsCollapsibleButton.setTitle(plugin.name)
pluginOptionsFormLayout = qt.QFormLayout(pluginOptionsCollapsibleButton)
pluginOptionsFormLayout.addRow(plugin.optionsWidget)
self.parametersLayout.addRow(pluginOptionsCollapsibleButton)
@@ -366,7 +366,7 @@ def registerPlugin(plugin):
if not isinstance(plugin, SegmentStatisticsPluginBase):
return
for key in plugin.keys:
- if key.count(".")>0:
+ if key.count(".") > 0:
logging.warning("Plugin keys should not contain extra '.' as it might mix pluginname.measurementkey in "
"the parameter node")
if not plugin.__class__ in SegmentStatisticsLogic.registeredPlugins:
@@ -375,9 +375,9 @@ def registerPlugin(plugin):
logging.warning("SegmentStatisticsLogic.registerPlugin will not register plugin because \
another plugin with the same name has already been registered")
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
ScriptedLoadableModuleLogic.__init__(self, parent)
- self.plugins = [ x() for x in SegmentStatisticsLogic.registeredPlugins]
+ self.plugins = [x() for x in SegmentStatisticsLogic.registeredPlugins]
self.isSingletonParameterNode = False
self.parameterNode = None
@@ -389,12 +389,12 @@ def __init__(self, parent = None):
def getParameterNode(self):
"""Returns the current parameter node and creates one if it doesn't exist yet"""
if not self.parameterNode:
- self.setParameterNode( ScriptedLoadableModuleLogic.getParameterNode(self) )
+ self.setParameterNode(ScriptedLoadableModuleLogic.getParameterNode(self))
return self.parameterNode
def setParameterNode(self, parameterNode):
"""Set the current parameter node and initialize all unset parameters to their default values"""
- if self.parameterNode==parameterNode:
+ if self.parameterNode == parameterNode:
return
self.setDefaultParameters(parameterNode)
self.parameterNode = parameterNode
@@ -411,7 +411,7 @@ def setDefaultParameters(self, parameterNode):
def getStatistics(self):
"""Get the calculated statistical measurements"""
params = self.getParameterNode()
- if not hasattr(params,'statistics'):
+ if not hasattr(params, 'statistics'):
params.statistics = {"SegmentIDs": [], "MeasurementInfo": {}}
return params.statistics
@@ -421,7 +421,7 @@ def reset(self):
for plugin in self.plugins:
self.keys += [plugin.toLongKey(k) for k in plugin.keys]
params = self.getParameterNode()
- params.statistics = {"SegmentIDs":[], "MeasurementInfo": {}}
+ params.statistics = {"SegmentIDs": [], "MeasurementInfo": {}}
def computeStatistics(self):
"""Compute statistical measures for all (visible) segments"""
@@ -442,7 +442,7 @@ def computeStatistics(self):
# Get segment ID list
visibleSegmentIds = vtk.vtkStringArray()
- if self.getParameterNode().GetParameter('visibleSegmentsOnly')=='True':
+ if self.getParameterNode().GetParameter('visibleSegmentsOnly') == 'True':
segmentationNode.GetDisplayNode().GetVisibleSegmentIDs(visibleSegmentIds)
else:
segmentationNode.GetSegmentation().GetSegmentIDs(visibleSegmentIds)
@@ -475,16 +475,16 @@ def updateStatisticsForSegment(self, segmentID):
statistics = self.getStatistics()
if segmentID not in statistics["SegmentIDs"]:
statistics["SegmentIDs"].append(segmentID)
- statistics[segmentID,"Segment"] = segment.GetName()
+ statistics[segmentID, "Segment"] = segment.GetName()
# apply all enabled plugins
for plugin in self.plugins:
pluginName = plugin.__class__.__name__
- if self.getParameterNode().GetParameter(pluginName+'.enabled')=='True':
+ if self.getParameterNode().GetParameter(pluginName + '.enabled') == 'True':
stats = plugin.computeStatistics(segmentID)
for key in stats:
- statistics[segmentID,pluginName+'.'+key] = stats[key]
- statistics["MeasurementInfo"][pluginName+'.'+key] = plugin.getMeasurementInfo(key)
+ statistics[segmentID, pluginName + '.' + key] = stats[key]
+ statistics["MeasurementInfo"][pluginName + '.' + key] = plugin.getMeasurementInfo(key)
def getPluginByKey(self, key):
"""Get plugin responsible for obtaining measurement value for given key"""
@@ -505,7 +505,7 @@ def getStatisticsValueAsString(self, segmentID, key):
if (segmentID, key) in statistics:
value = statistics[segmentID, key]
if isinstance(value, float):
- return "%0.3f" % value # round to 3 decimals
+ return "%0.3f" % value # round to 3 decimals
else:
return str(value)
else:
@@ -522,7 +522,7 @@ def getNonEmptyKeys(self):
break
return nonEmptyKeys
- def getHeaderNames(self, nonEmptyKeysOnly = True):
+ def getHeaderNames(self, nonEmptyKeysOnly=True):
# Derive column header names based on: (a) DICOM information if present,
# (b) measurement info name if present (c) measurement key as fallback.
# Duplicate names get a postfix [1][2]... to make them unique
@@ -549,24 +549,24 @@ def getHeaderNames(self, nonEmptyKeysOnly = True):
if dicomBasedName and 'DICOM.UnitsCode' in info and info['DICOM.UnitsCode']:
entry.SetFromString(info['DICOM.UnitsCode'])
units = entry.GetCodeValue()
- if len(units)>0 and units[0]=='[' and units[-1]==']': units = units[1:-1]
- if len(units)>0: name += ' ['+units+']'
- elif 'units' in info and info['units'] and len(info['units'])>0:
+ if len(units) > 0 and units[0] == '[' and units[-1] == ']': units = units[1:-1]
+ if len(units) > 0: name += ' [' + units + ']'
+ elif 'units' in info and info['units'] and len(info['units']) > 0:
units = info['units']
- name += ' ['+units+']'
+ name += ' [' + units + ']'
headerNames.append(name)
uniqueHeaderNames = list(headerNames)
- for duplicateName in {name for name in uniqueHeaderNames if uniqueHeaderNames.count(name)>1}:
+ for duplicateName in {name for name in uniqueHeaderNames if uniqueHeaderNames.count(name) > 1}:
j = 1
for i in range(len(uniqueHeaderNames)):
- if uniqueHeaderNames[i]==duplicateName:
- uniqueHeaderNames[i] = duplicateName+' ('+str(j)+')'
+ if uniqueHeaderNames[i] == duplicateName:
+ uniqueHeaderNames[i] = duplicateName + ' (' + str(j) + ')'
j += 1
headerNames = {keys[i]: headerNames[i] for i in range(len(keys))}
uniqueHeaderNames = {keys[i]: uniqueHeaderNames[i] for i in range(len(keys))}
return headerNames, uniqueHeaderNames
- def exportToTable(self, table, nonEmptyKeysOnly = True):
+ def exportToTable(self, table, nonEmptyKeysOnly=True):
"""
Export statistics to table node
"""
@@ -582,7 +582,7 @@ def exportToTable(self, table, nonEmptyKeysOnly = True):
# create table column appropriate for data type; currently supported: float, int, long, string
measurements = [statistics[segmentID, key] for segmentID in statistics["SegmentIDs"] if
(segmentID, key) in statistics]
- if len(measurements)==0: # there were not measurements and therefore use the default "string" representation
+ if len(measurements) == 0: # there were not measurements and therefore use the default "string" representation
col = table.AddColumn()
elif isinstance(measurements[0], int):
col = table.AddColumn(vtk.vtkLongArray())
@@ -604,22 +604,22 @@ def exportToTable(self, table, nonEmptyKeysOnly = True):
col = table.AddColumn(array)
else:
col = table.AddColumn()
- else: # default
+ else: # default
col = table.AddColumn()
plugin = self.getPluginByKey(key)
columnName = uniqueColumnHeaderNames[key]
longColumnName = columnHeaderNames[key]
- col.SetName( columnName )
+ col.SetName(columnName)
if plugin:
table.SetColumnProperty(columnName, "Plugin", plugin.name)
- longColumnName += '
Computed by '+plugin.name+' Statistics plugin'
+ longColumnName += '
Computed by ' + plugin.name + ' Statistics plugin'
table.SetColumnLongName(columnName, longColumnName)
measurementInfo = statistics["MeasurementInfo"][key] if key in statistics["MeasurementInfo"] else {}
if measurementInfo:
for mik, miv in measurementInfo.items():
- if mik=='description':
+ if mik == 'description':
table.SetColumnDescription(columnName, str(miv))
- elif mik=='units':
+ elif mik == 'units':
table.SetColumnUnitLabel(columnName, str(miv))
elif mik == 'componentNames':
componentNames = miv
@@ -637,7 +637,7 @@ def exportToTable(self, table, nonEmptyKeysOnly = True):
columnIndex = 0
for key in keys:
value = statistics[segmentID, key] if (segmentID, key) in statistics else None
- if value is None and key!='Segment':
+ if value is None and key != 'Segment':
value = float('nan')
if isinstance(value, list):
for i in range(len(value)):
@@ -659,7 +659,7 @@ def showTable(self, table):
slicer.app.applicationLogic().GetSelectionNode().SetActiveTableID(table.GetID())
slicer.app.applicationLogic().PropagateTableSelection()
- def exportToString(self, nonEmptyKeysOnly = True):
+ def exportToString(self, nonEmptyKeysOnly=True):
"""
Returns string with comma separated values, with header keys in quotes.
"""
@@ -669,15 +669,15 @@ def exportToString(self, nonEmptyKeysOnly = True):
# Rows
statistics = self.getStatistics()
for segmentID in statistics["SegmentIDs"]:
- csv += "\n" + str(statistics[segmentID,keys[0]])
+ csv += "\n" + str(statistics[segmentID, keys[0]])
for key in keys[1:]:
if (segmentID, key) in statistics:
- csv += "," + str(statistics[segmentID,key])
+ csv += "," + str(statistics[segmentID, key])
else:
csv += ","
return csv
- def exportToCSVFile(self, fileName, nonEmptyKeysOnly = True):
+ def exportToCSVFile(self, fileName, nonEmptyKeysOnly=True):
fp = open(fileName, "w")
fp.write(self.exportToString(nonEmptyKeysOnly))
fp.close()
@@ -695,7 +695,7 @@ def setUp(self):
"""
slicer.mrmlScene.Clear(0)
- def runTest(self,scenario=None):
+ def runTest(self, scenario=None):
"""Run as few or as many tests as needed here.
"""
self.setUp()
@@ -725,7 +725,7 @@ def test_SegmentStatisticsBasic(self):
segmentationNode.SetReferenceImageGeometryParameterFromVolumeNode(masterVolumeNode)
# Geometry for each segment is defined by: radius, posX, posY, posZ
- segmentGeometries = [[10, -6,30,28], [20, 0,65,32], [15, 1, -14, 30], [12, 0, 28, -7], [5, 0,30,64],
+ segmentGeometries = [[10, -6, 30, 28], [20, 0, 65, 32], [15, 1, -14, 30], [12, 0, 28, -7], [5, 0, 30, 64],
[12, 31, 33, 27], [17, -42, 30, 27]]
for segmentGeometry in segmentGeometries:
sphereSource = vtk.vtkSphereSource()
@@ -743,8 +743,8 @@ def test_SegmentStatisticsBasic(self):
segStatLogic.computeStatistics()
self.delayDisplay("Check a few numerical results")
- self.assertEqual( segStatLogic.getStatistics()["Test_2","LabelmapSegmentStatisticsPlugin.voxel_count"], 9807)
- self.assertEqual( segStatLogic.getStatistics()["Test_4","ScalarVolumeSegmentStatisticsPlugin.voxel_count"], 380)
+ self.assertEqual(segStatLogic.getStatistics()["Test_2", "LabelmapSegmentStatisticsPlugin.voxel_count"], 9807)
+ self.assertEqual(segStatLogic.getStatistics()["Test_4", "ScalarVolumeSegmentStatisticsPlugin.voxel_count"], 380)
self.delayDisplay("Export results to table")
resultsTableNode = slicer.vtkMRMLTableNode()
@@ -756,7 +756,7 @@ def test_SegmentStatisticsBasic(self):
logging.info(segStatLogic.exportToString())
outputFilename = slicer.app.temporaryPath + '/SegmentStatisticsTestOutput.csv'
- self.delayDisplay("Export results to CSV file: "+outputFilename)
+ self.delayDisplay("Export results to CSV file: " + outputFilename)
segStatLogic.exportToCSVFile(outputFilename)
self.delayDisplay('test_SegmentStatisticsBasic passed!')
@@ -783,7 +783,7 @@ def test_SegmentStatisticsPlugins(self):
segmentationNode.SetReferenceImageGeometryParameterFromVolumeNode(masterVolumeNode)
# Geometry for each segment is defined by: radius, posX, posY, posZ
- segmentGeometries = [[10, -6,30,28], [20, 0,65,32], [15, 1, -14, 30], [12, 0, 28, -7], [5, 0,30,64],
+ segmentGeometries = [[10, -6, 30, 28], [20, 0, 65, 32], [15, 1, -14, 30], [12, 0, 28, -7], [5, 0, 30, 64],
[12, 31, 33, 27], [17, -42, 30, 27]]
for segmentGeometry in segmentGeometries:
sphereSource = vtk.vtkSphereSource()
@@ -804,31 +804,31 @@ def test_SegmentStatisticsPlugins(self):
slicer.mrmlScene.AddNode(resultsTableNode)
segStatLogic.exportToTable(resultsTableNode)
segStatLogic.showTable(resultsTableNode)
- self.assertEqual( segStatLogic.getStatistics()["Test_2","LabelmapSegmentStatisticsPlugin.voxel_count"], 9807)
- with self.assertRaises(KeyError): segStatLogic.getStatistics()["Test_4","ScalarVolumeSegmentStatisticsPlugin.voxel count"]
+ self.assertEqual(segStatLogic.getStatistics()["Test_2", "LabelmapSegmentStatisticsPlugin.voxel_count"], 9807)
+ with self.assertRaises(KeyError): segStatLogic.getStatistics()["Test_4", "ScalarVolumeSegmentStatisticsPlugin.voxel count"]
# assert there are no result for this segment
segStatLogic.updateStatisticsForSegment('Test_4')
segStatLogic.exportToTable(resultsTableNode)
segStatLogic.showTable(resultsTableNode)
- self.assertEqual( segStatLogic.getStatistics()["Test_2","LabelmapSegmentStatisticsPlugin.voxel_count"], 9807)
- self.assertEqual( segStatLogic.getStatistics()["Test_4","LabelmapSegmentStatisticsPlugin.voxel_count"], 380)
- with self.assertRaises(KeyError): segStatLogic.getStatistics()["Test_5","ScalarVolumeSegmentStatisticsPlugin.voxel count"]
+ self.assertEqual(segStatLogic.getStatistics()["Test_2", "LabelmapSegmentStatisticsPlugin.voxel_count"], 9807)
+ self.assertEqual(segStatLogic.getStatistics()["Test_4", "LabelmapSegmentStatisticsPlugin.voxel_count"], 380)
+ with self.assertRaises(KeyError): segStatLogic.getStatistics()["Test_5", "ScalarVolumeSegmentStatisticsPlugin.voxel count"]
# assert there are no result for this segment
# calculate measurements for all segments
segStatLogic.computeStatistics()
- self.assertEqual( segStatLogic.getStatistics()["Test","LabelmapSegmentStatisticsPlugin.voxel_count"], 2948)
- self.assertEqual( segStatLogic.getStatistics()["Test_1","LabelmapSegmentStatisticsPlugin.voxel_count"], 23281)
+ self.assertEqual(segStatLogic.getStatistics()["Test", "LabelmapSegmentStatisticsPlugin.voxel_count"], 2948)
+ self.assertEqual(segStatLogic.getStatistics()["Test_1", "LabelmapSegmentStatisticsPlugin.voxel_count"], 23281)
# test updating measurements for segments one by one
self.delayDisplay("Update some segments in the segmentation")
- segmentGeometriesNew = [[5, -6,30,28], [21, 0,65,32]]
+ segmentGeometriesNew = [[5, -6, 30, 28], [21, 0, 65, 32]]
# We add/remove representations, so we temporarily block segment modifications
# to make sure display managers don't try to access data while it is in an
# inconsistent state.
wasModified = segmentationNode.StartModify()
for i in range(len(segmentGeometriesNew)):
- segmentGeometry = segmentGeometriesNew[i]
+ segmentGeometry = segmentGeometriesNew[i]
sphereSource = vtk.vtkSphereSource()
sphereSource.SetRadius(segmentGeometry[0])
sphereSource.SetCenter(segmentGeometry[1], segmentGeometry[2], segmentGeometry[3])
@@ -839,22 +839,22 @@ def test_SegmentStatisticsPlugins(self):
segment.AddRepresentation(closedSurfaceName,
sphereSource.GetOutput())
segmentationNode.EndModify(wasModified)
- self.assertEqual( segStatLogic.getStatistics()["Test","LabelmapSegmentStatisticsPlugin.voxel_count"], 2948)
- self.assertEqual( segStatLogic.getStatistics()["Test_1","LabelmapSegmentStatisticsPlugin.voxel_count"], 23281)
+ self.assertEqual(segStatLogic.getStatistics()["Test", "LabelmapSegmentStatisticsPlugin.voxel_count"], 2948)
+ self.assertEqual(segStatLogic.getStatistics()["Test_1", "LabelmapSegmentStatisticsPlugin.voxel_count"], 23281)
segStatLogic.updateStatisticsForSegment('Test_1')
- self.assertEqual( segStatLogic.getStatistics()["Test","LabelmapSegmentStatisticsPlugin.voxel_count"], 2948)
- self.assertTrue( segStatLogic.getStatistics()["Test_1","LabelmapSegmentStatisticsPlugin.voxel_count"]!=23281)
+ self.assertEqual(segStatLogic.getStatistics()["Test", "LabelmapSegmentStatisticsPlugin.voxel_count"], 2948)
+ self.assertTrue(segStatLogic.getStatistics()["Test_1", "LabelmapSegmentStatisticsPlugin.voxel_count"] != 23281)
segStatLogic.updateStatisticsForSegment('Test')
- self.assertTrue( segStatLogic.getStatistics()["Test","LabelmapSegmentStatisticsPlugin.voxel_count"]!=2948)
- self.assertTrue( segStatLogic.getStatistics()["Test_1","LabelmapSegmentStatisticsPlugin.voxel_count"]!=23281)
+ self.assertTrue(segStatLogic.getStatistics()["Test", "LabelmapSegmentStatisticsPlugin.voxel_count"] != 2948)
+ self.assertTrue(segStatLogic.getStatistics()["Test_1", "LabelmapSegmentStatisticsPlugin.voxel_count"] != 23281)
# test enabling/disabling of individual measurements
self.delayDisplay("Test disabling of individual measurements")
segStatLogic = SegmentStatisticsLogic()
segStatLogic.getParameterNode().SetParameter("Segmentation", segmentationNode.GetID())
segStatLogic.getParameterNode().SetParameter("ScalarVolume", masterVolumeNode.GetID())
- segStatLogic.getParameterNode().SetParameter("LabelmapSegmentStatisticsPlugin.voxel_count.enabled",str(False))
- segStatLogic.getParameterNode().SetParameter("LabelmapSegmentStatisticsPlugin.volume_cm3.enabled",str(False))
+ segStatLogic.getParameterNode().SetParameter("LabelmapSegmentStatisticsPlugin.voxel_count.enabled", str(False))
+ segStatLogic.getParameterNode().SetParameter("LabelmapSegmentStatisticsPlugin.volume_cm3.enabled", str(False))
segStatLogic.computeStatistics()
segStatLogic.exportToTable(resultsTableNode)
segStatLogic.showTable(resultsTableNode)
@@ -864,8 +864,8 @@ def test_SegmentStatisticsPlugins(self):
self.assertFalse('Volume [cm3] (3)' in columnHeaders)
self.delayDisplay("Test re-enabling of individual measurements")
- segStatLogic.getParameterNode().SetParameter("LabelmapSegmentStatisticsPlugin.voxel_count.enabled",str(True))
- segStatLogic.getParameterNode().SetParameter("LabelmapSegmentStatisticsPlugin.volume_cm3.enabled",str(True))
+ segStatLogic.getParameterNode().SetParameter("LabelmapSegmentStatisticsPlugin.voxel_count.enabled", str(True))
+ segStatLogic.getParameterNode().SetParameter("LabelmapSegmentStatisticsPlugin.volume_cm3.enabled", str(True))
segStatLogic.computeStatistics()
segStatLogic.exportToTable(resultsTableNode)
segStatLogic.showTable(resultsTableNode)
@@ -876,7 +876,7 @@ def test_SegmentStatisticsPlugins(self):
# test enabling/disabling of individual plugins
self.delayDisplay("Test disabling of plugin")
- segStatLogic.getParameterNode().SetParameter("LabelmapSegmentStatisticsPlugin.enabled",str(False))
+ segStatLogic.getParameterNode().SetParameter("LabelmapSegmentStatisticsPlugin.enabled", str(False))
segStatLogic.computeStatistics()
segStatLogic.exportToTable(resultsTableNode)
segStatLogic.showTable(resultsTableNode)
@@ -886,7 +886,7 @@ def test_SegmentStatisticsPlugins(self):
self.assertTrue('Volume [mm3] (2)' in columnHeaders)
self.delayDisplay("Test re-enabling of plugin")
- segStatLogic.getParameterNode().SetParameter("LabelmapSegmentStatisticsPlugin.enabled",str(True))
+ segStatLogic.getParameterNode().SetParameter("LabelmapSegmentStatisticsPlugin.enabled", str(True))
segStatLogic.computeStatistics()
segStatLogic.exportToTable(resultsTableNode)
segStatLogic.showTable(resultsTableNode)
@@ -896,7 +896,7 @@ def test_SegmentStatisticsPlugins(self):
# test unregistering/registering of plugins
self.delayDisplay("Test of removing all registered plugins")
- SegmentStatisticsLogic.registeredPlugins = [] # remove all registered plugins
+ SegmentStatisticsLogic.registeredPlugins = [] # remove all registered plugins
segStatLogic = SegmentStatisticsLogic()
segStatLogic.getParameterNode().SetParameter("Segmentation", segmentationNode.GetID())
segStatLogic.getParameterNode().SetParameter("ScalarVolume", masterVolumeNode.GetID())
@@ -904,8 +904,8 @@ def test_SegmentStatisticsPlugins(self):
segStatLogic.exportToTable(resultsTableNode)
segStatLogic.showTable(resultsTableNode)
columnHeaders = [resultsTableNode.GetColumnName(i) for i in range(resultsTableNode.GetNumberOfColumns())]
- self.assertEqual(len(columnHeaders),1) # only header element should be "Segment"
- self.assertEqual(columnHeaders[0],"Segment") # only header element should be "Segment"
+ self.assertEqual(len(columnHeaders), 1) # only header element should be "Segment"
+ self.assertEqual(columnHeaders[0], "Segment") # only header element should be "Segment"
self.delayDisplay("Test registering plugins")
SegmentStatisticsLogic.registerPlugin(LabelmapSegmentStatisticsPlugin())
@@ -935,18 +935,18 @@ class Slicelet:
def __init__(self, widgetClass=None):
self.parent = qt.QFrame()
- self.parent.setLayout( qt.QVBoxLayout() )
+ self.parent.setLayout(qt.QVBoxLayout())
# TODO: should have way to pop up python interactor
self.buttons = qt.QFrame()
- self.buttons.setLayout( qt.QHBoxLayout() )
+ self.buttons.setLayout(qt.QHBoxLayout())
self.parent.layout().addWidget(self.buttons)
self.addDataButton = qt.QPushButton("Add Data")
self.buttons.layout().addWidget(self.addDataButton)
- self.addDataButton.connect("clicked()",slicer.app.ioManager().openAddDataDialog)
+ self.addDataButton.connect("clicked()", slicer.app.ioManager().openAddDataDialog)
self.loadSceneButton = qt.QPushButton("Load Scene")
self.buttons.layout().addWidget(self.loadSceneButton)
- self.loadSceneButton.connect("clicked()",slicer.app.ioManager().openLoadSceneDialog)
+ self.loadSceneButton.connect("clicked()", slicer.app.ioManager().openLoadSceneDialog)
if widgetClass:
self.widget = widgetClass(self.parent)
@@ -967,6 +967,6 @@ def __init__(self):
# TODO: ideally command line args should handle --xml
import sys
- print( sys.argv )
+ print(sys.argv)
slicelet = SegmentStatisticsSlicelet()
diff --git a/Modules/Scripted/SegmentStatistics/SegmentStatisticsPlugins/ClosedSurfaceSegmentStatisticsPlugin.py b/Modules/Scripted/SegmentStatistics/SegmentStatisticsPlugins/ClosedSurfaceSegmentStatisticsPlugin.py
index 4c015053789..454603c6dbd 100644
--- a/Modules/Scripted/SegmentStatistics/SegmentStatisticsPlugins/ClosedSurfaceSegmentStatisticsPlugin.py
+++ b/Modules/Scripted/SegmentStatistics/SegmentStatisticsPlugins/ClosedSurfaceSegmentStatisticsPlugin.py
@@ -10,8 +10,8 @@ def __init__(self):
super().__init__()
self.name = "Closed Surface"
self.keys = ["surface_mm2", "volume_mm3", "volume_cm3"]
- self.defaultKeys = self.keys # calculate all measurements by default
- #... developer may add extra options to configure other parameters
+ self.defaultKeys = self.keys # calculate all measurements by default
+ # ... developer may add extra options to configure other parameters
def computeStatistics(self, segmentID):
import vtkSegmentationCorePython as vtkSegmentationCore
@@ -19,7 +19,7 @@ def computeStatistics(self, segmentID):
segmentationNode = slicer.mrmlScene.GetNodeByID(self.getParameterNode().GetParameter("Segmentation"))
- if len(requestedKeys)==0:
+ if len(requestedKeys) == 0:
return {}
containsClosedSurfaceRepresentation = segmentationNode.GetSegmentation().ContainsRepresentation(
diff --git a/Modules/Scripted/SegmentStatistics/SegmentStatisticsPlugins/LabelmapSegmentStatisticsPlugin.py b/Modules/Scripted/SegmentStatistics/SegmentStatisticsPlugins/LabelmapSegmentStatisticsPlugin.py
index 2d1c1eaf5f9..f4041ac581d 100644
--- a/Modules/Scripted/SegmentStatistics/SegmentStatisticsPlugins/LabelmapSegmentStatisticsPlugin.py
+++ b/Modules/Scripted/SegmentStatistics/SegmentStatisticsPlugins/LabelmapSegmentStatisticsPlugin.py
@@ -19,28 +19,28 @@ def __init__(self):
"principal_moments",
] + self.principalAxisKeys + self.obbKeys
- self.defaultKeys = ["voxel_count", "volume_mm3", "volume_cm3"] # Don't calculate label shape statistics by default since they take longer to compute
+ self.defaultKeys = ["voxel_count", "volume_mm3", "volume_cm3"] # Don't calculate label shape statistics by default since they take longer to compute
self.keys = self.defaultKeys + self.shapeKeys
self.keyToShapeStatisticNames = {
- "centroid_ras" : vtkITK.vtkITKLabelShapeStatistics.GetShapeStatisticAsString(vtkITK.vtkITKLabelShapeStatistics.Centroid),
+ "centroid_ras": vtkITK.vtkITKLabelShapeStatistics.GetShapeStatisticAsString(vtkITK.vtkITKLabelShapeStatistics.Centroid),
"feret_diameter_mm": vtkITK.vtkITKLabelShapeStatistics.GetShapeStatisticAsString(vtkITK.vtkITKLabelShapeStatistics.FeretDiameter),
- "surface_area_mm2" : vtkITK.vtkITKLabelShapeStatistics.GetShapeStatisticAsString(vtkITK.vtkITKLabelShapeStatistics.Perimeter),
- "roundness" : vtkITK.vtkITKLabelShapeStatistics.GetShapeStatisticAsString(vtkITK.vtkITKLabelShapeStatistics.Roundness),
- "flatness" : vtkITK.vtkITKLabelShapeStatistics.GetShapeStatisticAsString(vtkITK.vtkITKLabelShapeStatistics.Flatness),
- "elongation" : vtkITK.vtkITKLabelShapeStatistics.GetShapeStatisticAsString(vtkITK.vtkITKLabelShapeStatistics.Elongation),
- "oriented_bounding_box" : vtkITK.vtkITKLabelShapeStatistics.GetShapeStatisticAsString(vtkITK.vtkITKLabelShapeStatistics.OrientedBoundingBox),
- "obb_origin_ras" : "OrientedBoundingBoxOrigin",
- "obb_diameter_mm" : "OrientedBoundingBoxSize",
- "obb_direction_ras_x" : "OrientedBoundingBoxDirectionX",
- "obb_direction_ras_y" : "OrientedBoundingBoxDirectionY",
- "obb_direction_ras_z" : "OrientedBoundingBoxDirectionZ",
- "principal_moments" : vtkITK.vtkITKLabelShapeStatistics.GetShapeStatisticAsString(vtkITK.vtkITKLabelShapeStatistics.PrincipalMoments),
- "principal_axes" : vtkITK.vtkITKLabelShapeStatistics.GetShapeStatisticAsString(vtkITK.vtkITKLabelShapeStatistics.PrincipalAxes),
- "principal_axis_x" : "PrincipalAxisX",
- "principal_axis_y" : "PrincipalAxisY",
- "principal_axis_z" : "PrincipalAxisZ",
+ "surface_area_mm2": vtkITK.vtkITKLabelShapeStatistics.GetShapeStatisticAsString(vtkITK.vtkITKLabelShapeStatistics.Perimeter),
+ "roundness": vtkITK.vtkITKLabelShapeStatistics.GetShapeStatisticAsString(vtkITK.vtkITKLabelShapeStatistics.Roundness),
+ "flatness": vtkITK.vtkITKLabelShapeStatistics.GetShapeStatisticAsString(vtkITK.vtkITKLabelShapeStatistics.Flatness),
+ "elongation": vtkITK.vtkITKLabelShapeStatistics.GetShapeStatisticAsString(vtkITK.vtkITKLabelShapeStatistics.Elongation),
+ "oriented_bounding_box": vtkITK.vtkITKLabelShapeStatistics.GetShapeStatisticAsString(vtkITK.vtkITKLabelShapeStatistics.OrientedBoundingBox),
+ "obb_origin_ras": "OrientedBoundingBoxOrigin",
+ "obb_diameter_mm": "OrientedBoundingBoxSize",
+ "obb_direction_ras_x": "OrientedBoundingBoxDirectionX",
+ "obb_direction_ras_y": "OrientedBoundingBoxDirectionY",
+ "obb_direction_ras_z": "OrientedBoundingBoxDirectionZ",
+ "principal_moments": vtkITK.vtkITKLabelShapeStatistics.GetShapeStatisticAsString(vtkITK.vtkITKLabelShapeStatistics.PrincipalMoments),
+ "principal_axes": vtkITK.vtkITKLabelShapeStatistics.GetShapeStatisticAsString(vtkITK.vtkITKLabelShapeStatistics.PrincipalAxes),
+ "principal_axis_x": "PrincipalAxisX",
+ "principal_axis_y": "PrincipalAxisY",
+ "principal_axis_z": "PrincipalAxisZ",
}
- #... developer may add extra options to configure other parameters
+ # ... developer may add extra options to configure other parameters
def computeStatistics(self, segmentID):
import vtkSegmentationCorePython as vtkSegmentationCore
@@ -48,7 +48,7 @@ def computeStatistics(self, segmentID):
segmentationNode = slicer.mrmlScene.GetNodeByID(self.getParameterNode().GetParameter("Segmentation"))
- if len(requestedKeys)==0:
+ if len(requestedKeys) == 0:
return {}
containsLabelmapRepresentation = segmentationNode.GetSegmentation().ContainsRepresentation(
@@ -87,7 +87,7 @@ def computeStatistics(self, segmentID):
stat.Update()
# Add data to statistics list
- cubicMMPerVoxel = reduce(lambda x,y: x*y, segmentLabelmap.GetSpacing())
+ cubicMMPerVoxel = reduce(lambda x, y: x * y, segmentLabelmap.GetSpacing())
ccPerCubicMM = 0.001
stats = {}
if "voxel_count" in requestedKeys:
@@ -167,7 +167,7 @@ def computeStatistics(self, segmentID):
statTable = shapeStat.GetOutput()
if "centroid_ras" in requestedKeys:
- centroidRAS = [0,0,0]
+ centroidRAS = [0, 0, 0]
centroidTuple = None
centroidArray = statTable.GetColumnByName(self.keyToShapeStatisticNames["centroid_ras"])
if centroidArray is None:
@@ -235,7 +235,7 @@ def computeStatistics(self, segmentID):
if "obb_origin_ras" in requestedKeys:
obbOriginTuple = None
- obbOriginRAS = [0,0,0]
+ obbOriginRAS = [0, 0, 0]
obbOriginArray = statTable.GetColumnByName(self.keyToShapeStatisticNames["obb_origin_ras"])
if obbOriginArray is None:
logging.error("Could not calculate obb_origin_ras!")
diff --git a/Modules/Scripted/SegmentStatistics/SegmentStatisticsPlugins/ScalarVolumeSegmentStatisticsPlugin.py b/Modules/Scripted/SegmentStatistics/SegmentStatisticsPlugins/ScalarVolumeSegmentStatisticsPlugin.py
index 7f3beb142b7..0fbb193ea7f 100644
--- a/Modules/Scripted/SegmentStatistics/SegmentStatisticsPlugins/ScalarVolumeSegmentStatisticsPlugin.py
+++ b/Modules/Scripted/SegmentStatistics/SegmentStatisticsPlugins/ScalarVolumeSegmentStatisticsPlugin.py
@@ -10,8 +10,8 @@ def __init__(self):
super().__init__()
self.name = "Scalar Volume"
self.keys = ["voxel_count", "volume_mm3", "volume_cm3", "min", "max", "mean", "median", "stdev"]
- self.defaultKeys = self.keys # calculate all measurements by default
- #... developer may add extra options to configure other parameters
+ self.defaultKeys = self.keys # calculate all measurements by default
+ # ... developer may add extra options to configure other parameters
def computeStatistics(self, segmentID):
requestedKeys = self.getRequestedKeys()
@@ -19,14 +19,14 @@ def computeStatistics(self, segmentID):
segmentationNode = slicer.mrmlScene.GetNodeByID(self.getParameterNode().GetParameter("Segmentation"))
grayscaleNode = slicer.mrmlScene.GetNodeByID(self.getParameterNode().GetParameter("ScalarVolume"))
- if len(requestedKeys)==0:
+ if len(requestedKeys) == 0:
return {}
stencil = self.getStencilForVolume(segmentationNode, segmentID, grayscaleNode)
if not stencil:
return {}
- cubicMMPerVoxel = reduce(lambda x,y: x*y, grayscaleNode.GetSpacing())
+ cubicMMPerVoxel = reduce(lambda x, y: x * y, grayscaleNode.GetSpacing())
ccPerCubicMM = 0.001
stat = vtk.vtkImageAccumulate()
@@ -47,7 +47,7 @@ def computeStatistics(self, segmentID):
stats["volume_mm3"] = stat.GetVoxelCount() * cubicMMPerVoxel
if "volume_cm3" in requestedKeys:
stats["volume_cm3"] = stat.GetVoxelCount() * cubicMMPerVoxel * ccPerCubicMM
- if stat.GetVoxelCount()>0:
+ if stat.GetVoxelCount() > 0:
if "min" in requestedKeys:
stats["min"] = stat.GetMin()[0]
if "max" in requestedKeys:
@@ -99,8 +99,8 @@ def getStencilForVolume(self, segmentationNode, segmentID, grayscaleNode):
segmentLabelmap_Reference = vtkSegmentationCore.vtkOrientedImageData()
vtkSegmentationCore.vtkOrientedImageDataResample.ResampleOrientedImageToReferenceOrientedImage(
segmentLabelmap, referenceGeometry_Reference, segmentLabelmap_Reference,
- False, # nearest neighbor interpolation
- False, # no padding
+ False, # nearest neighbor interpolation
+ False, # no padding
segmentationToReferenceGeometryTransform)
# We need to know exactly the value of the segment voxels, apply threshold to make force the selected label value
@@ -155,7 +155,7 @@ def getMeasurementInfo(self, key):
info["volume_cm3"] = \
self.createMeasurementInfo(name="Volume cm3", description="Volume in cm3", units="cm3",
quantityDicomCode=self.createCodedEntry("118565006", "SCT", "Volume", True),
- unitsDicomCode=self.createCodedEntry("cm3","UCUM","cubic centimeter", True),
+ unitsDicomCode=self.createCodedEntry("cm3", "UCUM", "cubic centimeter", True),
measurementMethodDicomCode=self.createCodedEntry("126030", "DCM",
"Sum of segmented voxel volumes", True))
@@ -171,27 +171,27 @@ def getMeasurementInfo(self, key):
units=scalarVolumeUnits.GetCodeMeaning(),
quantityDicomCode=scalarVolumeQuantity.GetAsString(),
unitsDicomCode=scalarVolumeUnits.GetAsString(),
- derivationDicomCode=self.createCodedEntry("56851009","SCT","Maximum", True))
+ derivationDicomCode=self.createCodedEntry("56851009", "SCT", "Maximum", True))
info["mean"] = \
self.createMeasurementInfo(name="Mean", description="Mean scalar value",
units=scalarVolumeUnits.GetCodeMeaning(),
quantityDicomCode=scalarVolumeQuantity.GetAsString(),
unitsDicomCode=scalarVolumeUnits.GetAsString(),
- derivationDicomCode=self.createCodedEntry("373098007","SCT","Mean", True))
+ derivationDicomCode=self.createCodedEntry("373098007", "SCT", "Mean", True))
info["median"] = \
self.createMeasurementInfo(name="Median", description="Median scalar value",
units=scalarVolumeUnits.GetCodeMeaning(),
quantityDicomCode=scalarVolumeQuantity.GetAsString(),
unitsDicomCode=scalarVolumeUnits.GetAsString(),
- derivationDicomCode=self.createCodedEntry("median","SCT","Median", True))
+ derivationDicomCode=self.createCodedEntry("median", "SCT", "Median", True))
info["stdev"] = \
self.createMeasurementInfo(name="Standard deviation", description="Standard deviation of scalar values",
units=scalarVolumeUnits.GetCodeMeaning(),
quantityDicomCode=scalarVolumeQuantity.GetAsString(),
unitsDicomCode=scalarVolumeUnits.GetAsString(),
- derivationDicomCode=self.createCodedEntry('386136009','SCT','Standard Deviation', True))
+ derivationDicomCode=self.createCodedEntry('386136009', 'SCT', 'Standard Deviation', True))
return info[key] if key in info else None
diff --git a/Modules/Scripted/SegmentStatistics/SegmentStatisticsPlugins/SegmentStatisticsPluginBase.py b/Modules/Scripted/SegmentStatistics/SegmentStatisticsPlugins/SegmentStatisticsPluginBase.py
index 7be81e1a58e..0f3a2b4c777 100644
--- a/Modules/Scripted/SegmentStatistics/SegmentStatisticsPlugins/SegmentStatisticsPluginBase.py
+++ b/Modules/Scripted/SegmentStatistics/SegmentStatisticsPlugins/SegmentStatisticsPluginBase.py
@@ -71,33 +71,33 @@ def getMeasurementInfo(self, key):
def setDefaultParameters(self, parameterNode, overwriteExisting=False):
# enable plugin
pluginName = self.__class__.__name__
- parameter = pluginName+'.enabled'
+ parameter = pluginName + '.enabled'
if not parameterNode.GetParameter(parameter):
parameterNode.SetParameter(parameter, str(True))
# enable all default keys
for key in self.keys:
- parameter = self.toLongKey(key)+'.enabled'
+ parameter = self.toLongKey(key) + '.enabled'
if not parameterNode.GetParameter(parameter) or overwriteExisting:
parameterNode.SetParameter(parameter, str(key in self.defaultKeys))
def getRequestedKeys(self):
if not self.parameterNode:
return ()
- requestedKeys = [key for key in self.keys if self.parameterNode.GetParameter(self.toLongKey(key)+'.enabled')=='True']
+ requestedKeys = [key for key in self.keys if self.parameterNode.GetParameter(self.toLongKey(key) + '.enabled') == 'True']
return requestedKeys
def toLongKey(self, key):
# add name of plugin as a prefix for use outside of plugin
pluginName = self.__class__.__name__
- return pluginName+'.'+key
+ return pluginName + '.' + key
def toShortKey(self, key):
# remove prefix used outside of plugin
pluginName = self.__class__.__name__
- return key[len(pluginName)+1:] if key.startswith(pluginName+'.') else ''
+ return key[len(pluginName) + 1:] if key.startswith(pluginName + '.') else ''
def setParameterNode(self, parameterNode):
- if self.parameterNode==parameterNode:
+ if self.parameterNode == parameterNode:
return
if self.parameterNode and self.parameterNodeObserver:
self.parameterNode.RemoveObserver(self.parameterNodeObserver)
@@ -118,7 +118,7 @@ def createDefaultOptionsWidget(self):
form = qt.QFormLayout(self.optionsWidget)
# checkbox to enable/disable plugin
- self.pluginCheckbox = qt.QCheckBox(self.name+" plugin enabled")
+ self.pluginCheckbox = qt.QCheckBox(self.name + " plugin enabled")
self.pluginCheckbox.checked = True
self.pluginCheckbox.connect('stateChanged(int)', self.updateParameterNodeFromGui)
form.addRow(self.pluginCheckbox)
@@ -128,14 +128,14 @@ def createDefaultOptionsWidget(self):
selectAllNoneFrame.setLayout(qt.QHBoxLayout())
selectAllNoneFrame.layout().setSpacing(0)
selectAllNoneFrame.layout().setMargin(0)
- selectAllNoneFrame.layout().addWidget(qt.QLabel("Select measurements: ",self.optionsWidget))
- selectAllButton = qt.QPushButton('all',self.optionsWidget)
+ selectAllNoneFrame.layout().addWidget(qt.QLabel("Select measurements: ", self.optionsWidget))
+ selectAllButton = qt.QPushButton('all', self.optionsWidget)
selectAllNoneFrame.layout().addWidget(selectAllButton)
selectAllButton.connect('clicked()', self.requestAll)
- selectNoneButton = qt.QPushButton('none',self.optionsWidget)
+ selectNoneButton = qt.QPushButton('none', self.optionsWidget)
selectAllNoneFrame.layout().addWidget(selectNoneButton)
selectNoneButton.connect('clicked()', self.requestNone)
- selectDefaultButton = qt.QPushButton('default',self.optionsWidget)
+ selectDefaultButton = qt.QPushButton('default', self.optionsWidget)
selectAllNoneFrame.layout().addWidget(selectDefaultButton)
selectDefaultButton.connect('clicked()', self.requestDefault)
form.addRow(selectAllNoneFrame)
@@ -145,14 +145,14 @@ def createDefaultOptionsWidget(self):
requestedKeys = self.getRequestedKeys()
for key in self.keys:
label = key
- tooltip = "key: "+key
+ tooltip = "key: " + key
info = self.getMeasurementInfo(key)
if info and ("name" in info or "description" in info):
label = info["name"] if "name" in info else info["description"]
if "name" in info: tooltip += "\nname: " + str(info["name"])
if "description" in info: tooltip += "\ndescription: " + str(info["description"])
if "units" in info: tooltip += "\nunits: " + (str(info["units"]) if info["units"] else "n/a")
- checkbox = qt.QCheckBox(label,self.optionsWidget)
+ checkbox = qt.QCheckBox(label, self.optionsWidget)
checkbox.checked = key in requestedKeys
checkbox.setToolTip(tooltip)
form.addRow(checkbox)
@@ -163,16 +163,16 @@ def updateGuiFromParameterNode(self, caller=None, event=None):
if not self.parameterNode:
return
pluginName = self.__class__.__name__
- isEnabled = self.parameterNode.GetParameter(pluginName+'.enabled')!='False'
+ isEnabled = self.parameterNode.GetParameter(pluginName + '.enabled') != 'False'
self.pluginCheckbox.checked = isEnabled
for (key, checkbox) in self.requestedKeysCheckboxes.items():
- parameter = self.toLongKey(key)+'.enabled'
- value = self.parameterNode.GetParameter(parameter)=='True'
- if checkbox.checked!=value:
+ parameter = self.toLongKey(key) + '.enabled'
+ value = self.parameterNode.GetParameter(parameter) == 'True'
+ if checkbox.checked != value:
previousState = checkbox.blockSignals(True)
checkbox.checked = value
checkbox.blockSignals(previousState)
- if checkbox.enabled!=isEnabled:
+ if checkbox.enabled != isEnabled:
previousState = checkbox.blockSignals(True)
checkbox.enabled = isEnabled
checkbox.blockSignals(previousState)
@@ -181,32 +181,32 @@ def updateParameterNodeFromGui(self):
if not self.parameterNode:
return
pluginName = self.__class__.__name__
- self.parameterNode.SetParameter(pluginName+'.enabled', str(self.pluginCheckbox.checked))
+ self.parameterNode.SetParameter(pluginName + '.enabled', str(self.pluginCheckbox.checked))
for (key, checkbox) in self.requestedKeysCheckboxes.items():
- parameter = self.toLongKey(key)+'.enabled'
+ parameter = self.toLongKey(key) + '.enabled'
newValue = str(checkbox.checked)
currentValue = self.parameterNode.GetParameter(parameter)
- if not currentValue or currentValue!=newValue:
+ if not currentValue or currentValue != newValue:
self.parameterNode.SetParameter(parameter, newValue)
def requestAll(self):
if not self.parameterNode:
return
for (key, checkbox) in self.requestedKeysCheckboxes.items():
- parameter = self.toLongKey(key)+'.enabled'
+ parameter = self.toLongKey(key) + '.enabled'
newValue = str(True)
currentValue = self.parameterNode.GetParameter(parameter)
- if not currentValue or currentValue!=newValue:
+ if not currentValue or currentValue != newValue:
self.parameterNode.SetParameter(parameter, newValue)
def requestNone(self):
if not self.parameterNode:
return
for (key, checkbox) in self.requestedKeysCheckboxes.items():
- parameter = self.toLongKey(key)+'.enabled'
+ parameter = self.toLongKey(key) + '.enabled'
newValue = str(False)
currentValue = self.parameterNode.GetParameter(parameter)
- if not currentValue or currentValue!=newValue:
+ if not currentValue or currentValue != newValue:
self.parameterNode.SetParameter(parameter, newValue)
def requestDefault(self):
diff --git a/Modules/Scripted/SelfTests/SelfTests.py b/Modules/Scripted/SelfTests/SelfTests.py
index 41a6497157f..a1b3deb07b7 100644
--- a/Modules/Scripted/SelfTests/SelfTests.py
+++ b/Modules/Scripted/SelfTests/SelfTests.py
@@ -53,7 +53,7 @@ def __init__(self, parent):
slicer.selfTests = {}
# register the example tests
- slicer.selfTests['MRMLSceneExists'] = lambda : slicer.app.mrmlScene
+ slicer.selfTests['MRMLSceneExists'] = lambda: slicer.app.mrmlScene
slicer.selfTests['CloseScene'] = ExampleSelfTests.closeScene
#
@@ -102,7 +102,7 @@ def setup(self):
self.testButtons[test] = qt.QPushButton(test)
self.testButtons[test].setToolTip(slicer.selfTests[test].__doc__)
self.testList.layout().addWidget(self.testButtons[test])
- self.testMapper.setMapping(self.testButtons[test],test)
+ self.testMapper.setMapping(self.testButtons[test], test)
self.testButtons[test].connect('clicked()', self.testMapper, 'map()')
# Add spacer to layout
@@ -112,11 +112,11 @@ def onRunAll(self):
self.logic.run(continueCheck=self.continueCheck)
slicer.util.infoDisplay(self.logic, windowTitle='SelfTests')
- def onRun(self,test):
- self.logic.run([test,], continueCheck=self.continueCheck)
+ def onRun(self, test):
+ self.logic.run([test, ], continueCheck=self.continueCheck)
slicer.util.infoDisplay(self.logic, windowTitle='SelfTests')
- def continueCheck(self,logic):
+ def continueCheck(self, logic):
slicer.app.processEvents(qt.QEventLoop.ExcludeUserInputEvents)
return True
@@ -124,7 +124,7 @@ def continueCheck(self,logic):
class SelfTestsLogic:
"""Logic to handle invoking the tests and reporting the results"""
- def __init__(self,selfTests):
+ def __init__(self, selfTests):
self.selfTests = selfTests
self.results = {}
self.passed = []
@@ -136,13 +136,13 @@ def __str__(self):
return "No tests run"
s = "%.0f%% passed (%d of %d)" % (
(100. * len(self.passed) / testsRun),
- len(self.passed), testsRun )
- s +="\n---\n"
+ len(self.passed), testsRun)
+ s += "\n---\n"
for test in self.results:
s += f"{test}\t{self.results[test]}\n"
return s
- def run(self,tests=None,continueCheck=None):
+ def run(self, tests=None, continueCheck=None):
if not tests:
tests = list(self.selfTests.keys())
@@ -161,7 +161,7 @@ def run(self,tests=None,continueCheck=None):
def SelfTestsTest():
- if hasattr(slicer,'selfTests'):
+ if hasattr(slicer, 'selfTests'):
logic = SelfTestsLogic(list(slicer.selfTests.keys()))
logic.run()
print(logic.results)
@@ -184,4 +184,4 @@ def SelfTestsDemo():
exit()
# TODO - 'exit()' returns so this code gets run
# even if the argument matches one of the cases above
- #print ("usage: SelfTests.py [--test | --demo]")
+ # print ("usage: SelfTests.py [--test | --demo]")
diff --git a/Modules/Scripted/VectorToScalarVolume/VectorToScalarVolume.py b/Modules/Scripted/VectorToScalarVolume/VectorToScalarVolume.py
index a829ff238db..f40997b156c 100644
--- a/Modules/Scripted/VectorToScalarVolume/VectorToScalarVolume.py
+++ b/Modules/Scripted/VectorToScalarVolume/VectorToScalarVolume.py
@@ -306,7 +306,7 @@ def __init__(self, parent=None):
def setup(self):
self.methodLayout = qt.QHBoxLayout(self)
- self.methodLayout.setContentsMargins(0,0,0,0)
+ self.methodLayout.setContentsMargins(0, 0, 0, 0)
self.methodSelectorComboBox = qt.QComboBox()
self.methodSelectorComboBox.addItem("Luminance", VectorToScalarVolumeLogic.LUMINANCE)
@@ -350,7 +350,7 @@ class VectorToScalarVolumeLogic(ScriptedLoadableModuleLogic):
CONVERSION_METHODS = (LUMINANCE, AVERAGE, SINGLE_COMPONENT)
- def __init__(self, parent = None):
+ def __init__(self, parent=None):
ScriptedLoadableModuleLogic.__init__(self, parent)
def createParameterNode(self):
@@ -493,7 +493,7 @@ def runConversionMethodAverage(self, inputVolumeNode, outputVolumeNode):
weights = vtk.vtkDoubleArray()
weights.SetNumberOfValues(numberOfComponents)
# TODO: Average could be extended to let the user choose the weights of the components.
- evenWeight = 1.0/numberOfComponents
+ evenWeight = 1.0 / numberOfComponents
logging.debug("ImageWeightedSum: weight value for all components: %s" % evenWeight)
for comp in range(numberOfComponents):
weights.SetValue(comp, evenWeight)
diff --git a/Modules/Scripted/WebServer/WebServer.py b/Modules/Scripted/WebServer/WebServer.py
index 04c1e2bd3c4..c333db4ca55 100644
--- a/Modules/Scripted/WebServer/WebServer.py
+++ b/Modules/Scripted/WebServer/WebServer.py
@@ -207,8 +207,8 @@ def onReload(self):
slicer._webServerStarted = self.logic.serverStarted
self.stopServer()
- packageName='WebServerLib'
- submoduleNames=['SlicerRequestHandler', 'StaticPagesRequestHandler']
+ packageName = 'WebServerLib'
+ submoduleNames = ['SlicerRequestHandler', 'StaticPagesRequestHandler']
if hasattr(slicer.modules, "dicom"):
submoduleNames.append('DICOMRequestHandler')
import imp
@@ -217,7 +217,7 @@ def onReload(self):
for submoduleName in submoduleNames:
f, filename, description = imp.find_module(submoduleName, package.__path__)
try:
- imp.load_module(packageName+'.'+submoduleName, f, filename, description)
+ imp.load_module(packageName + '.' + submoduleName, f, filename, description)
finally:
f.close()
@@ -228,12 +228,12 @@ def onReload(self):
slicer.modules.WebServerWidget.startServer()
del slicer._webServerStarted
- def logMessage(self,*args):
+ def logMessage(self, *args):
if self.consoleMessages:
for arg in args:
print(arg)
if self.guiMessages:
- if len(self.log.html) > 1024*256:
+ if len(self.log.html) > 1024 * 256:
self.log.clear()
self.log.insertHtml("Log cleared\n")
for arg in args:
@@ -254,7 +254,7 @@ class SlicerHTTPServer(HTTPServer):
"""
# TODO: set header so client knows that image refreshes are needed (avoid
# using the &time=xxx trick)
- def __init__(self, server_address=("",2016), requestHandlers=None, docroot='.', logMessage=None, certfile=None):
+ def __init__(self, server_address=("", 2016), requestHandlers=None, docroot='.', logMessage=None, certfile=None):
"""
:param server_address: passed to parent class (default ("", 8070))
:param requestHandlers: request handler objects; if not specified then Slicer, DICOM, and StaticPages handlers are registered
@@ -262,7 +262,7 @@ def __init__(self, server_address=("",2016), requestHandlers=None, docroot='.',
:param logMessage: a callable for messages
:param certfile: path to a file with an ssl certificate (.pem file)
"""
- HTTPServer.__init__(self,server_address, SlicerHTTPServer.DummyRequestHandler)
+ HTTPServer.__init__(self, server_address, SlicerHTTPServer.DummyRequestHandler)
self.requestHandlers = []
@@ -305,7 +305,7 @@ def __init__(self, connectionSocket, requestHandlers, docroot, logMessage):
self.connectionSocket = connectionSocket
self.docroot = docroot
self.logMessage = logMessage
- self.bufferSize = 1024*1024
+ self.bufferSize = 1024 * 1024
self.requestHandlers = []
for requestHandler in requestHandlers:
self.registerRequestHandler(requestHandler)
@@ -338,8 +338,8 @@ def onReadable(self, fileno):
if self.expectedRequestSize > 0:
self.logMessage('received... %d of %d expected' % (len(self.requestSoFar), self.expectedRequestSize))
if len(self.requestSoFar) >= self.expectedRequestSize:
- requestHeader = self.requestSoFar[:endOfHeader+2]
- requestBody = self.requestSoFar[4+endOfHeader:]
+ requestHeader = self.requestSoFar[:endOfHeader + 2]
+ requestBody = self.requestSoFar[4 + endOfHeader:]
requestComplete = True
else:
if endOfHeader != -1:
@@ -353,8 +353,8 @@ def onReadable(self, fileno):
self.expectedRequestSize = 4 + endOfHeader + contentLength
self.logMessage('Expecting a body of %d, total size %d' % (contentLength, self.expectedRequestSize))
if len(requestPart) == self.expectedRequestSize:
- requestHeader = requestPart[:endOfHeader+2]
- requestBody = requestPart[4+endOfHeader:]
+ requestHeader = requestPart[:endOfHeader + 2]
+ requestBody = requestPart[4 + endOfHeader:]
requestComplete = True
else:
self.logMessage('Found end of header with no content, so body is empty')
@@ -375,11 +375,11 @@ def onReadable(self, fileno):
self.logMessage("Ignoring empty request")
return
- method,uri,version = [b'GET', b'/', b'HTTP/1.1'] # defaults
+ method, uri, version = [b'GET', b'/', b'HTTP/1.1'] # defaults
requestLines = requestHeader.split(b'\r\n')
self.logMessage(requestLines[0])
try:
- method,uri,version = requestLines[0].split(b' ')
+ method, uri, version = requestLines[0].split(b' ')
except ValueError as e:
self.logMessage("Could not interpret first request lines: ", requestLines)
@@ -421,7 +421,7 @@ def onReadable(self, fileno):
self.logMessage(frame)
self.logMessage(etype, value)
contentType = b'text/plain'
- responseBody = b'Server error' # TODO: send correct error code in response
+ responseBody = b'Server error' # TODO: send correct error code in response
else:
contentType = b'text/plain'
responseBody = b''
@@ -453,10 +453,10 @@ def onWritable(self, fileno):
self.logMessage('Sending on %d...' % (fileno))
sendError = False
try:
- sent = self.connectionSocket.send(self.response[:500*self.bufferSize])
+ sent = self.connectionSocket.send(self.response[:500 * self.bufferSize])
self.response = self.response[sent:]
self.sentSoFar += sent
- self.logMessage('sent: %d (%d of %d, %f%%)' % (sent, self.sentSoFar, self.toSend, 100.*self.sentSoFar / self.toSend))
+ self.logMessage('sent: %d (%d of %d, %f%%)' % (sent, self.sentSoFar, self.toSend, 100. * self.sentSoFar / self.toSend))
except socket.error as e:
self.logMessage('Socket error while sending: %s' % e)
sendError = True
@@ -468,7 +468,7 @@ def onWritable(self, fileno):
self.connectionSocket.close()
self.logMessage('closed fileno %d' % (fileno))
- def onServerSocketNotify(self,fileno):
+ def onServerSocketNotify(self, fileno):
self.logMessage('got request on %d' % fileno)
try:
(connectionSocket, clientAddress) = self.socket.accept()
@@ -484,7 +484,7 @@ def start(self):
"""
try:
self.logMessage('started httpserver...')
- self.notifier = qt.QSocketNotifier(self.socket.fileno(),qt.QSocketNotifier.Read)
+ self.notifier = qt.QSocketNotifier(self.socket.fileno(), qt.QSocketNotifier.Read)
self.logMessage('listening on %d...' % self.socket.fileno())
self.notifier.connect('activated(int)', self.onServerSocketNotify)
@@ -503,22 +503,22 @@ def handle_error(self, request, client_address):
The default is to print a traceback and continue.
"""
- print ('-'*40)
- print ('Exception happened during processing of request', request)
- print ('From', client_address)
+ print('-' * 40)
+ print('Exception happened during processing of request', request)
+ print('From', client_address)
import traceback
- traceback.print_exc() # XXX But this goes to stderr!
- print ('-'*40)
+ traceback.print_exc() # XXX But this goes to stderr!
+ print('-' * 40)
@classmethod
- def findFreePort(self,port=2016):
+ def findFreePort(self, port=2016):
"""returns a port that is not apparently in use"""
portFree = False
while not portFree:
try:
- s = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
- s.setsockopt( socket.SOL_SOCKET, socket.SO_REUSEADDR, 1 )
- s.bind( ( "", port ) )
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+ s.bind(("", port))
except socket.error as e:
portFree = False
port += 1
@@ -588,7 +588,7 @@ def start(self):
certfile = None
self.server = SlicerHTTPServer(requestHandlers=self.requestHandlers,
docroot=self.docroot,
- server_address=("",self.port),
+ server_address=("", self.port),
logMessage=self.logMessage,
certfile=certfile)
self.server.start()
diff --git a/Modules/Scripted/WebServer/WebServerLib/DICOMRequestHandler.py b/Modules/Scripted/WebServer/WebServerLib/DICOMRequestHandler.py
index aed90199f62..61922be1fbd 100644
--- a/Modules/Scripted/WebServer/WebServerLib/DICOMRequestHandler.py
+++ b/Modules/Scripted/WebServer/WebServerLib/DICOMRequestHandler.py
@@ -101,7 +101,7 @@ def handleStudies(self, parsedURL, requestBody):
firstInstance = instances[0]
dataset = pydicom.dcmread(slicer.dicomDatabase.fileForInstance(firstInstance), stop_before_pixels=True)
studyDataset = pydicom.dataset.Dataset()
- studyDataset.SpecificCharacterSet = [u'ISO_IR 100']
+ studyDataset.SpecificCharacterSet = [u'ISO_IR 100']
studyDataset.StudyDate = dataset.StudyDate
studyDataset.StudyTime = dataset.StudyTime
studyDataset.StudyDescription = dataset.StudyDescription
@@ -111,7 +111,7 @@ def handleStudies(self, parsedURL, requestBody):
studyDataset.ModalitiesInStudy = list(modalitiesInStudy)
studyDataset.ReferringPhysicianName = dataset.ReferringPhysicianName
studyDataset[self.retrieveURLTag] = pydicom.dataelem.DataElement(
- 0x00080190, "UR", "http://example.com") #TODO: provide WADO-RS RetrieveURL
+ 0x00080190, "UR", "http://example.com") # TODO: provide WADO-RS RetrieveURL
studyDataset.PatientName = dataset.PatientName
studyDataset.PatientID = dataset.PatientID
studyDataset.PatientBirthDate = dataset.PatientBirthDate
@@ -163,7 +163,7 @@ def handleSeries(self, parsedURL, requestBody):
firstInstance = instances[0]
dataset = pydicom.dcmread(slicer.dicomDatabase.fileForInstance(firstInstance), stop_before_pixels=True)
seriesDataset = pydicom.dataset.Dataset()
- seriesDataset.SpecificCharacterSet = [u'ISO_IR 100']
+ seriesDataset.SpecificCharacterSet = [u'ISO_IR 100']
seriesDataset.Modality = dataset.Modality
seriesDataset.SeriesInstanceUID = dataset.SeriesInstanceUID
seriesDataset.SeriesNumber = dataset.SeriesNumber
@@ -202,7 +202,7 @@ def handleWADOURI(self, parsedURL, requestBody):
try:
instanceUID = q[b'objectUID'][0].decode().strip()
except KeyError:
- return None,None
+ return None, None
self.logMessage('found uid %s' % instanceUID)
contentType = b'application/dicom'
path = slicer.dicomDatabase.fileForInstance(instanceUID)
diff --git a/Modules/Scripted/WebServer/WebServerLib/SlicerRequestHandler.py b/Modules/Scripted/WebServer/WebServerLib/SlicerRequestHandler.py
index a9407dbc6e2..f890cc81c9a 100644
--- a/Modules/Scripted/WebServer/WebServerLib/SlicerRequestHandler.py
+++ b/Modules/Scripted/WebServer/WebServerLib/SlicerRequestHandler.py
@@ -23,7 +23,7 @@ def logMessage(self, *args):
def canHandleRequest(self, uri, requestBody):
parsedURL = urllib.parse.urlparse(uri)
- pathParts = os.path.split(parsedURL.path) # path is like /slicer/timeimage
+ pathParts = os.path.split(parsedURL.path) # path is like /slicer/timeimage
route = pathParts[0]
return 0.5 if route.startswith(b'/slicer') else 0.0
@@ -93,7 +93,7 @@ def handleRequest(self, uri, requestBody):
print(frame)
return contentType, responseBody
- def exec(self,request, requestBody):
+ def exec(self, request, requestBody):
"""
Implements the Read Eval Print Loop for python code.
:param source: python code to run
@@ -141,7 +141,7 @@ def setupMRMLTracking(self):
self.cube.Update()
# display node
self.modelDisplay = slicer.vtkMRMLModelDisplayNode()
- self.modelDisplay.SetColor(1,1,0) # yellow
+ self.modelDisplay.SetColor(1, 1, 0) # yellow
slicer.mrmlScene.AddNode(self.modelDisplay)
# self.modelDisplay.SetPolyData(self.cube.GetOutputPort())
# Create model node
@@ -157,7 +157,7 @@ def setupMRMLTracking(self):
slicer.mrmlScene.AddNode(self.tracker)
self.trackingDevice.SetAndObserveTransformNodeID(self.tracker.GetID())
- def tracking(self,request):
+ def tracking(self, request):
"""
Send the matrix for a tracked object in the scene
:param m: 4x4 tracker matrix in column major order (position is last row)
@@ -167,17 +167,17 @@ def tracking(self,request):
"""
p = urllib.parse.urlparse(request.decode())
q = urllib.parse.parse_qs(p.query)
- self.logMessage (q)
+ self.logMessage(q)
try:
- transformMatrix = list(map(float,q['m'][0].split(',')))
+ transformMatrix = list(map(float, q['m'][0].split(',')))
except KeyError:
transformMatrix = None
try:
- quaternion = list(map(float,q['q'][0].split(',')))
+ quaternion = list(map(float, q['q'][0].split(',')))
except KeyError:
quaternion = None
try:
- position = list(map(float,q['p'][0].split(',')))
+ position = list(map(float, q['p'][0].split(',')))
except KeyError:
position = None
@@ -188,14 +188,14 @@ def tracking(self,request):
if transformMatrix:
for row in range(3):
for column in range(3):
- m.SetElement(row,column, transformMatrix[3*row+column])
- m.SetElement(row,column, transformMatrix[3*row+column])
- m.SetElement(row,column, transformMatrix[3*row+column])
- m.SetElement(row,column, transformMatrix[3*row+column])
+ m.SetElement(row, column, transformMatrix[3 * row + column])
+ m.SetElement(row, column, transformMatrix[3 * row + column])
+ m.SetElement(row, column, transformMatrix[3 * row + column])
+ m.SetElement(row, column, transformMatrix[3 * row + column])
if position:
for row in range(3):
- m.SetElement(row,3, position[row])
+ m.SetElement(row, 3, position[row])
if quaternion:
qu = vtk.vtkQuaternion['float64']()
@@ -203,15 +203,15 @@ def tracking(self,request):
qu.SetX(quaternion[1])
qu.SetY(quaternion[2])
qu.SetZ(quaternion[3])
- m3 = [[0,0,0],[0,0,0],[0,0,0]]
+ m3 = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]
qu.ToMatrix3x3(m3)
for row in range(3):
for column in range(3):
- m.SetElement(row,column, m3[row][column])
+ m.SetElement(row, column, m3[row][column])
self.tracker.SetMatrixTransformToParent(m)
- return ( f"Set matrix".encode() ), b'text/plain'
+ return (f"Set matrix".encode()), b'text/plain'
def sampleData(self, request):
p = urllib.parse.urlparse(request.decode())
@@ -222,15 +222,15 @@ def sampleData(self, request):
except KeyError:
name = None
if not name:
- return ( b"sampledata name was not specifiedXYZ" ), b'text/plain'
+ return (b"sampledata name was not specifiedXYZ"), b'text/plain'
import SampleData
try:
SampleData.downloadSample(name)
except IndexError:
- return ( f"sampledata {name} was not found".encode() ), b'text/plain'
- return ( f"Sample data {name} loaded".encode() ), b'text/plain'
+ return (f"sampledata {name} was not found".encode()), b'text/plain'
+ return (f"Sample data {name} loaded".encode()), b'text/plain'
- def volumeSelection(self,request):
+ def volumeSelection(self, request):
"""
Cycles through loaded volumes in the scene
:param cmd: either "next" or "previous" to indicate direction
@@ -266,9 +266,9 @@ def volumeSelection(self,request):
if newIndex < 0:
newIndex = len(nodes) - 1
volumeNode = nodes[nodes.keys()[newIndex]]
- selectionNode.SetReferenceActiveVolumeID( volumeNode.GetID() )
+ selectionNode.SetReferenceActiveVolumeID(volumeNode.GetID())
applicationLogic.PropagateVolumeSelection(0)
- return ( f"Volume selected".encode() ), b'text/plain'
+ return (f"Volume selected".encode()), b'text/plain'
def volumes(self, request, requestBody):
"""
@@ -280,7 +280,7 @@ def volumes(self, request, requestBody):
for id_ in mrmlVolumes.keys():
volumeNode = mrmlVolumes[id_]
volumes.append({"name": volumeNode.GetName(), "id": volumeNode.GetID()})
- return ( json.dumps(volumes).encode() ), b'application/json'
+ return (json.dumps(volumes).encode()), b'application/json'
def volume(self, request, requestBody):
"""
@@ -310,7 +310,7 @@ def gridTransforms(self, request, requestBody):
for id_ in mrmlGridTransforms.keys():
gridTransform = mrmlGridTransforms[id_]
gridTransforms.append({"name": gridTransform.GetName(), "id": gridTransform.GetID()})
- return ( json.dumps(gridTransforms).encode() ), b'application/json'
+ return (json.dumps(gridTransforms).encode()), b'application/json'
def gridTransform(self, request, requestBody):
"""
@@ -344,14 +344,14 @@ def postNRRD(self, volumeID, requestBody):
return
fields = {}
- endOfHeader = requestBody.find(b'\n\n') #TODO: could be \r\n
+ endOfHeader = requestBody.find(b'\n\n') # TODO: could be \r\n
header = requestBody[:endOfHeader]
self.logMessage(header)
for line in header.split(b'\n'):
colonIndex = line.find(b':')
if line[0] != '#' and colonIndex != -1:
key = line[:colonIndex]
- value = line[colonIndex+2:]
+ value = line[colonIndex + 2:]
fields[key] = value
if fields[b'type'] != b'short':
@@ -371,28 +371,28 @@ def postNRRD(self, volumeID, requestBody):
return b"{'status': 'failed'}"
imageData = vtk.vtkImageData()
- imageData.SetDimensions(list(map(int,fields[b'sizes'].split(b' '))))
+ imageData.SetDimensions(list(map(int, fields[b'sizes'].split(b' '))))
imageData.AllocateScalars(vtk.VTK_SHORT, 1)
- origin = list(map(float, fields[b'space origin'].replace(b'(',b'').replace(b')',b'').split(b',')))
+ origin = list(map(float, fields[b'space origin'].replace(b'(', b'').replace(b')', b'').split(b',')))
origin[0] *= -1
origin[1] *= -1
directions = []
directionParts = fields[b'space directions'].split(b')')[:3]
for directionPart in directionParts:
- part = directionPart.replace(b'(',b'').replace(b')',b'').split(b',')
+ part = directionPart.replace(b'(', b'').replace(b')', b'').split(b',')
directions.append(list(map(float, part)))
ijkToRAS = vtk.vtkMatrix4x4()
ijkToRAS.Identity()
for row in range(3):
- ijkToRAS.SetElement(row,3, origin[row])
+ ijkToRAS.SetElement(row, 3, origin[row])
for column in range(3):
element = directions[column][row]
if row < 2:
element *= -1
- ijkToRAS.SetElement(row,column, element)
+ ijkToRAS.SetElement(row, column, element)
try:
node = slicer.util.getNode(volumeID)
@@ -406,14 +406,14 @@ def postNRRD(self, volumeID, requestBody):
node.SetAndObserveImageData(imageData)
node.SetIJKToRASMatrix(ijkToRAS)
- pixels = numpy.frombuffer(requestBody[endOfHeader+2:],dtype=numpy.dtype('int16'))
+ pixels = numpy.frombuffer(requestBody[endOfHeader + 2:], dtype=numpy.dtype('int16'))
array = slicer.util.array(node.GetID())
array[:] = pixels.reshape(array.shape)
imageData.GetPointData().GetScalars().Modified()
displayNode = node.GetDisplayNode()
displayNode.ProcessMRMLEvents(displayNode, vtk.vtkCommand.ModifiedEvent, "")
- #TODO: this could be optional
+ # TODO: this could be optional
slicer.app.applicationLogic().GetSelectionNode().SetReferenceActiveVolumeID(node.GetID())
slicer.app.applicationLogic().PropagateVolumeSelection()
@@ -429,7 +429,7 @@ def getNRRD(self, volumeID):
if volumeNode is None or volumeArray is None:
self.logMessage('Could not find requested volume')
return None
- supportedNodes = ["vtkMRMLScalarVolumeNode","vtkMRMLLabelMapVolumeNode"]
+ supportedNodes = ["vtkMRMLScalarVolumeNode", "vtkMRMLLabelMapVolumeNode"]
if not volumeNode.GetClassName() in supportedNodes:
self.logMessage('Can only get scalar volumes')
return None
@@ -445,31 +445,31 @@ def getNRRD(self, volumeID):
scalarType = 'short'
sizes = imageData.GetDimensions()
- sizes = " ".join(list(map(str,sizes)))
+ sizes = " ".join(list(map(str, sizes)))
- originList = [0,]*3
- directionLists = [[0,]*3,[0,]*3,[0,]*3]
+ originList = [0, ] * 3
+ directionLists = [[0, ] * 3, [0, ] * 3, [0, ] * 3]
ijkToRAS = vtk.vtkMatrix4x4()
volumeNode.GetIJKToRASMatrix(ijkToRAS)
for row in range(3):
- originList[row] = ijkToRAS.GetElement(row,3)
+ originList[row] = ijkToRAS.GetElement(row, 3)
for column in range(3):
- element = ijkToRAS.GetElement(row,column)
+ element = ijkToRAS.GetElement(row, column)
if row < 2:
element *= -1
directionLists[column][row] = element
- originList[0] *=-1
- originList[1] *=-1
- origin = '('+','.join(list(map(str,originList)))+')'
+ originList[0] *= -1
+ originList[1] *= -1
+ origin = '(' + ','.join(list(map(str, originList))) + ')'
directions = ""
for directionList in directionLists:
- direction = '('+','.join(list(map(str,directionList)))+')'
+ direction = '(' + ','.join(list(map(str, directionList))) + ')'
directions += direction + " "
directions = directions[:-1]
# should look like:
- #space directions: (0,1,0) (0,0,-1) (-1.2999954223632812,0,0)
- #space origin: (86.644897460937486,-133.92860412597656,116.78569793701172)
+ # space directions: (0,1,0) (0,0,-1) (-1.2999954223632812,0,0)
+ # space origin: (86.644897460937486,-133.92860412597656,116.78569793701172)
nrrdHeader = """NRRD0004
# Complete NRRD file format specification at:
@@ -498,7 +498,7 @@ def getTransformNRRD(self, transformID):
if transformNode is None or transformArray is None:
self.logMessage('Could not find requested transform')
return None
- supportedNodes = ["vtkMRMLGridTransformNode",]
+ supportedNodes = ["vtkMRMLGridTransformNode", ]
if not transformNode.GetClassName() in supportedNodes:
self.logMessage('Can only get grid transforms')
return None
@@ -506,7 +506,7 @@ def getTransformNRRD(self, transformID):
# map the vectors to be in the LPS measurement frame
# (need to make a copy so as not to change the slicer transform)
lpsArray = numpy.array(transformArray)
- lpsArray *= numpy.array([-1,-1,1])
+ lpsArray *= numpy.array([-1, -1, 1])
imageData = transformNode.GetTransformFromParent().GetDisplacementGrid()
@@ -516,21 +516,21 @@ def getTransformNRRD(self, transformID):
# -- here we assume it is axial as generated by LandmarkTransform
sizes = (3,) + imageData.GetDimensions()
- sizes = " ".join(list(map(str,sizes)))
+ sizes = " ".join(list(map(str, sizes)))
spacing = list(imageData.GetSpacing())
- spacing[0] *= -1 # RAS to LPS
- spacing[1] *= -1 # RAS to LPS
+ spacing[0] *= -1 # RAS to LPS
+ spacing[1] *= -1 # RAS to LPS
directions = '(%g,0,0) (0,%g,0) (0,0,%g)' % tuple(spacing)
origin = list(imageData.GetOrigin())
- origin[0] *= -1 # RAS to LPS
- origin[1] *= -1 # RAS to LPS
+ origin[0] *= -1 # RAS to LPS
+ origin[1] *= -1 # RAS to LPS
origin = '(%g,%g,%g)' % tuple(origin)
# should look like:
- #space directions: (0,1,0) (0,0,-1) (-1.2999954223632812,0,0)
- #space origin: (86.644897460937486,-133.92860412597656,116.78569793701172)
+ # space directions: (0,1,0) (0,0,-1) (-1.2999954223632812,0,0)
+ # space origin: (86.644897460937486,-133.92860412597656,116.78569793701172)
nrrdHeader = """NRRD0004
# Complete NRRD file format specification at:
@@ -563,15 +563,15 @@ def fiducials(self, request, requestBody):
node['scale'] = displayNode.GetGlyphScale()
node['markups'] = []
for markupIndex in range(markupsNode.GetNumberOfMarkups()):
- position = [0,]*3
+ position = [0, ] * 3
markupsNode.GetNthFiducialPosition(markupIndex, position)
position
- node['markups'].append( {
+ node['markups'].append({
'label': markupsNode.GetNthFiducialLabel(markupIndex),
'position': position
})
fiducials[markupsNode.GetID()] = node
- return ( json.dumps( fiducials ).encode() ), b'application/json'
+ return (json.dumps(fiducials).encode()), b'application/json'
def fiducial(self, request, requestBody):
"""
@@ -628,9 +628,9 @@ def accessDICOMwebStudy(self, request, requestBody):
from DICOMLib import DICOMUtils
loadedUIDs = DICOMUtils.importFromDICOMWeb(
- dicomWebEndpoint = request['dicomWEBPrefix'] + '/' + request['dicomWEBStore'],
- studyInstanceUID = request['studyUID'],
- accessToken = request['accessToken'])
+ dicomWebEndpoint=request['dicomWEBPrefix'] + '/' + request['dicomWEBStore'],
+ studyInstanceUID=request['studyUID'],
+ accessToken=request['accessToken'])
files = []
for studyUID in loadedUIDs:
@@ -644,15 +644,15 @@ def accessDICOMwebStudy(self, request, requestBody):
return b'{"result": "ok"}'
- def mrml(self,request):
+ def mrml(self, request):
"""
Returns a json list of all the mrml nodes
"""
p = urllib.parse.urlparse(request.decode())
q = urllib.parse.parse_qs(p.query)
- return ( json.dumps( list(slicer.util.getNodes('*').keys()) ).encode() ), b'application/json'
+ return (json.dumps(list(slicer.util.getNodes('*').keys())).encode()), b'application/json'
- def screenshot(self,request):
+ def screenshot(self, request):
"""
Returns screenshot of the application main window.
"""
@@ -678,7 +678,7 @@ def setViewersLayout(layoutName):
return
raise ValueError("Unknown layout name: " + layoutName)
- def gui(self,request):
+ def gui(self, request):
"""return a png of the application GUI.
:param contents: {full, viewers}
:param viewersLayout: {fourup, oneup3d, ...} slicer.vtkMRMLLayoutNode constants (SlicerLayout...View)
@@ -713,9 +713,9 @@ def gui(self,request):
if viewersLayout is not None:
SlicerRequestHandler.setViewersLayout(viewersLayout)
- return ( f"Switched {contents} to {viewersLayout}".encode() ), b'text/plain'
+ return (f"Switched {contents} to {viewersLayout}".encode()), b'text/plain'
- def slice(self,request):
+ def slice(self, request):
"""return a png for a slice view.
:param view: {red, yellow, green}
:param scrollTo: 0 to 1 for slice position within volume
@@ -762,29 +762,29 @@ def slice(self,request):
except (KeyError, ValueError):
orientation = None
- offsetKey = 'offset.'+view
- #if mode == 'start' or not self.interactionState.has_key(offsetKey):
- #self.interactionState[offsetKey] = sliceLogic.GetSliceOffset()
+ offsetKey = 'offset.' + view
+ # if mode == 'start' or not self.interactionState.has_key(offsetKey):
+ # self.interactionState[offsetKey] = sliceLogic.GetSliceOffset()
if scrollTo:
volumeNode = sliceLogic.GetBackgroundLayer().GetVolumeNode()
- bounds = [0,] * 6
- sliceLogic.GetVolumeSliceBounds(volumeNode,bounds)
+ bounds = [0, ] * 6
+ sliceLogic.GetVolumeSliceBounds(volumeNode, bounds)
sliceLogic.SetSliceOffset(bounds[4] + (scrollTo * (bounds[5] - bounds[4])))
if offset:
- #startOffset = self.interactionState[offsetKey]
+ # startOffset = self.interactionState[offsetKey]
sliceLogic.SetSliceOffset(startOffset + offset)
if copySliceGeometryFrom:
otherSliceLogic = layoutManager.sliceWidget(copySliceGeometryFrom.capitalize()).sliceLogic()
otherSliceNode = otherSliceLogic.GetSliceNode()
sliceNode = sliceLogic.GetSliceNode()
# technique from vtkMRMLSliceLinkLogic (TODO: should be exposed as method)
- sliceNode.GetSliceToRAS().DeepCopy( otherSliceNode.GetSliceToRAS() )
+ sliceNode.GetSliceToRAS().DeepCopy(otherSliceNode.GetSliceToRAS())
fov = sliceNode.GetFieldOfView()
otherFOV = otherSliceNode.GetFieldOfView()
- sliceNode.SetFieldOfView( otherFOV[0],
+ sliceNode.SetFieldOfView(otherFOV[0],
otherFOV[0] * fov[1] / fov[0],
- fov[2] )
+ fov[2])
if orientation:
sliceNode = sliceLogic.GetSliceNode()
@@ -806,7 +806,7 @@ def slice(self,request):
self.logMessage('returning an image of %d length' % len(pngData))
return pngData, b'image/png'
- def threeD(self,request):
+ def threeD(self, request):
"""return a png for a threeD view
:param lookFromAxis: {L, R, A, P, I, S}
:return: png binary buffer
@@ -856,7 +856,7 @@ def threeD(self,request):
view.renderEnabled = False
if lookFromAxis:
- axes = ['None', 'r','l','s','i','a','p']
+ axes = ['None', 'r', 'l', 's', 'i', 'a', 'p']
try:
axis = axes.index(lookFromAxis[0].lower())
view.lookFromViewAxis(axis)
@@ -876,7 +876,7 @@ def threeD(self,request):
self.logMessage('threeD returning an image of %d length' % len(pngData))
return pngData, b'image/png'
- def timeimage(self,request=''):
+ def timeimage(self, request=''):
"""
For timing and debugging - return an image with the current time
rendered as text down to the hundredth of a second
@@ -910,15 +910,15 @@ def timeimage(self,request=''):
color.setAlphaF(0.8)
pen.setColor(color)
pen.setWidth(5)
- pen.setStyle(3) # dotted line (Qt::DotLine)
+ pen.setStyle(3) # dotted line (Qt::DotLine)
painter.setPen(pen)
- rect = qt.QRect(1, 1, imageWidth-2, imageHeight-2)
+ rect = qt.QRect(1, 1, imageWidth - 2, imageHeight - 2)
painter.drawRect(rect)
color = qt.QColor("#333")
pen.setColor(color)
painter.setPen(pen)
- position = qt.QPoint(10,20)
- text = str(time.time()) # text to draw
+ position = qt.QPoint(10, 20)
+ text = str(time.time()) # text to draw
painter.drawText(position, text)
painter.end()
@@ -928,7 +928,7 @@ def timeimage(self,request=''):
pngData = self.vtkImageDataToPNG(vtkTimeImage)
return pngData, b'image/png'
- def vtkImageDataToPNG(self,imageData):
+ def vtkImageDataToPNG(self, imageData):
"""Return a buffer of png data using the data
from the vtkImageData.
:param imageData: a vtkImageData instance
diff --git a/Modules/Scripted/WebServer/WebServerLib/StaticPagesRequestHandler.py b/Modules/Scripted/WebServer/WebServerLib/StaticPagesRequestHandler.py
index b4645819b7b..2282a0a0032 100644
--- a/Modules/Scripted/WebServer/WebServerLib/StaticPagesRequestHandler.py
+++ b/Modules/Scripted/WebServer/WebServerLib/StaticPagesRequestHandler.py
@@ -34,7 +34,7 @@ def handleRequest(self, uri, requestBody):
responseBody = None
if uri.startswith(b'/'):
uri = uri[1:]
- path = os.path.join(self.docroot,uri)
+ path = os.path.join(self.docroot, uri)
self.logMessage('docroot: %s' % self.docroot)
if os.path.isdir(path):
for index in b"index.html", b"index.htm":
@@ -46,7 +46,7 @@ def handleRequest(self, uri, requestBody):
contentType = b"text/html"
responseBody = b""
for entry in os.listdir(path):
- responseBody += b"- %s
" % (os.path.join(uri,entry), entry)
+ responseBody += b"- %s
" % (os.path.join(uri, entry), entry)
responseBody += b"
"
else:
ext = os.path.splitext(path)[-1].decode()
diff --git a/Testing/ModelRender.py b/Testing/ModelRender.py
index bf1a50e8352..53b6ab51cbf 100644
--- a/Testing/ModelRender.py
+++ b/Testing/ModelRender.py
@@ -8,16 +8,16 @@ def newSphere(name=''):
name = "sphere-%g" % time.time()
sphere = Slicer.slicer.vtkSphereSource()
- sphere.SetCenter( -100 + 200*random.random(), -100 + 200*random.random(), -100 + 200*random.random() )
- sphere.SetRadius( 10 + 20 *random.random() )
+ sphere.SetCenter(-100 + 200 * random.random(), -100 + 200 * random.random(), -100 + 200 * random.random())
+ sphere.SetRadius(10 + 20 * random.random())
sphere.GetOutput().Update()
modelDisplayNode = Slicer.slicer.vtkMRMLModelDisplayNode()
modelDisplayNode.SetColor(random.random(), random.random(), random.random())
Slicer.slicer.MRMLScene.AddNode(modelDisplayNode)
modelNode = Slicer.slicer.vtkMRMLModelNode()
# VTK6 TODO
- modelNode.SetAndObservePolyData( sphere.GetOutput() )
- modelNode.SetAndObserveDisplayNodeID( modelDisplayNode.GetID() )
+ modelNode.SetAndObservePolyData(sphere.GetOutput())
+ modelNode.SetAndObserveDisplayNodeID(modelDisplayNode.GetID())
modelNode.SetName(name)
Slicer.slicer.MRMLScene.AddNode(modelNode)
@@ -26,5 +26,5 @@ def sphereMovie(dir="."):
for i in range(20):
newSphere()
- Slicer.TkCall( "update" )
- Slicer.TkCall( "SlicerSaveLargeImage %s/spheres-%d.png 3" % (dir, i) )
+ Slicer.TkCall("update")
+ Slicer.TkCall("SlicerSaveLargeImage %s/spheres-%d.png 3" % (dir, i))
diff --git a/Testing/TextureModel.py b/Testing/TextureModel.py
index ef9a72ac8fc..ae0836fda5e 100644
--- a/Testing/TextureModel.py
+++ b/Testing/TextureModel.py
@@ -6,9 +6,9 @@ def newPlane():
# create a plane polydata
plane = Slicer.slicer.vtkPlaneSource()
- plane.SetOrigin( 0., 0., 0. )
- plane.SetPoint1( 100., 0., 0. )
- plane.SetPoint2( 0., 0., 100. )
+ plane.SetOrigin(0., 0., 0.)
+ plane.SetPoint1(100., 0., 0.)
+ plane.SetPoint2(0., 0., 100.)
plane.GetOutput().Update()
# create a simple texture image
@@ -30,9 +30,9 @@ def newPlane():
# set up model node
modelNode = Slicer.slicer.vtkMRMLModelNode()
# VTK6 TODO
- modelNode.SetAndObservePolyData( plane.GetOutput() )
- modelNode.SetAndObserveDisplayNodeID( modelDisplayNode.GetID() )
- modelNode.SetAndObserveTransformNodeID( transformNode.GetID() )
+ modelNode.SetAndObservePolyData(plane.GetOutput())
+ modelNode.SetAndObserveDisplayNodeID(modelDisplayNode.GetID())
+ modelNode.SetAndObserveTransformNodeID(transformNode.GetID())
modelNode.SetName("Plane")
Slicer.slicer.MRMLScene.AddNode(modelNode)
@@ -58,18 +58,18 @@ def texturedPlane():
steps = 200
startTime = time.time()
- modelNode,transformNode,imageSource = newPlane()
+ modelNode, transformNode, imageSource = newPlane()
toParent = vtk.vtkMatrix4x4()
transformNode.GetMatrixTransformToParent(toParent)
for i in range(steps):
- imageSource.SetInValue( 200*(i%2) )
+ imageSource.SetInValue(200 * (i % 2))
toParent.SetElement(0, 3, i)
transformNode.SetMatrixTransformToParent(toParent)
modelNode.GetPolyData().Modified()
- Slicer.TkCall( "update" )
+ Slicer.TkCall("update")
endTime = time.time()
elapsed = endTime - startTime
diff --git a/Utilities/Scripts/ModuleWizard.py b/Utilities/Scripts/ModuleWizard.py
index 2e28ca0ab95..1feb12813bc 100755
--- a/Utilities/Scripts/ModuleWizard.py
+++ b/Utilities/Scripts/ModuleWizard.py
@@ -22,20 +22,20 @@ def findSource(dir):
fnmatch.fnmatch(file, "*.md5") or \
fnmatch.fnmatch(file, "*.png") or \
fnmatch.fnmatch(file, "*.dox"):
- file = os.path.join(root,file)
- file = file[len(dir):] # strip common dir
+ file = os.path.join(root, file)
+ file = file[len(dir):] # strip common dir
fileList.append(file)
return fileList
def copyAndReplace(inFile, template, target, key, moduleName):
- newFile = os.path.join( target, inFile.replace(key, moduleName) )
- print ("creating %s" % newFile)
+ newFile = os.path.join(target, inFile.replace(key, moduleName))
+ print("creating %s" % newFile)
path = os.path.dirname(newFile)
if not os.path.exists(path):
os.makedirs(path)
- fp = open(os.path.join(template,inFile))
+ fp = open(os.path.join(template, inFile))
contents = fp.read()
fp.close()
contents = contents.replace(key, moduleName)
@@ -46,19 +46,19 @@ def copyAndReplace(inFile, template, target, key, moduleName):
def usage():
- print ("")
- print ("Usage:")
- print ("ModuleWizard [--template ] [--templateKey ] [--target ] ")
- print (" --template default ./Extensions/Testing/LoadableExtensionTemplate")
- print (" --templateKey default is dirname of template")
- print (" --target default ./Modules/Loadable/")
- print ("Examples (from Slicer source directory):")
- print (" ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/LoadableExtensionTemplate --target ../MyExtension MyExtension")
- print (" ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/ScriptedLoadableExtensionTemplate --target ../MyScript MyScript")
- print (" ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/EditorExtensionTemplate --target ../MyEditorEffect MyEditorEffect")
- print (" ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/CLIExtensionTemplate --target ../MyCLI MyCLI")
- print (" ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/SuperBuildExtensionTemplate --target ../MySuperBuild MySuperBuild")
- print ("")
+ print("")
+ print("Usage:")
+ print("ModuleWizard [--template ] [--templateKey ] [--target ] ")
+ print(" --template default ./Extensions/Testing/LoadableExtensionTemplate")
+ print(" --templateKey default is dirname of template")
+ print(" --target default ./Modules/Loadable/")
+ print("Examples (from Slicer source directory):")
+ print(" ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/LoadableExtensionTemplate --target ../MyExtension MyExtension")
+ print(" ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/ScriptedLoadableExtensionTemplate --target ../MyScript MyScript")
+ print(" ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/EditorExtensionTemplate --target ../MyEditorEffect MyEditorEffect")
+ print(" ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/CLIExtensionTemplate --target ../MyCLI MyCLI")
+ print(" ./Utilities/Scripts/ModuleWizard.py --template ./Extensions/Testing/SuperBuildExtensionTemplate --target ../MySuperBuild MySuperBuild")
+ print("")
def main(argv):
@@ -85,7 +85,7 @@ def main(argv):
moduleName = arg
if moduleName == "":
- print ("Please specify module name")
+ print("Please specify module name")
usage()
exit()
@@ -109,14 +109,14 @@ def main(argv):
usage()
exit()
- print (f"\nWill copy \n\t{template} \nto \n\t{target} \nreplacing \"{templateKey}\" with \"{moduleName}\"\n")
- sources = findSource( template )
- print (sources)
+ print(f"\nWill copy \n\t{template} \nto \n\t{target} \nreplacing \"{templateKey}\" with \"{moduleName}\"\n")
+ sources = findSource(template)
+ print(sources)
for file in sources:
copyAndReplace(file, template, target, templateKey, moduleName)
- print ('\nModule %s created!' % moduleName)
+ print('\nModule %s created!' % moduleName)
if __name__ == "__main__":
diff --git a/Utilities/Scripts/SEMToMediaWiki.py b/Utilities/Scripts/SEMToMediaWiki.py
index 4b253fe81f5..a44cb5328be 100644
--- a/Utilities/Scripts/SEMToMediaWiki.py
+++ b/Utilities/Scripts/SEMToMediaWiki.py
@@ -92,7 +92,7 @@ def GetSEMDoc(filename):
doc = xml.dom.minidom.parse(filename)
executableNode = [node for node in doc.childNodes if
node.nodeName == "executable"]
- #Only use the first
+ # Only use the first
return executableNode[0]
@@ -196,7 +196,7 @@ def DumpSEMMediaWikiFeatures(executableNode):
currentNode = parameterNode.firstChild
while currentNode is not None:
if currentNode.nodeType == currentNode.ELEMENT_NODE:
- #If this node doe not have a "label" element, then skip it.
+ # If this node doe not have a "label" element, then skip it.
if getThisNodesInfoAsText(currentNode, "label") != "":
# if this node has a default value -- document it!
if getThisNodesInfoAsText(currentNode, "default") != "":
diff --git a/Utilities/Scripts/SlicerWizard/CMakeParser.py b/Utilities/Scripts/SlicerWizard/CMakeParser.py
index 2f0ae39a6e5..09e2a722f53 100644
--- a/Utilities/Scripts/SlicerWizard/CMakeParser.py
+++ b/Utilities/Scripts/SlicerWizard/CMakeParser.py
@@ -23,7 +23,7 @@
import string
-#=============================================================================
+# =============================================================================
class Token:
"""Base class for CMake script tokens.
@@ -42,21 +42,21 @@ class Token:
many cases in order to produce a syntactically correct script.
"""
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, text, indent=""):
self.text = text
self.indent = indent
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __repr__(self):
return "Token(text=%(text)r, indent=%(indent)r)" % self.__dict__
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __str__(self):
return self.indent + self.text
-#=============================================================================
+# =============================================================================
class String(Token):
"""String token.
@@ -78,23 +78,23 @@ class String(Token):
outside of a command context.
"""
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, text, indent="", prefix="", suffix=""):
text = super().__init__(text, indent)
self.prefix = prefix
self.suffix = suffix
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __repr__(self):
return "String(prefix=%(prefix)r, suffix=%(suffix)r," \
" text=%(text)r, indent=%(indent)r)" % self.__dict__
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __str__(self):
return self.indent + self.prefix + self.text + self.suffix
-#=============================================================================
+# =============================================================================
class Comment(Token):
"""Comment token.
@@ -113,23 +113,23 @@ class Comment(Token):
bracket which shall match the long bracket in :attr:`prefix`.
"""
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, prefix, text, indent="", suffix=""):
text = super().__init__(text, indent)
self.prefix = prefix
self.suffix = suffix
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __repr__(self):
return "Comment(prefix=%(prefix)r, suffix=%(suffix)r," \
" text=%(text)r, indent=%(indent)r)" % self.__dict__
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __str__(self):
return self.indent + self.prefix + self.text + self.suffix
-#=============================================================================
+# =============================================================================
class Command(Token):
"""Command token.
@@ -155,26 +155,26 @@ class Command(Token):
the command.
"""
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, text, arguments=[], indent="", prefix="(", suffix=")"):
text = super().__init__(text, indent)
self.prefix = prefix
self.suffix = suffix
self.arguments = arguments
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __repr__(self):
return "Command(text=%(text)r, prefix=%(prefix)r," \
" suffix=%(suffix)r, arguments=%(arguments)r," \
" indent=%(indent)r)" % self.__dict__
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __str__(self):
args = "".join([str(a) for a in self.arguments])
return self.indent + self.text + self.prefix + args + self.suffix
-#=============================================================================
+# =============================================================================
class CMakeScript:
"""Tokenized representation of a CMake script.
@@ -191,7 +191,7 @@ class CMakeScript:
_reBracketQuote = re.compile(r"\[=*\[")
_reEscape = re.compile(r"\\[\\\"nrt$ ]")
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, content):
"""
:param content: Textual content of a CMake script.
@@ -234,21 +234,21 @@ def __init__(self, content):
self.tokens.append(Token(text=self._content[:n], indent=indent))
self._content = self._content[n:]
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __repr__(self):
return repr(self.tokens)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __str__(self):
return "".join([str(t) for t in self.tokens])
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def _chomp(self):
result = self._content[0]
self._content = self._content[1:]
return result
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def _chompSpace(self):
result = ""
@@ -258,7 +258,7 @@ def _chompSpace(self):
return result
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def _chompString(self, end, escapes):
result = ""
@@ -277,7 +277,7 @@ def _chompString(self, end, escapes):
raise EOFError("unexpected EOF while parsing string (expected %r)" % end)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def _parseArgument(self, indent):
text = ""
@@ -315,7 +315,7 @@ def _parseArgument(self, indent):
return String(text=text, indent=indent)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def _parseComment(self, match, indent):
b = match.group(1)
e = "\n" if b is None else b.replace("[", "]")
@@ -332,7 +332,7 @@ def _parseComment(self, match, indent):
return token
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def _parseCommand(self, match, indent):
command = match.group(1)
prefix = match.group(2)
@@ -358,7 +358,7 @@ def _parseCommand(self, match, indent):
raise EOFError("unexpected EOF while parsing command (expected ')')")
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def _is(self, regex):
self._match = regex.match(self._content)
return self._match is not None
diff --git a/Utilities/Scripts/SlicerWizard/ExtensionDescription.py b/Utilities/Scripts/SlicerWizard/ExtensionDescription.py
index 730c44c74f8..60cd4b0969c 100644
--- a/Utilities/Scripts/SlicerWizard/ExtensionDescription.py
+++ b/Utilities/Scripts/SlicerWizard/ExtensionDescription.py
@@ -6,7 +6,7 @@
from .ExtensionProject import ExtensionProject
-#=============================================================================
+# =============================================================================
class ExtensionDescription:
"""Representation of an extension description.
@@ -22,7 +22,7 @@ class ExtensionDescription:
DESCRIPTION_FILE_TEMPLATE = None
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, repo=None, filepath=None, sourcedir=None, cmakefile="CMakeLists.txt"):
"""
:param repo:
@@ -156,11 +156,11 @@ def __init__(self, repo=None, filepath=None, sourcedir=None, cmakefile="CMakeLis
self._setProjectAttribute("svnusername", p, elideempty=True)
self._setProjectAttribute("svnpassword", p, elideempty=True)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __repr__(self):
return repr(self.__dict__)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@staticmethod
def _remotePublicUrl(remote):
url = remote.url
@@ -169,7 +169,7 @@ def _remotePublicUrl(remote):
return url
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@staticmethod
def _gitSvnInfo(repo, remote):
result = {}
@@ -179,19 +179,19 @@ def _gitSvnInfo(repo, remote):
result[key] = value.strip()
return result
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def _setProjectAttribute(self, name, project, default=None, required=False,
elideempty=False, substitute=True):
if default is None and not required:
- default=""
+ default = ""
v = project.getValue("EXTENSION_" + name.upper(), default, substitute)
if len(v) or not elideempty:
setattr(self, name, v)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def clear(self, attr=None):
"""Remove attributes from the extension description.
@@ -206,14 +206,14 @@ def clear(self, attr=None):
for key in self.__dict__.keys() if attr is None else (attr,):
delattr(self, key)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def _read(self, fp):
for l in fp:
m = self._reParam.match(l)
if m is not None:
setattr(self, m.group(1), m.group(2).strip())
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def read(self, path):
"""Read extension description from directory.
@@ -241,7 +241,7 @@ def read(self, path):
with open(descriptionFiles[0]) as fp:
self._read(fp)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@staticmethod
def _findOccurences(a_str, sub):
start = 0
@@ -251,7 +251,7 @@ def _findOccurences(a_str, sub):
yield start
start += len(sub)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def _write(self, fp):
# Creation of the map
dictio = dict()
@@ -271,7 +271,7 @@ def _write(self, fp):
if self.DESCRIPTION_FILE_TEMPLATE is not None:
extDescriptFile = open(self.DESCRIPTION_FILE_TEMPLATE)
- for line in extDescriptFile.readlines() :
+ for line in extDescriptFile.readlines():
if "${" in line:
variables = self._findOccurences(line, "$")
temp = line
@@ -280,8 +280,8 @@ def _write(self, fp):
var = ""
i = variable + 2
while line[i] != '}':
- var+=line[i]
- i+=1
+ var += line[i]
+ i += 1
temp = temp.replace("${" + var + "}", dictio[var])
fp.write(temp)
else:
@@ -292,7 +292,7 @@ def _write(self, fp):
for key in sorted(self.__dict__):
fp.write((f"{key} {getattr(self, key)}").strip() + "\n")
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def write(self, out):
"""Write extension description to a file or stream.
diff --git a/Utilities/Scripts/SlicerWizard/ExtensionProject.py b/Utilities/Scripts/SlicerWizard/ExtensionProject.py
index 228ffd8ab01..f0aed946474 100644
--- a/Utilities/Scripts/SlicerWizard/ExtensionProject.py
+++ b/Utilities/Scripts/SlicerWizard/ExtensionProject.py
@@ -6,19 +6,19 @@
from .Utilities import detectEncoding
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def _isCommand(token, name):
return isinstance(token, CMakeParser.Command) and token.text.lower() == name
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def _trimIndent(indent):
indent = "\n" + indent
n = indent.rindex("\n")
return indent[n:]
-#=============================================================================
+# =============================================================================
class ExtensionProject:
"""Convenience class for manipulating an extension project.
@@ -38,7 +38,7 @@ class ExtensionProject:
_referencedVariables = re.compile(r"\$\{([\w_\/\.\+\-]+)\}")
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, path, encoding=None, filename="CMakeLists.txt", ):
"""
:param path: Top level directory of the extension project.
@@ -82,7 +82,7 @@ def _collect_cmakefiles(path, filename="CMakeLists.txt"):
cmakeFiles.append(cmakeFile)
return cmakeFiles
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@staticmethod
def _parse(cmakeFile, encoding=None):
with open(cmakeFile, "rb") as fp:
@@ -110,15 +110,15 @@ def _parse(cmakeFile, encoding=None):
return contents, encoding
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __enter__(self):
return self
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __exit__(self, exc_type, exc_value, traceback):
self.save()
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@property
def encoding(self):
"""Character encoding of the extension project CMakeLists.txt.
@@ -139,7 +139,7 @@ def encoding(self):
return self._encoding
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@property
def project(self):
"""Name of extension project.
@@ -169,7 +169,7 @@ def project(self):
raise EOFError("could not find project")
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@project.setter
def project(self, value):
@@ -184,7 +184,7 @@ def project(self, value):
raise EOFError("could not find project")
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def substituteVariableReferences(self, text):
"""Return a copy of ``text`` where all valid '``${var}``' occurrences
have been replaced.
@@ -225,7 +225,7 @@ def _substitue(text):
text = _substitue(text)
return text
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def getValue(self, name, default=None, substitute=False):
"""Get value of CMake variable set in project.
@@ -283,7 +283,7 @@ def getValue(self, name, default=None, substitute=False):
raise KeyError("script does not set %r" % name)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def setValue(self, name, value):
"""Change value of CMake variable set in project.
@@ -320,7 +320,7 @@ def setValue(self, name, value):
raise KeyError("script does not set %r" % name)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def addModule(self, name):
"""Add a module to the build rules of the project.
@@ -360,7 +360,7 @@ def addModule(self, name):
indent=indent)
self._scriptContents.tokens.insert(after, t)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def save(self, destination=None, encoding=None):
"""Save the project.
diff --git a/Utilities/Scripts/SlicerWizard/ExtensionWizard.py b/Utilities/Scripts/SlicerWizard/ExtensionWizard.py
index 3879f291df3..077fae5b33a 100644
--- a/Utilities/Scripts/SlicerWizard/ExtensionWizard.py
+++ b/Utilities/Scripts/SlicerWizard/ExtensionWizard.py
@@ -8,7 +8,7 @@
from urllib.parse import urlparse
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def haveGit():
"""Return True if git is available.
@@ -46,7 +46,7 @@ def haveGit():
from .WizardHelpFormatter import WizardHelpFormatter
-#=============================================================================
+# =============================================================================
class ExtensionWizard:
"""Implementation class for the Extension Wizard.
@@ -75,11 +75,11 @@ class ExtensionWizard:
_reAddSubdirectory = \
re.compile("(?<=\n)([ \t]*)add_subdirectory[(][^)]+[)][^\n]*\n")
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self):
self._templateManager = TemplateManager()
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def create(self, args, name, kind="default"):
"""Create a new extension from specified extension template.
@@ -108,7 +108,7 @@ def create(self, args, name, kind="default"):
except:
die("failed to create extension: %s" % sys.exc_info()[1])
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def addModule(self, args, kind, name):
"""Add a module to an existing extension.
@@ -142,7 +142,7 @@ def addModule(self, args, kind, name):
except:
die("failed to add module: %s" % sys.exc_info()[1])
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def describe(self, args):
"""Generate extension description and write it to :attr:`sys.stdout`.
@@ -172,7 +172,7 @@ def describe(self, args):
except:
die("failed to describe extension: %s" % sys.exc_info()[1])
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def _setExtensionUrl(self, project, name, value):
name = "EXTENSION_%s" % name
@@ -194,7 +194,7 @@ def _setExtensionUrl(self, project, name, value):
project.setValue(name, value)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def publish(self, args):
"""Publish extension to github repository.
@@ -320,7 +320,7 @@ def publish(self, args):
except:
die("failed to publish extension: %s" % sys.exc_info()[1])
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def _extensionIndexCommitMessage(self, name, description, update, wrap=True):
args = description.__dict__
args["name"] = name
@@ -354,7 +354,7 @@ def _extensionIndexCommitMessage(self, name, description, update, wrap=True):
return template % args
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def contribute(self, args):
"""Add or update an extension to/in the index repository.
@@ -603,7 +603,7 @@ def contribute(self, args):
except:
die("failed to register extension: %s" % sys.exc_info()[1])
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def _execute(self, args):
# Set up arguments
parser = argparse.ArgumentParser(description="Slicer Wizard",
@@ -682,8 +682,8 @@ def _execute(self, args):
scriptPath = os.path.dirname(os.path.realpath(__file__))
candidateBuiltInTemplatePaths = [
- os.path.join(scriptPath, "..", "..", "..", "Utilities", "Templates"), # Run from source directory
- os.path.join(scriptPath, "..", "..", "..", "share", # Run from install
+ os.path.join(scriptPath, "..", "..", "..", "Utilities", "Templates"), # Run from source directory
+ os.path.join(scriptPath, "..", "..", "..", "share", # Run from install
"Slicer-%s.%s" % tuple(__version_info__[:2]),
"Wizard", "Templates")
]
@@ -740,7 +740,7 @@ def _execute(self, args):
if not acted:
die(("no action was requested!", "", parser.format_usage().rstrip()))
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def execute(self, *args, **kwargs):
"""execute(*args, exit=True, **kwargs)
Execute the wizard in |CLI| mode.
diff --git a/Utilities/Scripts/SlicerWizard/GithubHelper.py b/Utilities/Scripts/SlicerWizard/GithubHelper.py
index ed5ffba18f8..bd59cf084cc 100644
--- a/Utilities/Scripts/SlicerWizard/GithubHelper.py
+++ b/Utilities/Scripts/SlicerWizard/GithubHelper.py
@@ -17,9 +17,9 @@
]
-#=============================================================================
+# =============================================================================
class _CredentialToken:
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, text=None, **kwargs):
# Set attributes from named arguments
self._keys = set(kwargs.keys())
@@ -34,14 +34,14 @@ def __init__(self, text=None, **kwargs):
self._keys.add(t[0])
setattr(self, t[0], t[1])
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __str__(self):
# Return string representation suitable for being fed to 'git credential'
lines = [f"{k}={getattr(self, k)}" for k in self._keys]
return "%s\n\n" % "\n".join(lines)
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def _credentials(client, request, action="fill"):
# Set up and execute 'git credential' process, passing stringized token to
# the process's stdin
@@ -57,7 +57,7 @@ def _credentials(client, request, action="fill"):
return _CredentialToken(out.decode())
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def logIn(repo=None):
"""Create github session.
@@ -109,7 +109,7 @@ def logIn(repo=None):
return session
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def getRepo(session, name=None, url=None):
"""Get a github repository by name or URL.
@@ -179,7 +179,7 @@ def getRepo(session, name=None, url=None):
return None
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def getFork(user, upstream, create=False):
"""Get user's fork of the specified repository.
@@ -237,7 +237,7 @@ def getFork(user, upstream, create=False):
return None
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def getPullRequest(upstream, ref, user=None, fork=None, target=None):
"""Get pull request for the specified user's fork and ref.
diff --git a/Utilities/Scripts/SlicerWizard/Subversion.py b/Utilities/Scripts/SlicerWizard/Subversion.py
index f70bffc5315..07206303e72 100644
--- a/Utilities/Scripts/SlicerWizard/Subversion.py
+++ b/Utilities/Scripts/SlicerWizard/Subversion.py
@@ -11,7 +11,7 @@
]
-#=============================================================================
+# =============================================================================
class CommandError(Exception):
"""
.. attribute:: command
@@ -27,7 +27,7 @@ class CommandError(Exception):
Raw text of the command's standard error stream.
"""
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, command, code, stderr):
super(Exception, self).__init__("%r command exited with non-zero status" %
command[0])
@@ -36,7 +36,7 @@ def __init__(self, command, code, stderr):
self.stderr = stderr
-#=============================================================================
+# =============================================================================
class Client:
"""Wrapper for executing the ``svn`` process.
@@ -50,11 +50,11 @@ class Client:
c.log('.', limit=5)
"""
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, repo=None):
self._wc_root = repo.wc_root if repo is not None else None
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __getattr__(self, name):
"""Return a lambda to invoke the svn command ``name``."""
@@ -64,7 +64,7 @@ def __getattr__(self, name):
return lambda *args, **kwargs: self.execute(name, *args, **kwargs)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def execute(self, command, *args, **kwargs):
"""Execute ``command`` and return line-split output.
@@ -107,7 +107,7 @@ def execute(self, command, *args, **kwargs):
return out.split("\n")
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def info(self, *args, **kwargs):
"""Return information about the specified item.
@@ -139,7 +139,7 @@ def info(self, *args, **kwargs):
return result
-#=============================================================================
+# =============================================================================
class Repository:
"""Abstract representation of a subversion repository.
@@ -179,7 +179,7 @@ class Repository:
root.
"""
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, path=os.getcwd()):
"""
:param path: Location of the repository checkout.
diff --git a/Utilities/Scripts/SlicerWizard/TemplateManager.py b/Utilities/Scripts/SlicerWizard/TemplateManager.py
index 37e4958e189..cd63a34eaf7 100644
--- a/Utilities/Scripts/SlicerWizard/TemplateManager.py
+++ b/Utilities/Scripts/SlicerWizard/TemplateManager.py
@@ -27,7 +27,7 @@
]
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def _isSourceFile(name):
for pat in _sourcePatterns:
if fnmatch.fnmatch(name, pat):
@@ -36,7 +36,7 @@ def _isSourceFile(name):
return False
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def _isTemplateCategory(name, relPath):
if not os.path.isdir(os.path.join(relPath, name)):
return False
@@ -45,16 +45,16 @@ def _isTemplateCategory(name, relPath):
return name in _templateCategories
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def _listSources(directory):
for root, subFolders, files in os.walk(directory):
for f in files:
if _isSourceFile(f):
f = os.path.join(root, f)
- yield f[len(directory) + 1:] # strip common dir
+ yield f[len(directory) + 1:] # strip common dir
-#=============================================================================
+# =============================================================================
class TemplateManager:
"""Template collection manager.
@@ -62,7 +62,7 @@ class TemplateManager:
using that collection.
"""
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self):
self._paths = {}
self._keys = {}
@@ -70,14 +70,14 @@ def __init__(self):
for c in _templateCategories:
self._paths[c] = {}
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def _getKey(self, kind):
if kind in self._keys:
return self._keys[kind]
return "TemplateKey"
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def _copyAndReplace(self, inFile, template, destination, key, name):
outFile = os.path.join(destination, inFile.replace(key, name))
logging.info("creating '%s'" % outFile)
@@ -119,7 +119,7 @@ def _copyAndReplace(self, inFile, template, destination, key, name):
with open(outFile, "wb") as fp:
fp.write(contents)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def copyTemplate(self, destination, category, kind, name, createInSubdirectory=True, requireEmptyDirectory=True):
"""Copy (instantiate) a template.
@@ -179,7 +179,7 @@ def copyTemplate(self, destination, category, kind, name, createInSubdirectory=T
return destination
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def addCategoryPath(self, category, path):
"""Add templates for a particular category to the collection.
@@ -203,7 +203,7 @@ def addCategoryPath(self, category, path):
if os.path.isdir(entryPath):
self._paths[category][entry.lower()] = entryPath
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def addPath(self, basePath):
"""Add a template path to the collection.
@@ -225,7 +225,7 @@ def addPath(self, basePath):
if _isTemplateCategory(entry, basePath):
self.addCategoryPath(entry.lower(), os.path.join(basePath, entry))
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def setKey(self, name, value):
"""Set template key for specified template.
@@ -246,7 +246,7 @@ def setKey(self, name, value):
self._keys[name] = value
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
@classmethod
def categories(cls):
"""Get list of known template categories.
@@ -258,7 +258,7 @@ def categories(cls):
return list(_templateCategories)
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def templates(self, category=None):
"""Get collection of available templates.
@@ -289,7 +289,7 @@ def templates(self, category=None):
else:
return tuple(self._paths[category].keys())
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def listTemplates(self):
"""List available templates.
@@ -312,7 +312,7 @@ def listTemplates(self):
logging.info("")
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def addArguments(self, parser):
"""Add template manager |CLI| arguments to parser.
@@ -341,7 +341,7 @@ def addArguments(self, parser):
help="set template substitution key for specified"
" template (default key: 'TemplateKey')")
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def parseArguments(self, args):
"""Automatically add paths and keys from |CLI| arguments.
diff --git a/Utilities/Scripts/SlicerWizard/Utilities.py b/Utilities/Scripts/SlicerWizard/Utilities.py
index 2c237a9d1b4..3b20bde3af7 100644
--- a/Utilities/Scripts/SlicerWizard/Utilities.py
+++ b/Utilities/Scripts/SlicerWizard/Utilities.py
@@ -7,7 +7,7 @@
import textwrap
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def haveGit():
"""Return True if git is available.
@@ -56,9 +56,9 @@ def haveGit():
_logLevel = None
-#=============================================================================
+# =============================================================================
class _LogWrapFormatter(logging.Formatter):
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self):
super().__init__()
try:
@@ -66,24 +66,24 @@ def __init__(self):
except:
self._width = 79
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def format(self, record):
lines = super().format(record).split("\n")
return "\n".join([textwrap.fill(l, self._width) for l in lines])
-#=============================================================================
+# =============================================================================
class _LogReverseLevelFilter(logging.Filter):
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, levelLimit):
self._levelLimit = levelLimit
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def filter(self, record):
return record.levelno < self._levelLimit
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def _log(func, msg):
if sys.exc_info()[0] is not None:
if _logLevel <= logging.DEBUG:
@@ -97,7 +97,7 @@ def _log(func, msg):
func(msg)
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def warn(msg):
"""Output a warning message (or messages), with exception if present.
@@ -117,7 +117,7 @@ def warn(msg):
_log(logging.warning, msg)
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def die(msg, exitCode=1):
"""Output an error message (or messages), with exception if present.
@@ -136,7 +136,7 @@ def die(msg, exitCode=1):
sys.exit(exitCode)
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def inquire(msg, choices=_yesno):
"""Get multiple-choice input from the user.
@@ -186,7 +186,7 @@ def throw(*args):
pass
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def initLogging(logger, args):
"""Initialize logging.
@@ -229,7 +229,7 @@ def initLogging(logger, args):
ghLogger.setLevel(logging.WARNING)
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def detectEncoding(data):
"""Attempt to determine the encoding of a byte sequence.
@@ -253,14 +253,14 @@ def detectEncoding(data):
return result["encoding"], result["confidence"]
else:
- chars = ''.join(map(chr, list(range(7,14)) + list(range(32, 128))))
+ chars = ''.join(map(chr, list(range(7, 14)) + list(range(32, 128))))
if len(data.translate(None, chars)):
return None, 0.0
return "ascii", 1.0
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def buildProcessArgs(*args, **kwargs):
"""Build |CLI| arguments from Python-like arguments.
@@ -306,7 +306,7 @@ def buildProcessArgs(*args, **kwargs):
return result + ["%s" % a for a in args if a is not None]
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def createEmptyRepo(path, tool=None):
"""Create a repository in an empty or nonexistent location.
@@ -346,7 +346,7 @@ def createEmptyRepo(path, tool=None):
return git.Repo.init(path)
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
class SourceTreeDirectory:
"""Abstract representation of a source tree directory.
@@ -358,7 +358,7 @@ class SourceTreeDirectory:
The relative path to the source directory.
"""
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def __init__(self, root, relative_directory):
"""
@@ -378,7 +378,7 @@ def __init__(self, root, relative_directory):
self.relative_directory = relative_directory
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def getRepo(path, tool=None, create=False):
"""Obtain a git repository for the specified path.
@@ -447,7 +447,7 @@ def getRepo(path, tool=None, create=False):
return None
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def getRemote(repo, urls, create=None):
"""Get the remote matching a URL.
@@ -496,7 +496,7 @@ def getRemote(repo, urls, create=None):
return None
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def localRoot(repo):
"""Get top level local directory of a repository.
@@ -524,7 +524,7 @@ def localRoot(repo):
raise Exception("unable to determine repository local root")
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def vcsPrivateDirectory(repo):
"""Get |VCS| private directory of a repository.
diff --git a/Utilities/Scripts/SlicerWizard/WizardHelpFormatter.py b/Utilities/Scripts/SlicerWizard/WizardHelpFormatter.py
index c4c9f39d988..fe88bcc8b7a 100644
--- a/Utilities/Scripts/SlicerWizard/WizardHelpFormatter.py
+++ b/Utilities/Scripts/SlicerWizard/WizardHelpFormatter.py
@@ -1,7 +1,7 @@
import argparse
-#=============================================================================
+# =============================================================================
class WizardHelpFormatter(argparse.HelpFormatter):
"""Custom formatter for |CLI| arguments.
@@ -12,12 +12,12 @@ class WizardHelpFormatter(argparse.HelpFormatter):
raises an assertion).
"""
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def _format_action_invocation(self, *args):
text = super()._format_action_invocation(*args)
return text.replace("<", "[").replace(">", "]")
- #---------------------------------------------------------------------------
+ # ---------------------------------------------------------------------------
def _format_usage(self, *args):
text = super()._format_usage(*args)
return text.replace("<", "[").replace(">", "]")
diff --git a/Utilities/Scripts/SlicerWizard/doc/conf.py b/Utilities/Scripts/SlicerWizard/doc/conf.py
index 3f650806c50..553f3506d7e 100644
--- a/Utilities/Scripts/SlicerWizard/doc/conf.py
+++ b/Utilities/Scripts/SlicerWizard/doc/conf.py
@@ -24,14 +24,14 @@
# documentation root, use os.path.abspath to make it absolute, like shown here.
sys.path.insert(0, os.path.abspath(os.path.join('..', '..')))
-#%%% Site extensions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+# %%% Site extensions %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-#===============================================================================
+# ===============================================================================
class WikidocRole:
wiki_root = 'https://wiki.slicer.org/slicerWiki/index.php'
- #-----------------------------------------------------------------------------
+ # -----------------------------------------------------------------------------
def __call__(self, role, rawtext, text, lineno, inliner,
options={}, content=[]):
@@ -46,9 +46,9 @@ def __call__(self, role, rawtext, text, lineno, inliner,
return [node], []
-#===============================================================================
+# ===============================================================================
class ClassModuleClassDocumenter(autodoc.ClassDocumenter):
- #-----------------------------------------------------------------------------
+ # -----------------------------------------------------------------------------
def resolve_name(self, *args):
module, attrs = super().resolve_name(*args)
module = module.split('.')
@@ -56,16 +56,16 @@ def resolve_name(self, *args):
del module[-1]
return '.'.join(module), attrs
-#%%% Site customizations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+# %%% Site customizations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-#-------------------------------------------------------------------------------
+# -------------------------------------------------------------------------------
def setup(app):
app.add_autodocumenter(ClassModuleClassDocumenter)
app.add_role('wikidoc', WikidocRole())
-#-------------------------------------------------------------------------------
+# -------------------------------------------------------------------------------
autoclass_content = 'both'
autodoc_member_order = 'groupwise'
@@ -79,10 +79,10 @@ def setup(app):
setattr(WikidocRole, 'wiki_doc_version', args.wikidoc_version)
-#%%% General configuration %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+# %%% General configuration %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# If your documentation needs a minimal Sphinx version, state it here.
-#needs_sphinx = '1.0'
+# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
@@ -103,7 +103,7 @@ def setup(app):
source_suffix = '.rst'
# The encoding of source files.
-#source_encoding = 'utf-8-sig'
+# source_encoding = 'utf-8-sig'
# The master toctree document.
master_doc = 'index'
@@ -120,44 +120,44 @@ def setup(app):
# The short X.Y version.
version = args.version
# The full version, including alpha/beta/rc tags.
-release = args.version # FIXME?
+release = args.version # FIXME?
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
-#language = None
+# language = None
# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
-#today = ''
+# today = ''
# Else, today_fmt is used as the format for a strftime call.
-#today_fmt = '%B %d, %Y'
+# today_fmt = '%B %d, %Y'
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['_build']
# The reST default role (used for this markup: `text`) to use for all documents.
-#default_role = None
+# default_role = None
# If true, '()' will be appended to :func: etc. cross-reference text.
-#add_function_parentheses = True
+# add_function_parentheses = True
# If true, the current module name will be prepended to all description
# unit titles (such as .. function::).
-#add_module_names = True
+# add_module_names = True
# If true, sectionauthor and moduleauthor directives will be shown in the
# output. They are ignored by default.
-#show_authors = False
+# show_authors = False
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
# A list of ignored prefixes for module index sorting.
-#modindex_common_prefix = []
+# modindex_common_prefix = []
-#%%% Options for HTML output %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+# %%% Options for HTML output %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
@@ -166,88 +166,88 @@ def setup(app):
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
-#html_theme_options = {}
+# html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory.
-#html_theme_path = []
+# html_theme_path = []
# The name for this set of Sphinx documents. If None, it defaults to
# " v documentation".
-#html_title = None
+# html_title = None
# A shorter title for the navigation bar. Default is the same as html_title.
-#html_short_title = None
+# html_short_title = None
# The name of an image file (relative to this directory) to place at the top
# of the sidebar.
-#html_logo = None
+# html_logo = None
# The name of an image file (within the static path) to use as favicon of the
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
# pixels large.
-#html_favicon = None
+# html_favicon = None
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
-#html_static_path = ['_static']
+# html_static_path = ['_static']
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
# using the given strftime format.
-#html_last_updated_fmt = '%b %d, %Y'
+# html_last_updated_fmt = '%b %d, %Y'
# If true, SmartyPants will be used to convert quotes and dashes to
# typographically correct entities.
-#html_use_smartypants = True
+# html_use_smartypants = True
# Custom sidebar templates, maps document names to template names.
-#html_sidebars = {}
+# html_sidebars = {}
# Additional templates that should be rendered to pages, maps page names to
# template names.
-#html_additional_pages = {}
+# html_additional_pages = {}
# If false, no module index is generated.
-#html_domain_indices = True
+# html_domain_indices = True
# If false, no index is generated.
-#html_use_index = True
+# html_use_index = True
# If true, the index is split into individual pages for each letter.
-#html_split_index = False
+# html_split_index = False
# If true, links to the reST sources are added to the pages.
-#html_show_sourcelink = True
+# html_show_sourcelink = True
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
-#html_show_sphinx = True
+# html_show_sphinx = True
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
-#html_show_copyright = True
+# html_show_copyright = True
# If true, an OpenSearch description file will be output, and all pages will
# contain a tag referring to it. The value of this option must be the
# base URL from which the finished HTML is served.
-#html_use_opensearch = ''
+# html_use_opensearch = ''
# This is the file name suffix for HTML files (e.g. ".xhtml").
-#html_file_suffix = None
+# html_file_suffix = None
# Output file base name for HTML help builder.
htmlhelp_basename = 'SlicerWizarddoc'
-#%%% Options for LaTeX output %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+# %%% Options for LaTeX output %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
-#'papersize': 'letterpaper',
+# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
-#'pointsize': '10pt',
+# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
-#'preamble': '',
+# 'preamble': '',
}
# Grouping the document tree into LaTeX files. List of tuples
@@ -259,26 +259,26 @@ def setup(app):
# The name of an image file (relative to this directory) to place at the top of
# the title page.
-#latex_logo = None
+# latex_logo = None
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
-#latex_use_parts = False
+# latex_use_parts = False
# If true, show page references after internal links.
-#latex_show_pagerefs = False
+# latex_show_pagerefs = False
# If true, show URL addresses after external links.
-#latex_show_urls = False
+# latex_show_urls = False
# Documents to append as an appendix to all manuals.
-#latex_appendices = []
+# latex_appendices = []
# If false, no module index is generated.
-#latex_domain_indices = True
+# latex_domain_indices = True
-#%%% Options for manual page output %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+# %%% Options for manual page output %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
@@ -288,10 +288,10 @@ def setup(app):
]
# If true, show URL addresses after external links.
-#man_show_urls = False
+# man_show_urls = False
-#%%% Options for Texinfo output %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+# %%% Options for Texinfo output %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
@@ -303,16 +303,16 @@ def setup(app):
]
# Documents to append as an appendix to all manuals.
-#texinfo_appendices = []
+# texinfo_appendices = []
# If false, no module index is generated.
-#texinfo_domain_indices = True
+# texinfo_domain_indices = True
# How to display URL addresses: 'footnote', 'no', or 'inline'.
-#texinfo_show_urls = 'footnote'
+# texinfo_show_urls = 'footnote'
-#%%% Options for Epub output %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+# %%% Options for Epub output %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Bibliographic Dublin Core info.
epub_title = 'SlicerWizard'
@@ -322,34 +322,34 @@ def setup(app):
# The language of the text. It defaults to the language option
# or en if the language is not set.
-#epub_language = ''
+# epub_language = ''
# The scheme of the identifier. Typical schemes are ISBN or URL.
-#epub_scheme = ''
+# epub_scheme = ''
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
-#epub_identifier = ''
+# epub_identifier = ''
# A unique identification for the text.
-#epub_uid = ''
+# epub_uid = ''
# A tuple containing the cover image and cover page html template filenames.
-#epub_cover = ()
+# epub_cover = ()
# HTML files that should be inserted before the pages created by sphinx.
# The format is a list of tuples containing the path and title.
-#epub_pre_files = []
+# epub_pre_files = []
# HTML files shat should be inserted after the pages created by sphinx.
# The format is a list of tuples containing the path and title.
-#epub_post_files = []
+# epub_post_files = []
# A list of files that should not be packed into the epub file.
-#epub_exclude_files = []
+# epub_exclude_files = []
# The depth of the table of contents in toc.ncx.
-#epub_tocdepth = 3
+# epub_tocdepth = 3
# Allow duplicate toc entries.
-#epub_tocdup = True
+# epub_tocdup = True
diff --git a/Utilities/Scripts/genqrc.py b/Utilities/Scripts/genqrc.py
index 40a8d1c55e8..5a03198e938 100755
--- a/Utilities/Scripts/genqrc.py
+++ b/Utilities/Scripts/genqrc.py
@@ -5,7 +5,7 @@
import sys
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def writeFile(path, content):
# Test if file already contains desired content
if os.path.exists(path):
@@ -22,13 +22,13 @@ def writeFile(path, content):
f.write(content)
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def addFile(path):
name = os.path.basename(path)
return [f" {path}"]
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def buildContent(root, path):
dirs = []
out = [" " % path]
@@ -53,7 +53,7 @@ def buildContent(root, path):
return out
-#-----------------------------------------------------------------------------
+# -----------------------------------------------------------------------------
def main(argv):
parser = argparse.ArgumentParser(description="PythonQt Resource Compiler")
@@ -79,7 +79,7 @@ def main(argv):
""]
for path in args.resource_directories:
- path = os.path.dirname(os.path.join(path, '.')) # remove trailing '/'
+ path = os.path.dirname(os.path.join(path, '.')) # remove trailing '/'
qrc_content += buildContent(os.path.dirname(path), os.path.basename(path))
qrc_content += [""]
@@ -93,7 +93,7 @@ def main(argv):
writeFile(args.out_path, qrc_content)
-#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if __name__ == "__main__":
main(sys.argv[1:])
diff --git a/Utilities/Scripts/qrcc.py b/Utilities/Scripts/qrcc.py
index 3f23b2a4a19..8c6199b82cc 100755
--- a/Utilities/Scripts/qrcc.py
+++ b/Utilities/Scripts/qrcc.py
@@ -60,7 +60,7 @@ def compileResources(in_path, out_file, args):
# Read data, if using a temporary file (see above)
if tmp_path is not None:
- with open(tmp_path,"rb") as tmp_file:
+ with open(tmp_path, "rb") as tmp_file:
data = tmp_file.read()
os.remove(tmp_path)
diff --git a/Utilities/Templates/Modules/Scripted/TemplateKey.py b/Utilities/Templates/Modules/Scripted/TemplateKey.py
index 19ac01bce59..013f4b87500 100644
--- a/Utilities/Templates/Modules/Scripted/TemplateKey.py
+++ b/Utilities/Templates/Modules/Scripted/TemplateKey.py
@@ -68,7 +68,7 @@ def registerSampleData():
fileNames='TemplateKey1.nrrd',
# Checksum to ensure file integrity. Can be computed by this command:
# import hashlib; print(hashlib.sha256(open(filename, "rb").read()).hexdigest())
- checksums = 'SHA256:998cb522173839c78657f4bc0ea907cea09fd04e44601f17c82ea27927937b95',
+ checksums='SHA256:998cb522173839c78657f4bc0ea907cea09fd04e44601f17c82ea27927937b95',
# This node name will be used when the data set is loaded
nodeNames='TemplateKey1'
)
@@ -82,7 +82,7 @@ def registerSampleData():
# Download URL and target file name
uris="https://github.com/Slicer/SlicerTestingData/releases/download/SHA256/1a64f3f422eb3d1c9b093d1a18da354b13bcf307907c66317e2463ee530b7a97",
fileNames='TemplateKey2.nrrd',
- checksums = 'SHA256:1a64f3f422eb3d1c9b093d1a18da354b13bcf307907c66317e2463ee530b7a97',
+ checksums='SHA256:1a64f3f422eb3d1c9b093d1a18da354b13bcf307907c66317e2463ee530b7a97',
# This node name will be used when the data set is loaded
nodeNames='TemplateKey2'
)
@@ -336,8 +336,8 @@ def process(self, inputVolume, outputVolume, imageThreshold, invert=False, showR
cliParams = {
'InputVolume': inputVolume.GetID(),
'OutputVolume': outputVolume.GetID(),
- 'ThresholdValue' : imageThreshold,
- 'ThresholdType' : 'Above' if invert else 'Below'
+ 'ThresholdValue': imageThreshold,
+ 'ThresholdType': 'Above' if invert else 'Below'
}
cliNode = slicer.cli.run(slicer.modules.thresholdscalarvolume, None, cliParams, wait_for_completion=True, update_display=showResult)
# We don't need the CLI module node anymore, remove it to not clutter the scene with it
diff --git a/Utilities/Templates/Modules/ScriptedCLI/TemplateKey.py b/Utilities/Templates/Modules/ScriptedCLI/TemplateKey.py
index 6176273552f..15e5d067030 100755
--- a/Utilities/Templates/Modules/ScriptedCLI/TemplateKey.py
+++ b/Utilities/Templates/Modules/ScriptedCLI/TemplateKey.py
@@ -22,12 +22,12 @@ def main(input, sigma, output):
image = caster.Execute(image)
writer = sitk.ImageFileWriter()
- writer.SetFileName (output)
- writer.Execute (image)
+ writer.SetFileName(output)
+ writer.Execute(image)
if __name__ == "__main__":
- if len (sys.argv) < 4:
+ if len(sys.argv) < 4:
print("Usage: TemplateKey