Skip to content

Commit

Permalink
Merge pull request #6 from effigies/duecredit
Browse files Browse the repository at this point in the history
Add duecredit citation
  • Loading branch information
effigies authored May 15, 2017
2 parents 5c6ae90 + cc60678 commit 10b3699
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
49 changes: 49 additions & 0 deletions quickshear.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,23 @@
# To use a consistent encoding
from codecs import open
from os import path
import runpy

here = path.abspath(path.dirname(__file__))

# Get the long description from the README file
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,
Expand Down

0 comments on commit 10b3699

Please sign in to comment.