def CreateDB(self, Folder): Files = self.MatchedFiles[Folder] db_path = os.path.sep.join(Folder.split(os.path.sep)[:-1] + [""]) db_name = self.name_from_path(Folder) db = DataFileExtended(db_path + db_name + ".cdb", "w") path = db.setPath(Folder) idx_dict = {} for file in Files: # self.Bar2.setValue(self.Bar2.value()+1) self.Bar2.increase() # QtGui.QApplication.processEvents() QtGui.QGuiApplication.processEvents() layer = self.layer_dict[[ k for k in self.layer_dict if file.count(k) ][0]] time = datetime.datetime.strptime( file.split("_")[0], "%Y%m%d-%H%M%S") idx = int([k[3:] for k in file.split("_") if k.count("rep")][0]) if len(idx_dict) < 1: idx_dict.update({idx: 0}) elif idx not in idx_dict: idx_dict.update({idx: max(idx_dict.values()) + 1}) image = db.setImage(filename=file, path=path, layer=layer, timestamp=time) # , frame=int(idx)) image.sort_index = idx #idx_dict[idx] image.save()
def CreateDB(path, files, progress_bar = None): Folder = os.path.normpath(path) Files = [os.path.normpath(f) for f in files] db_path = os.path.sep.join(Folder.split(os.path.sep)[:-1]+[""]) db_name = name_from_path(Folder) # db_path = "/home/alex/2017-03-10_Tzellen_microwells_bestdata/T-CellMotility/2017-10-17/1_2Gel/24hnachMACS/24himGel/Kontrolle/RB/" db = DataFileExtended(db_path+db_name+".cdb", "w") path = db.setPath(Folder) idx_dict = {} for file in Files: if progress_bar is not None: progress_bar.increase() layer = LAYER_DICT[[k for k in LAYER_DICT if file.count(k)][0]] time = datetime.datetime.strptime(file.split("_")[0], "%Y%m%d-%H%M%S") idx = int([k[3:] for k in file.split("_") if k.count("rep")][0]) if len(idx_dict)<1: idx_dict.update({idx: 0}) elif idx not in idx_dict: idx_dict.update({idx: max(idx_dict.values())+1}) image = db.setImage(filename=file, path=path, layer=layer, timestamp=time) # , frame=int(idx)) image.sort_index = idx#idx_dict[idx] image.save() return db_path+db_name+".cdb"
color="#00FF00", mode=db.TYPE_Track) db.deleteMarkers(type=track_marker_type) prediction_marker_type = db.setMarkerType(name="Prediction_Marker", color="#0000FF") db.deleteMarkers(type=prediction_marker_type) # Delete Old Tracks db.deleteTracks(type=track_marker_type) # Start Iteration over Images db_path = db.setPath("") print('Starting Iteration') for i in range(T): # Prediction step, without applied control(vector of zeros) MultiKal.predict(i=i) image = db.setImage("", db_path, timestamp=i) # Detection step SegMap = TS.detect(image.data) X, Y = np.random.rand(0, 1, (2, N)) X *= arena_w Y *= arena_h print("Found %s Objects!" % len(Positions)) # Write Segmentation Mask to Database db.setMask(image=image, data=(~SegMap).astype(np.uint8)) print("Mask save") if len(Positions) > 0: # Update Filter with new Detections MultiKal.update(z=Positions, i=i)