Exemplo n.º 1
0
 def purge_previous_im(self, tar_name):
     if self.save_as_tar:
         if os.path.isfile(tar_name):
             os.remove(tar_name)
     else:
         filter = ['*.bmp', '*.png', '*.tif']
         filelist = utils.listFiles(self._saveDir, filter)
         for fileinfo in filelist:
             im_path = fileinfo.absoluteFilePath()
             os.remove(im_path)
Exemplo n.º 2
0
def load_bagging_model():
    filter = ['model*.json']
    info_list = listFiles('./saved_models/', filter)
    if len(info_list) == 0:
        raise FileNotFoundError('There is no model saved')

    estimators = []
    for file_info in info_list:
        model = load_model(file_info.baseName())
        estimators.append(model)

    bag = Bagging()
    bag.set_estimator(estimators)
    return bag
Exemplo n.º 3
0
from common import utils
from mitos_extract_anotations import candidateSelection as cs
from common.Params import Params as P


if __name__ == '__main__':
    filter = ['*.bmp', '*.png', '*.jpg']
    file_list = utils.listFiles(P().basedir + 'normalizado/testHeStain', filter)
    params = cs.Candidates_extractor_params(file_list)
    params.candidates_json_save_path = P().basedir + 'anotations/test_cand.json'
    params.save_candidates_dir_path = P().basedir + 'test/no-mitosis/'
    params.save_mitosis_dir_path = P().basedir + 'test/mitosis/'
    params.bsave_img_keypoints = True
    params.bappend_mitosis_to_json = True

    cutter = cs.Candidates_extractor(params)
    cutter.extract()
Exemplo n.º 4
0
#import sys
#sys.path.append('C:/Users/PelaoT/Desktop/Practica/codigo')

from mitos_extract_anotations import candidateSelection as cs
from common.utils import listFiles
import sys

filters = ['*.bmp', '*.png', '*.jpg']
if sys.platform == 'win32':
    file_list = listFiles(
        'C:/Users/PelaoT/Desktop/Practica/dataset/eval/heStain/', filters)
    params = cs.Candidates_extractor_params(file_list)
    params.save_candidates_dir_path = 'C:/Users/PelaoT/Desktop/Practica/dataset/eval/no-mitosis/'
    params.save_mitosis_dir_path = 'C:/Users/PelaoT/Desktop/Practica/dataset/eval/mitosis/'
    params.candidates_json_save_path = 'C:/Users/PelaoT/Desktop/Practica/dataset/eval/test.json'
else:
    file_list = listFiles('/home/facosta/dataset/normalizado/testHeStain/',
                          filters)
    params = cs.Candidates_extractor_params(file_list)
    params.save_candidates_dir_path = '/home/facosta/dataset/test/no-mitosis/'
    params.save_mitosis_dir_path = '/home/facosta/dataset/test/mitosis/'
    params.candidates_json_save_path = '/home/facosta/dataset/test//test.json'

extractor = cs.Candidates_extractor(params)
extractor.extract()

#
# import cv2
# import numpy as np
#
# def get_center(rectangle):
Exemplo n.º 5
0
        im[y,x] = 255

    #cv2.imwrite('holap.png', im)
    return im

def findCentroidsByBounRect(point):
    x,y,w,h = cv2.boundingRect(point)
    cx = int(x + (w/2))
    cy = int(y + (h/2))
    return cy, cx


baseDir = 'D:/Descargas/mitosis_evaluation_set_A/test/'
filter = ['*.csv']

fileList = utils.listFiles(baseDir, filter)
jsonDict = {}

i= 1
total = len(fileList)

for fileInfo in fileList:
    mitosRegion = []
    csvPath = fileInfo.absoluteFilePath()
    csvFile = open(csvPath)

    for line in csvFile:
        splitted = str.split(line, ',')
        point = generatePoint(splitted)
        center = findCentroidsByBounRect(point)
        pointDict = {"row" : center[0], "col" : center[1]}