def regenerateSeefloor(self): driftsStepSize = self.step_size() print "Using driftsStepSize: " + str(driftsStepSize) #TODO: extract logic in few rows into a "regenerate drafts" module/class print("regenerating/interpolating Drafts") manualDrifts = DriftManualData.createFromFile(self.__folderStruct) rawDrifts = DriftRawData(self.__folderStruct) df = rawDrifts.interpolate(manualDrifts, driftsStepSize) drifts = DriftData.createFromFolderStruct(self.__folderStruct) drifts.setDF(df) drifts.saveToFile(self.__folderStruct.getDriftsFilepath()) print("regenerating/interpolating RedDots") rdd = RedDotsData.createFromFolderStruct(self.__folderStruct) rdd.saveInterpolatedDFToFile(drifts.minFrameID(), drifts.maxFrameID() + 1) print("regenerating SeeFloor") sf = SeeFloor.createFromFolderStruct(self.__folderStruct) sf.saveToFile() print("regenerating crabs_on_seefloor") crabs = CrabsData(self.__folderStruct) crabs_on_seefloor_df = crabs.generate_crabs_on_seefloor(sf) crabs_on_seefloor_df.save_file_csv( self.__folderStruct.getCrabsOnSeefloorFilepath())
def createFromFolderStruct(folderStruct): # type: (FolderStructure) -> SeeFloorNoBadBlocks driftsData = DriftData.createFromFolderStruct(folderStruct) redDotsData = RedDotsData.createFromFolderStruct(folderStruct) filepath = folderStruct.getSeefloorFilepath() if folderStruct.fileExists(filepath): #df = pd.read_csv(filepath, delimiter="\t", na_values="(null)") df = PandasWrapper.readDataFrameFromCSV(filepath) else: df = None newObj = SeeFloorNoBadBlocks(driftsData, redDotsData, folderStruct, df) return newObj
def createFromFolderStruct(folderStruct): # type: (FolderStructure) -> SeeFloor driftsData = DriftData.createFromFolderStruct(folderStruct) badFramesData = BadFramesData.createFromFolderStruct(folderStruct) redDotsData = RedDotsData.createFromFolderStruct(folderStruct) filepath = folderStruct.getSeefloorFilepath() if folderStruct.fileExists(filepath): df = PandasWrapper.readDataFrameFromCSV(filepath) else: df = None newObj = SeeFloor(driftsData, badFramesData, redDotsData, folderStruct, df) return newObj
def refreshItself(self): self.__driftData = DriftData.createFromFolderStruct( self.__folderStruct) self.__redDotsData = RedDotsData.createFromFolderStruct( self.__folderStruct) self.saveToFile()
folderStruct = FolderStructure(rootDir, videoFileName) StreamToLogger(folderStruct.getLogFilepath()) print("Starting markCrabs script") timer = MyTimer("Starting MarkCrabs") videoStream = VideoStream(folderStruct.getVideoFilepath()) timer.lap("Initialized VideoStream") interpolator = InterpolateController(folderStruct) interpolator.regenerateSeefloor() timer.lap("Interpolated Seefloor") driftData = DriftData.createFromFolderStruct(folderStruct) timer.lap("Initialized DriftData") imageWin = ImageWindow("mainWindow", Point(700, 200)) timer.lap("Initialized ImageWindow") scientistUI = ScientistUI(imageWin, folderStruct, videoStream, driftData) timer.lap("Initialized ScientistUI") #Uncomment two lines below to get a nice summary which function uses the most time during excecution #import cProfile #cProfile.run('scientistUI.processVideo()') scientistUI.processVideo() timer.lap("Finished session")