semvec/pypi-packages huggingface dataset:
deepbrain 0.1
Deep Learning-based tools for processing brain images
License: MIT
Requires Python: >3.5
Keywords: deep-learning machine-learning tensorflow ai

# DeepBrain

> Brain image processing tools using Deep Learning focused on speed and accuracy.

#### Available tools:

## Extractor

![img](./imgs/extractor.png)

> Extract brain tissue from T1 Brain MRI (i.e skull stripping).

`Extractor` runs a custom U-Net model trained on a variety of manual-verified skull-stripping datasets.

### Why choose `Extractor` over others (e.g. BET FSL, ANTs, PINCRAM)?

1. `Extractor` is **fast**. It's CNN was implemented on Tensorflow and carefully designed to be as small as possible (i.e. lower amount of parameters). See below for speed comparison. You can achieve < 2 second extraction on GPU.

2. Running `Extractor` is **easy**. You don't need to provide any complicated parameters (like brain templates or prior probability masks), just with the brain MRI is enough. This is because the model was trained with a data augmentation process that involved all kind of rotations and orientations of the brain MRI. This means that the extraction will be successfull regardless the orientation of the input brain MRI. No registration process is done.

3. `Extractor` is **accurate**. It does not fail in some cases where others (specially BET) fails.

### Speed

Extractor CPU (i5 2015 MBP)          |  Extractor GPU (Nvidia TitanXP) 
:-------------------------:|:-------------------------:
~20 seconds  | ~2 seconds

### Accuracy

`Extractor` achieves state-of-the art accuracy > **0.97 Dice metric** on the test set that is compound with a subset of entries from the [CC359 dataset](https://sites.google.com/view/calgary-campinas-dataset/home), [NFBS dataset](http://preprocessed-connectomes-project.org/NFB_skullstripped/) and [ADNI dataset](http://doid.gin.g-node.org/aa605acf0f2335b9b8dfdb5c66e18f68/).

### How to run

#### As command line program

```bash
$ deepbrain-extractor -i brain_mri.nii.gz -o ~/Desktop/output/
```
Where:

* `-i`: the brain MRI that will be skull-stripped. It can be a `nii` or `nii.gz` image (or whatever format [nibabel](http://nipy.org/nibabel/) supports).
* `-o`: an output directory (does not need to exist) where the program will save the `brain_mask.nii` and `brain.nii` files.

See `deepbrain-extractor -h` for more information.

#### As python

```python
import nibabel as nb
from deepbrain import Extractor

# Load a nifti as 3d numpy image [H, W, D]
img = nib.load(img_path).get_fdata()

ext = Extractor()

# `prob` will be a 3d numpy image containing probability 
# of being brain tissue for each of the voxels in `img`
prob = ext.run(img) 

# mask can be obtained as:
mask = prob > 0.5
```

See `deepbrain-extractor -h` for more information.
adroit 0.3
Ansible Docker Role Testing
License: MIT
Requires Python: >=3.5,<4.0

# `adroit` - Ansible Docker Role Testing

Heavily opinionated tool for testing Ansible roles using Docker containers.

### Assumptions and limitations

These are the current assumptions about your Ansible codebase which might prevent you from using Adroit. They are subject to change or improve.

- You only deploy (or only want to test) on modern systems with systemd as their init system.
- You have a `base` role which other roles can build upon. (If you don't need this, you can just have an empty `roles/base` directory).
- With the exception of depending on the base role, your Ansible roles are atomic, indepentent, and can be applied individually. `include_role` and dependencies defined in `meta` should still work, though.

Feel free to open a Github issue about any limitations that prevent you from using Adroit.

### How it works

1. Adroit builds a *core image* based on your distro of choice.
2. A container based on the core image is created. The `base` role will be applied to the container, and it is saved as the *base image*.
3. For each role you want to test, a container based on the base image is started, and the role under test will be applied.

Adroit will check if the role playbook fails, and will also run the playbook a second time to test for idempotency - if there are any changes on the second run, we consider it a failure.

### Precautions

To properly test Ansible using Docker containers, systemd needs to be running inside the containers. This requires the containers to run in privileged mode. There is a security risk involved here, check your base images and playbooks accordingly.

## Usage

In a virtualenv or whatever you prefer: `pip install adroit`

In the root directory of your Ansible tree structure, which should at least contain a `roles` directory, run this command:

```bash
adroit -d debian:stretch myrole
```

Where `debian:stretch` is the image you want to base your tests on. Currently supported are Debian, Ubuntu and CentOS.

### Customizing your roles for testing

Certain tasks simply cannot be ran inside a Docker container - for example, mounting `/proc` with `hidepid=2`. You should add a `when` clause to these tasks. Example:

```yaml
- when: ansible_virtualization_type != 'docker'
  import_tasks: configure_network.yml
```

If you need certain variables to be set which aren't in `defaults` or `vars` but should be set during testing, you can create a file like `roles/myrole/testing/test_vars.yml` and it will be applied when testing that particular role.

## License

The contents of this repository is released under the [MIT license](http://opensource.org/licenses/MIT). See the LICENSE file included for details.
gtrends-tools 1.0
Interface for retrieving data from Google Health Trends API
License: MIT

# gtrends-tools
gtrends-tools provides an unofficial interface for automating the retrieval of search frequency data from the Google Health Trends API. While Google Trends has a publicly available browser tool at <http://trends.google.com/trends> with unofficial interfaces in Python [[1]](https://github.com/GeneralMills/pytrends) and R [[2]](https://github.com/PMassicotte/gtrendsR), the Google Health Trends API provides more control in selecting data, has higher download rates, and arguably returns more precise search trends. However, to use this tool, a Google Health Trends API key is required for access to Google's servers.

I hope to expand this package by adding tools for Google Correlate and methodologies for feature selection and engineering of search queries. The aim is to provide more relevant and accurate data for machine learning projects.

## Installation

To install gtrends-tools with pip, run: `pip install healthtrends`

To install gtrends-tools from source, first clone the repository and then run:
`python setup.py install`


## Usage

Here is a simple example of `gtrends-tools` usage.

```python
import healthtrends

DIR = '/home/fl16180/'

queries = ['tofu', 'exercise']

gt = healthtrends.TrendsSession(api_key='xxx')
gt.request_trends(term_list=queries, geo_level='country', geo_id='US')
gt.save_to_csv(directory=DIR, fname='healthy_trends.csv')

```

Parameters for request_trends are:
- term_list: list of search term queries
- geo_level: geographic location, one of 'country', 'region', or 'dma'
- geo_id: name of the geographic location, e.g. 'US' (country), 'US-NY' (region), '501' (dma)
- start_date: first day to download data from, in form 'YYYY-MM-DD'. Defaults to 2004-01-04.
- end_date: last day to download data from, in form 'YYYY-MM-DD'. Defaults to today's date.
- freq: time interval of data, one of 'day', 'week', 'month', 'year'. Defaults to 'week'

For additional examples, refer to the [included scripts](bin/example.py). I will add more detailed documentation of parameters later, as well as scripts to get data remotely (for IP restrictions on API access).


## Research
Search frequencies obtained from the Google Trends API using this code (or previous versions) have been an integral part of research papers including [[1]](https://publichealth.jmir.org/2018/1/e4/).

## Credits
Package structure inspired by <https://github.com/GeneralMills/pytrends>

The original Google Health Trends API script has been passed around a few times before being adapted by Andre Nguyen and passed to me. I don't know what the original source is but have seen duplicate of the original script in other github repos. As such, I felt that converting it into a package with OOP interface would best facilitate scientific sharing of research methods.