def save_log(self): if self.display_length is None: self.clear() raise LookupError("Please display sequence first!") if self.file_name is None: self._get_file_name() if self.keep_display == True: self.file_name += '-complete' elif self.keep_display == False: self.file_name += '-incomplete' # set up log object directory = os.path.join(self.log_dir, 'visual_display_log') if not (os.path.isdir(directory)): os.makedirs(directory) logFile = dict(self.seq_log) displayLog = dict(self.__dict__) displayLog.pop('seq_log') displayLog.pop('sequence') logFile.update({'presentation': displayLog}) file_name = self.file_name + ".pkl" # generate full log dictionary path = os.path.join(directory, file_name) ft.saveFile(path, logFile) print("\nLog file generated successfully. Log file path: ") print('{}'.format(path)) if self.is_save_sequence: tf.imsave(os.path.join(directory, self.file_name + '.tif'), self.sequence.astype(np.float32)) print('\nSequence file generated successfully. File path: ') print('{}'.format(os.path.join(directory, self.file_name + '.tif'))) backupFileFolder = self._get_backup_folder() if backupFileFolder is not None: if not (os.path.isdir(backupFileFolder)): os.makedirs(backupFileFolder) backupFilePath = os.path.join(backupFileFolder, file_name) ft.saveFile(backupFilePath, logFile) if self.is_save_sequence: tf.imsave( os.path.join(backupFileFolder, self.file_name + '.tif'), self.sequence.astype(np.float32)) print( "\nBackup log file generated successfully. Backup log file path: " ) print('{}'.format(backupFilePath)) else: print("\nDid not find backup path, no backup was saved.")
def save_log(self): if self.display_length is None: self.clear() raise LookupError("Please display sequence first!") if self.file_name is None: self._get_file_name() if self.keep_display == True: self.file_name += '-complete' elif self.keep_display == False: self.file_name += '-incomplete' # set up log object directory = os.path.join(self.log_dir, 'visual_display_log') if not (os.path.isdir(directory)): os.makedirs(directory) logFile = dict(self.seq_log) displayLog = dict(self.__dict__) displayLog.pop('seq_log') displayLog.pop('sequence') logFile.update({'presentation': displayLog}) file_name = self.file_name + ".pkl" # generate full log dictionary path = os.path.join(directory, file_name) ft.saveFile(path, logFile) print("\nLog file generated successfully. Log file path: ") print('{}'.format(path)) if self.is_save_sequence: tf.imsave(os.path.join(directory, self.file_name + '.tif'), self.sequence.astype(np.float32)) print('\nSequence file generated successfully. File path: ') print('{}'.format(os.path.join(directory, self.file_name + '.tif'))) backupFileFolder = self._get_backup_folder() if backupFileFolder is not None: if not (os.path.isdir(backupFileFolder)): os.makedirs(backupFileFolder) backupFilePath = os.path.join(backupFileFolder, file_name) ft.saveFile(backupFilePath, logFile) if self.is_save_sequence: tf.imsave(os.path.join(backupFileFolder, self.file_name + '.tif'), self.sequence.astype(np.float32)) print("\nBackup log file generated successfully. Backup log file path: ") print('{}'.format(backupFilePath)) else: print("\nDid not find backup path, no backup was saved.")
def save_log(self): if self.display_length is None: self.clear() raise LookupError, "Please display sequence first!" if self.file_name is None: self._get_file_name() if self.keep_display == True: self.file_name += '-complete' elif self.keep_display == False: self.file_name += '-incomplete' #set up log object directory = self.log_dir + '\sequence_display_log' if not (os.path.isdir(directory)): os.makedirs(directory) logFile = dict(self.seq_log) displayLog = dict(self.__dict__) displayLog.pop('seq_log') displayLog.pop('sequence') logFile.update({'presentation': displayLog}) file_name = self.file_name + ".pkl" #generate full log dictionary path = os.path.join(directory, file_name) ft.saveFile(path, logFile) print ".pkl file generated successfully." backupFileFolder = self._get_backup_folder() if backupFileFolder is not None: if not (os.path.isdir(backupFileFolder)): os.makedirs(backupFileFolder) backupFilePath = os.path.join(backupFileFolder, file_name) ft.saveFile(backupFilePath, logFile) print ".pkl backup file generate successfully" else: print "did not find backup path, no backup has been saved."
'signMapFilterSigma': 9., 'signMapThr': 0.3, 'eccMapFilterSigma': 15.0, 'splitLocalMinCutStep': 10., 'closeIter': 3, 'openIter': 3, 'dilationIter': 15, 'borderWidth': 1, 'smallPatchThr': 100, 'visualSpacePixelSize': 0.5, 'visualSpaceCloseIter': 15, 'splitOverlapThr': 1.1, 'mergeOverlapThr': 0.1 } currFolder = os.path.dirname(os.path.realpath(__file__)) os.chdir(currFolder) trial = rm.loadTrial(trialName) trial.params = params trial.processTrial(isPlot=True) trialDict = trial.generateTrialDict() trial.plotTrial(isSave=isSave, saveFolder=currFolder) plt.show() if isSave: ft.saveFile(trial.getName() + '.pkl', trialDict)
'splitLocalMinCutStep': 10., 'closeIter': 3, 'openIter': 3, 'dilationIter': 15, 'borderWidth': 1, 'smallPatchThr': 100, 'visualSpacePixelSize': 0.5, 'visualSpaceCloseIter': 15, 'splitOverlapThr': 1.1, 'mergeOverlapThr': 0.1 } currFolder = os.path.dirname(os.path.realpath(__file__)) os.chdir(currFolder) trial = rm.loadTrial(trialName) trial.params=params trial.processTrial(isPlot=True) trialDict = trial.generateTrialDict() trial.plotTrial(isSave=isSave,saveFolder=currFolder) plt.show() if isSave: ft.saveFile(trial.getName()+'.pkl',trialDict)
# ['patch11', 'LLA'], # ['patch12', 'MMP'], # ['patch13', 'MMP'] # ['patch14', 'MMP'] ] currFolder = os.path.dirname(os.path.realpath(__file__)) os.chdir(currFolder) trialPath = os.path.join(currFolder,trialName) trialDict = ft.loadFile(trialPath) finalPatches = dict(trialDict['finalPatches']) for i, namePair in enumerate(names): currPatch = finalPatches.pop(namePair[0]) newPatchDict = {namePair[1]:currPatch} finalPatches.update(newPatchDict) trialDict.update({'finalPatchesMarked':finalPatches}) ft.saveFile(trialPath,trialDict) trial, _ = rm.loadTrial(trialPath) f = plt.figure(figsize=(10,10)) ax = f.add_subplot(111) trial.plotFinalPatchBorders(plotAxis = ax,borderWidth=4) plt.show() f.savefig(trialName[0:-4]+'_borders.pdf',dpi=600) f.savefig(trialName[0:-4]+'_borders.png',dpi=300)