|
4 | 4 | import numpy as np |
5 | 5 | import nibabel as nb |
6 | 6 | import logging |
| 7 | +try: |
| 8 | + from due import due, BibTeX |
| 9 | +except ImportError: |
| 10 | + # Adapted from |
| 11 | + # https://github.com/duecredit/duecredit/blob/2221bfd/duecredit/stub.py |
| 12 | + class InactiveDueCreditCollector(object): |
| 13 | + """Just a stub at the Collector which would not do anything""" |
| 14 | + def _donothing(self, *args, **kwargs): |
| 15 | + """Perform no good and no bad""" |
| 16 | + pass |
| 17 | + |
| 18 | + def dcite(self, *args, **kwargs): |
| 19 | + """If I could cite I would""" |
| 20 | + def nondecorating_decorator(func): |
| 21 | + return func |
| 22 | + return nondecorating_decorator |
| 23 | + |
| 24 | + cite = load = add = _donothing |
| 25 | + |
| 26 | + def __repr__(self): |
| 27 | + return self.__class__.__name__ + '()' |
| 28 | + |
| 29 | + due = InactiveDueCreditCollector() |
| 30 | + |
| 31 | + def BibTeX(*args, **kwargs): |
| 32 | + pass |
| 33 | + |
| 34 | +citation_text = """@inproceedings{Schimke2011, |
| 35 | +abstract = {Data sharing offers many benefits to the neuroscience research |
| 36 | +community. It encourages collaboration and interorganizational research |
| 37 | +efforts, enables reproducibility and peer review, and allows meta-analysis and |
| 38 | +data reuse. However, protecting subject privacy and implementing HIPAA |
| 39 | +compliance measures can be a burdensome task. For high resolution structural |
| 40 | +neuroimages, subject privacy is threatened by the neuroimage itself, which can |
| 41 | +contain enough facial features to re-identify an individual. To sufficiently |
| 42 | +de-identify an individual, the neuroimage pixel data must also be removed. |
| 43 | +Quickshear Defacing accomplishes this task by effectively shearing facial |
| 44 | +features while preserving desirable brain tissue.}, |
| 45 | +address = {San Francisco}, |
| 46 | +author = {Schimke, Nakeisha and Hale, John}, |
| 47 | +booktitle = {Proceedings of the 2nd USENIX Conference on Health Security and Privacy}, |
| 48 | +title = {{Quickshear Defacing for Neuroimages}}, |
| 49 | +year = {2011}, |
| 50 | +month = sep |
| 51 | +} |
| 52 | +""" |
| 53 | +__version__ = '1.0.1-dev' |
7 | 54 |
|
8 | 55 |
|
9 | 56 | def edge_mask(mask): |
@@ -102,6 +149,8 @@ def orient_xPS(img, hemi='R'): |
102 | 149 | return flip_axes(data, flips), flips |
103 | 150 |
|
104 | 151 |
|
| 152 | +@due.dcite(BibTeX(citation_text), description="Geometric neuroimage defacer", |
| 153 | + path="quickshear") |
105 | 154 | def quickshear(anat_img, mask_img, buff=10): |
106 | 155 | """ Deface image using Quickshear algorithm |
107 | 156 |
|
|
0 commit comments