def main():
    parser = argparse.ArgumentParser(__doc__)
    parser.add_argument('data_file', help="Path to data file")
    args = parser.parse_args()

    dm = DataManager(args.data_file)

    print dm.spath('some_stack')
Example #2
0
def dthresh_and_dt(isq_filename):

    dm = DataManager(isq_filename, working_base='/Users/hartleym/working/ct_analysis')

    input_path = dm.spath('raw_stack')
    output_path = dm.spath('threshdt')
 
    def dthresh(image):
        thresh = threshold_otsu(image)
        thresholded = image > thresh
        dt = distance_transform_cdt(thresholded)
        return dt > 18

    apply_stack_transform(input_path, output_path, dthresh)
Example #3
0
def dconvert_isq_file(isq_filename):

    dm = DataManager(isq_filename)

    stack_path = dm.spath('raw_stack')

    convert_large_isq_file(isq_filename, stack_path)
Example #4
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('filename', help='Path to ISQ file')

    args = parser.parse_args()

    dm = DataManager(args.filename)

    stack = Image3D.from_path(dm.spath('stripped'))
    seed_labels = find_seed_centroids(stack)

    stage = {}
    stage['name'] = dm.name
    stage['seeds'] = seed_labels
    with open(dm.spath('seeds.yml'), 'w') as f:
        yaml.dump(stage, f)
Example #5
0
def populate_queue(queue, fn):
    dm = DataManager(fn)

    seeds_dir = dm.spath('seeds')
    isolated_dir = dm.spath('isolated_seeds')
    docker_seeds_dir = '/working/C0000230/seeds'
    docker_isolated_dir = '/working/C0000230/isolated_seeds'

    for seed_file in os.listdir(seeds_dir)[2:3]:

        input_file = os.path.join(docker_seeds_dir, seed_file)
        output_file = os.path.join(docker_isolated_dir, seed_file)

        print input_file, output_file

        command = make_command(input_file, output_file)

        subprocess.call(command)
def dcc_centroids(isq_filename):

    dm = DataManager(isq_filename, working_base='/Users/hartleym/working/ct_analysis')

    input_path = dm.spath('threshdt')

    with open('centroids.txt', 'w') as f:
        for n, image in enumerate(yield_stack_from_path(input_path)):
            centroids = find_component_centroids(image)
            for c in centroids:
                f.write("{}\n".format(c + [n]))
Example #7
0
def spikey_redis(fn):

    r = redis.StrictRedis(host='192.168.99.100')

    dm = DataManager(fn)

    seeds_dir = dm.spath('seeds')
    isolated_dir = dm.spath('isolated_seeds')
    docker_seeds_dir = '/working/C0000230/seeds'
    docker_isolated_dir = '/working/C0000230/isolated_seeds'

    prefix = 'python /code/ct_pod_analysis/scripts/isolate_single_seed.py'

    for seed_file in os.listdir(seeds_dir)[2:10]:

        input_file = os.path.join(docker_seeds_dir, seed_file)
        output_file = os.path.join(docker_isolated_dir, seed_file)

        command = "{} {} {}".format(prefix, input_file, output_file)

        r.lpush("tasks", command)