diff --git a/quickshear.py b/quickshear.py index 3dedc2c..b28014d 100755 --- a/quickshear.py +++ b/quickshear.py @@ -4,6 +4,53 @@ import numpy as np import nibabel as nb import logging +try: + from due import due, BibTeX +except ImportError: + # Adapted from + # https://github.com/duecredit/duecredit/blob/2221bfd/duecredit/stub.py + class InactiveDueCreditCollector(object): + """Just a stub at the Collector which would not do anything""" + def _donothing(self, *args, **kwargs): + """Perform no good and no bad""" + pass + + def dcite(self, *args, **kwargs): + """If I could cite I would""" + def nondecorating_decorator(func): + return func + return nondecorating_decorator + + cite = load = add = _donothing + + def __repr__(self): + return self.__class__.__name__ + '()' + + due = InactiveDueCreditCollector() + + def BibTeX(*args, **kwargs): + pass + +citation_text = """@inproceedings{Schimke2011, +abstract = {Data sharing offers many benefits to the neuroscience research +community. It encourages collaboration and interorganizational research +efforts, enables reproducibility and peer review, and allows meta-analysis and +data reuse. However, protecting subject privacy and implementing HIPAA +compliance measures can be a burdensome task. For high resolution structural +neuroimages, subject privacy is threatened by the neuroimage itself, which can +contain enough facial features to re-identify an individual. To sufficiently +de-identify an individual, the neuroimage pixel data must also be removed. +Quickshear Defacing accomplishes this task by effectively shearing facial +features while preserving desirable brain tissue.}, +address = {San Francisco}, +author = {Schimke, Nakeisha and Hale, John}, +booktitle = {Proceedings of the 2nd USENIX Conference on Health Security and Privacy}, +title = {{Quickshear Defacing for Neuroimages}}, +year = {2011}, +month = sep +} +""" +__version__ = '1.0.1-dev' def edge_mask(mask): @@ -102,6 +149,8 @@ def orient_xPS(img, hemi='R'): return flip_axes(data, flips), flips +@due.dcite(BibTeX(citation_text), description="Geometric neuroimage defacer", + path="quickshear") def quickshear(anat_img, mask_img, buff=10): """ Deface image using Quickshear algorithm diff --git a/setup.py b/setup.py index b32daec..7a97114 100644 --- a/setup.py +++ b/setup.py @@ -10,6 +10,7 @@ # To use a consistent encoding from codecs import open from os import path +import runpy here = path.abspath(path.dirname(__file__)) @@ -17,13 +18,15 @@ with open(path.join(here, 'README.rst'), encoding='utf-8') as f: long_description = f.read() +info = runpy.run_path("quickshear.py") + setup( name='quickshear', # Versions should comply with PEP440. For a discussion on single-sourcing # the version across setup.py and the project code, see # https://packaging.python.org/en/latest/single_source_version.html - version='1.0.1-dev', + version=info['__version__'], description='Quickshear Defacing for Neuroimages', long_description=long_description,