Пример #1
0
        image, new_spacing = mt.resample(full_scan, old_spacing)  #resample
        print('Resample Done. time:{}s'.format(time.time() - start_time))

        #make a real nodule visualization
        real_nodules = []
        for annotation in annotations:
            real_nodule = np.int_([
                (annotation[2] - origin[0]) / new_spacing[0],
                (annotation[1] - origin[1]) / new_spacing[1],
                (annotation[0] - origin[2]) / new_spacing[2]
            ])
            real_nodules.append(real_nodule)
        if 'vision_path' in dir() and 'vision_path' is not None:
            annotation_vision = cvm.view_coordinations(image,
                                                       real_nodules,
                                                       window_size=10,
                                                       reverse=False,
                                                       slicewise=False,
                                                       show=False)
            np.save(vision_path + "/" + uid + "_annotations.npy",
                    annotation_vision)

        candidate_results = nd.slic_candidate(image)
        if candidate_results is None:
            continue
        candidate_coords, candidate_labels, cluster_labels = candidate_results
        if 'vision_path' in dir() and vision_path is not None:
            np.save(vision_path + "/" + uid + "_segmask.npy", cluster_labels)
            #segresult = lc.segment_vision(image, cluster_labels)
            #np.save(vision_path + "/" + uid + "_segresult.npy", segresult)
        print('Candidate Done. time:{}s'.format(time.time() - start_time))
Пример #2
0
        image, new_spacing = mt.resample(full_scan, old_spacing)  #resample
        print('Resample Done. time:{}s'.format(time.time() - start_time))

        #make a real nodule visualization
        real_nodules = []
        for annotation in annotations:
            real_nodule = np.int_([
                (annotation[2] - origin[0]) / new_spacing[0],
                (annotation[1] - origin[1]) / new_spacing[1],
                (annotation[0] - origin[2]) / new_spacing[2]
            ])
            real_nodules.append(real_nodule)
        if 'vision_path' in dir() and 'vision_path' is not None:
            annotation_vision = cvm.view_coordinations(image,
                                                       real_nodules,
                                                       window_size=10,
                                                       reverse=False,
                                                       slicewise=False,
                                                       show=False)
            np.save(vision_path + "/" + uid + "_annotations.npy",
                    annotation_vision)

        candidate_coords = nd.luna_candidate(image, uid, origin, new_spacing,
                                             candidate_file)
        if 'vision_path' in dir() and vision_path is not None:
            volume_candidate = cvm.view_coordinations(image,
                                                      candidate_coords,
                                                      window_size=10,
                                                      reverse=False,
                                                      slicewise=False,
                                                      show=False)
            np.save(vision_path + "/" + uid + "_candidate.npy",