-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
analyzin pixel spacings and pickled dict with pixel spaces and pids a…
…s key
- Loading branch information
1 parent
cc08953
commit d981056
Showing
3 changed files
with
19,231 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import cPickle as pickle | ||
import string | ||
import sys | ||
import time | ||
from itertools import izip | ||
import numpy as np | ||
from datetime import datetime, timedelta | ||
import utils | ||
import utils_lung | ||
import logger | ||
import buffering | ||
import pathfinder | ||
import data_iterators | ||
|
||
|
||
candidates_config = 'dsb_c3_s5_p8a1' | ||
predictions_dir = utils.get_dir_path('model-predictions', pathfinder.METADATA_PATH) | ||
candidates_path = predictions_dir + '/%s' % candidates_config | ||
id2candidates_path = utils_lung.get_candidates_paths(candidates_path) | ||
|
||
train_valid_ids = utils.load_pkl(pathfinder.VALIDATION_SPLIT_PATH) | ||
train_pids, valid_pids, test_pids = train_valid_ids['training'], train_valid_ids['validation'], train_valid_ids['test'] | ||
all_pids = train_pids + valid_pids + test_pids | ||
|
||
data_iterator = data_iterators.DSBPixelSpacingsGenerator(pathfinder.DATA_PATH, id2candidates_path, all_pids) | ||
|
||
|
||
z = [] | ||
y = [] | ||
x = [] | ||
pixel_spacings = {} | ||
|
||
# use buffering.buffered_gen_threaded() | ||
for idx, (pid, pixel_spacing) in enumerate(data_iterator.generate()): | ||
print idx, pid, pixel_spacing | ||
z.append(pixel_spacing[0]) | ||
y.append(pixel_spacing[1]) | ||
x.append(pixel_spacing[2]) | ||
pixel_spacings[pid] = pixel_spacing | ||
|
||
|
||
utils.save_pkl(pixel_spacings, 'pixel_spacings_dsb.pkl') | ||
print 'z', min(z), max(z) | ||
print 'y', min(y), max(y) | ||
print 'x', min(x), max(x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.