ultrasound_simulator_gan_model_zoo.md 3.07 KB
Newer Older
1 2
# Freehand Ultrasound Image Simulation with Spatially-Conditioned Generative Adversarial Networks

Wenqi Li's avatar
Wenqi Li committed
3
This page describes how to acquire and use the network described in
4 5 6 7 8 9

Yipeng Hu, Eli Gibson, Li-Lin Lee, Weidi Xie, Dean C. Barratt, Tom Vercauteren, J. Alison Noble
(2017). [Freehand Ultrasound Image Simulation with Spatially-Conditioned Generative Adversarial Networks](https://arxiv.org/abs/1707.05392), In MICCAI RAMBO 2017

## Downloading model zoo file and conditioning data

10
If you cloned the NiftyNet repository, the network weights and examples data can be downloaded with the command
Wenqi Li's avatar
Wenqi Li committed
11
```bash
Wenqi Li's avatar
Wenqi Li committed
12 13 14 15 16 17 18 19
net_download ultrasound_simulator_gan_model_zoo
```
(Replace `net_download` with `python net_download.py` if you cloned the NiftyNet repository.)

Alternatively, you can manually download:
- [model zoo entry](https://www.dropbox.com/s/089l4ixd2k7fiyy/ultrasound_simulator_gan_code.tar.gz?dl=1)
- [example data](https://www.dropbox.com/s/hu1i8yjdptwq6wj/ultrasound_simulator_gan_model_zoo_data.tar.gz?dl=1)
- [trained network weights](https://www.dropbox.com/s/95smm4i464nwczm/ultrasound_simulator_gan_weights.tar.gz?dl=1)
20

Wenqi Li's avatar
Wenqi Li committed
21 22 23 24
and unzip:
- `ultrasound_simulator_gan_code.tar.gz` into `~/niftynet/extensions/ultrasound_simulator_gan/`
- `ultrasound_simulator_gan_model_zoo_data.tar.gz` into `~/niftynet/data/ultrasound_simulator_gan/`
- `ultrasound_simulator_gan_weights.tar.gz` into `~/niftynet/models/ultrasound_simulator_gan/`
25

Wenqi Li's avatar
Wenqi Li committed
26
Make sure that the model directory (`~/niftynet/extensions/` by default) is on the PYTHONPATH.
27 28 29 30 31

This network generates ultrasound images conditioned by a coordinate map. Some example coordinate maps are included in the model zoo data. Additional examples are available [here](https://www.dropbox.com/s/w0frdlxaie3mndg/test_data.tar.gz?dl=0)).

## Generating segmentations for example data

Wenqi Li's avatar
Wenqi Li committed
32
Generate segmentations for the included example conditioning data with the command
Wenqi Li's avatar
Wenqi Li committed
33 34 35 36
```bash
net_gan inference -c ~/niftynet/extensions/ultrasound_simulator_gan/config.ini
```

Wenqi Li's avatar
Wenqi Li committed
37
Replace `net_segment` with `python net_gan.py` if you cloned the NiftyNet repository.
Wenqi Li's avatar
Wenqi Li committed
38 39

Replace `~/niftynet/` if you specified a custom download path in the `net_download` command.
40 41 42 43 44

## Generating segmentations for additional conditioning data

## Editing the configuration file

Wenqi Li's avatar
Wenqi Li committed
45
Make a copy of the configuration file `~/niftynet/extensions/ultrasound_simulator_gan/config.ini` to a location of your choice.
46 47 48 49 50 51 52
You may need to change the `path_to_search` and `filename_contains` lines in the configuration file to point to the correct paths for your conditioning data. You can also change the `save_seg_dir` setting to change where the segmentations are saved.

## Generating samples

Generate samples from the simulator with the command `net_gan.py inference -c edited_config.ini`, replacing `edited_config.ini` with the path to the new configuration file. Sets of simulated US images interpolated between two samples will be generated in the path specified by the `save_seg_dir` setting with names of the form `k_id_niftynet_generated.nii.gz`, where `k` is the interpolation index 0-9 and `id` is the frame code from the input conditioning data filename.