Ejemplo n.º 1
0
 def save_nonnodule(self, nodule_crop, store_name, mhd_store=False):
     np.save(
         os.path.join(self.nonnodule_npy_path,
                      store_name + "_nonannotation.npy"), nodule_crop)
     if mhd_store:
         mt.write_mhd_file(
             self.no_annotation_mhd_path + store_name +
             "_nonannotation.mhd", nodule_crop, nodule_crop.shape)
Ejemplo n.º 2
0
    nodule_matrix, cindex = cd.candidate_detection(segimage)
    cluster_labels = lc.seed_volume_cluster(nodule_matrix,
                                            cluster_size=30,
                                            result_vision=False)
    print('Clustering Done')
    cluster_labels_merged = lc.cluster_merge(segimage, cluster_labels)
    print('Clusters Merged')
    lc.view_segment(image, cluster_labels_merged)
    candidate_coords = lc.cluster_centers(cluster_labels)
    volume_candidated = cv.view_coordinations(image,
                                              candidate_coords,
                                              window_size=10,
                                              reverse=False,
                                              slicewise=True,
                                              show=True)
    mt.write_mhd_file(vision_path + "/" + uid + "_candidate.mhd",
                      volume_candidated, volume_candidated.shape[::-1])
    print('Candidate Done')
    exit()

    window_prehalf = int(WINDOW_SIZE / 2)
    window_afterhalf = WINDOW_SIZE - window_prehalf
    image_padded = MIN_BOUND * np.ones(
        (image.shape[0] + WINDOW_SIZE, image.shape[1] + WINDOW_SIZE,
         image.shape[2] + WINDOW_SIZE),
        dtype=int)
    image_padded[window_prehalf:window_prehalf + image.shape[0],
                 window_prehalf:window_prehalf + image.shape[1],
                 window_prehalf:window_prehalf + image.shape[2]] = image
    nodule_centers = []
    print('candidate number:%d' % (len(candidate_coords)))
    for tb in range(0, len(candidate_coords), CANDIDATE_BATCH):