Skip to content

Commit 10b3699

Browse files
authored
Merge pull request #6 from effigies/duecredit
Add duecredit citation
2 parents 5c6ae90 + cc60678 commit 10b3699

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

quickshear.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,53 @@
44
import numpy as np
55
import nibabel as nb
66
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'
754

855

956
def edge_mask(mask):
@@ -102,6 +149,8 @@ def orient_xPS(img, hemi='R'):
102149
return flip_axes(data, flips), flips
103150

104151

152+
@due.dcite(BibTeX(citation_text), description="Geometric neuroimage defacer",
153+
path="quickshear")
105154
def quickshear(anat_img, mask_img, buff=10):
106155
""" Deface image using Quickshear algorithm
107156

setup.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,23 @@
1010
# To use a consistent encoding
1111
from codecs import open
1212
from os import path
13+
import runpy
1314

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

1617
# Get the long description from the README file
1718
with open(path.join(here, 'README.rst'), encoding='utf-8') as f:
1819
long_description = f.read()
1920

21+
info = runpy.run_path("quickshear.py")
22+
2023
setup(
2124
name='quickshear',
2225

2326
# Versions should comply with PEP440. For a discussion on single-sourcing
2427
# the version across setup.py and the project code, see
2528
# https://packaging.python.org/en/latest/single_source_version.html
26-
version='1.0.1-dev',
29+
version=info['__version__'],
2730

2831
description='Quickshear Defacing for Neuroimages',
2932
long_description=long_description,

0 commit comments

Comments
 (0)