Пример #1
0
def visualize_ori(cid, model_path):
    seg = load_segmentation(cid)
    visualize(cid,
              seg,
              os.path.join(model_path, 'pics',
                           str(cid).zfill(5) + '_gt'),
              ori=True)
Пример #2
0
def visualize_case(case_result, model_path, case_id):
    visualize(case_id,
              case_result,
              os.path.join(model_path, 'pics',
                           str(case_id).zfill(5) + '_pred'),
              ori=False,
              k_color=MAGENTA_RGB,
              t_color=CYAN_RGB)
Пример #3
0
from pathlib import Path
import os.path
import sys

sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from configs import config
from tqdm import tqdm

from starter_code import utils
from starter_code import visualize

DATAPATH = config.ORIGINAL_DATA

if __name__ == '__main__':

    for idx in tqdm(range(210)):
        visualize.visualize(
            idx,
            DATAPATH + 'visualization-perspectives/case_{:05d}'.format(idx),
            data_path=Path(DATAPATH),
            separate=True,
            plane='all')
Пример #4
0
# Código para el proyecto de imágenes
# Este starter code lo proporciona el mismo repositorio del challenge
import nibabel as nib
from starter_code.utils import load_case
from starter_code.visualize import visualize

volume, segmentation = load_case(0)
visualize("case_00003", im1)

from win32com.client import Dispatch

o = Dispatch("ThunderAgent.Agent64.1")
for i in range(210):
    url1 = 'https://media.githubusercontent.com/media/neheller/kits19/master/data/case_%05d/imaging.nii.gz' % i
    url2 = 'https://media.githubusercontent.com/media/neheller/kits19/master/data/case_%05d/segmentation.nii.gz' % i
    filename1 = 'imaging_%03d.nii.gz' % i
    filename2 = 'segmentation_%03d.nii.gz' % i
    o.AddTask(url1, filename1)
    o.AddTask(url2, filename2)
o.CommitTasks()

# %%
Пример #5
0
def visualize_from_pred(cid, model_path, path='./predictions'):
    file_name = 'prediction_00' + str(cid) + '.nii.gz'
    pred = nib.load(os.path.join(path, file_name))
    pred = pred.get_fdata().copy()

    visualize(cid, pred, os.path.join(model_path, 'pics'), ori=False)
Пример #6
0
def GenerateEvaluationpng(input_path, output_path):
    for i in range(50):
        name = "case_{:05d}".format(i + 160)
        visualize(name, input_path, output_path)
Пример #7
0
def GenerateTrainpng(input_path, output_path):
    for i in range(160):
        name = "case_{:05d}".format(i)
        visualize(name, input_path, output_path)
Пример #8
0
seg_data[seg_data == 2] = 1

a = int(math.ceil(len(pred_seg) / 48))

pred_seg = np.reshape(pred_seg, (a, 48, 128, 128, 1))

pred_seg = concat_3Dmatrices(pred_seg,
                             image_size=vol_data.shape,
                             window=(48, 128, 128),
                             overlap=(12, 32, 32))

if not os.path.exists("predictions"):
    os.mkdir("predictions")

nifti = nib.Nifti1Image(pred_seg, None)

nib.save(
    nifti,
    os.path.join("predictions",
                 "prediction_" + str(cases[0]).zfill(5) + ".nii.gz"))

pred_seg = pred_seg[:, :, :, 0]

pred_seg[pred_seg <= 0.5] = 0

pred_seg[pred_seg > 0.5] = 1

visualize(vol_data, pred_seg, "evaluation")

visualize(vol_data, seg_data, "evaluation")
Пример #9
0
from preprocessing import preprocessing
from find_and_save_kidneys import find_and_save_kidneys
from save_to_png import save_to_png
import re
from skimage.transform import resize
from get_new_seeds import get_new_seeds

case_num = input("Please enter a case number:\n")

data_path = "case_" + case_num.zfill(5)
image_path = "case" + case_num

out_path = Path(image_path)
if not out_path.exists():
    visualize(data_path, image_path,
              t_color=[0, 255,
                       0])  #konwersja danych z repozytorium do obrazów .png

image, name, colour = find_image_with_kidneys(image_path + '/*[0-9].png')

image_rgb = io.imread(name)
image = (color.rgb2gray(image_rgb))

p = '[\d]+[\d]+[\d]+[\d]+[\d]'
if re.search(p, name) is not None:
    for catch in re.finditer(p, name):
        number = int(catch[0])

image_clear, crop = preprocessing(image)
image_rectangle = np.zeros((512, 512))
image_rectangle[200:450, 80:231] = 1
Пример #10
0
#zmiana working directory na folder zawierajacy zdjecie
import os
os.chdir('/Users/komala/Desktop/TOM_projekt/kits19')

from starter_code.utils import load_case
from starter_code.visualize import visualize

volume, segmentation = load_case("case_00000")
visualize("case_00000", "pictures")