Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add duecredit citation #6

Merged
merged 3 commits into from
May 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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