def test_boundary_penalty(self): data = self.generate_data([16, 16, 16]) * 100 # instead of showing just test results #app = QApplication(sys.argv) #pyed = seed_editor_qt.QTSeedEditor(data) #app.exec_() import scipy.ndimage.filters #filtered = scipy.ndimage.filters.prewitt(data,0) filtered = scipy.ndimage.filters.sobel(data, 0) #filtered = scipy.ndimage.filters.gaussian_filter1d(data,sigma=0.6,axis=0, order=1) # Oproti Boykov2001b tady nedělím dvojkou. Ta je tam jen proto, # aby to slušně vycházelo filtered2 = (-np.power(filtered, 2) / (512 * np.var(data))) # Přičítám tu 1024 což je empiricky zjištěná hodnota - aby to dobře vyšlo filtered2 = filtered2 + 0 # - np.min(filtered2) + 1e-30 print('max ', np.max(filtered2)) print('min ', np.min(filtered2)) import pdb pdb.set_trace() #np.exp(-np.random.normal(0 from PyQt4.QtGui import QApplication app = QApplication(sys.argv) pyed = seed_editor_qt.QTSeedEditor(filtered2) app.exec_() filtered3 = np.exp(filtered2) pyed = seed_editor_qt.QTSeedEditor(filtered3) app.exec_() import matplotlib.pyplot as plt plt.imshow(filtered3[:, :, 5]) plt.colorbar() plt.show()
def manualcrop(data): # pragma: no cover try: from pysegbase import seed_editor_qt except: logger.warning("Deprecated of pyseg_base as submodule") import seed_editor_qt pyed = seed_editor_qt.QTSeedEditor(data, mode='crop') pyed.exec_() # pyed = sed3.sed3(data) # pyed.show() nzs = pyed.seeds.nonzero() crinfo = [ [np.min(nzs[0]), np.max(nzs[0])], [np.min(nzs[1]), np.max(nzs[1])], [np.min(nzs[2]), np.max(nzs[2])], ] data = crop(data, crinfo) return data, crinfo
def cropDcm(self): pyed = seed_editor_qt.QTSeedEditor(self.data3d, mode='crop') pyed.exec_() pass