def callback_select_files(self): fnames = askopenfilenames(initialdir=self.variables.browse_directory, filetypes=common_use_collection) if fnames is None or fnames in ['', ()]: return # update the default directory for browsing self.variables.browse_directory = os.path.split(fnames[0])[0] the_reader = None if len(fnames) > 1: the_reader = ComplexImageReader(fnames) if the_reader is None: try: the_reader = ComplexImageReader(fnames[0]) except IOError: the_reader = None if the_reader is None: the_reader = DerivedImageReader(fnames[0]) if the_reader is None: showinfo( 'Opener not found', message='File {} was not successfully opened as a SICD type ' 'or SIDD type file.'.format(fnames)) return self.update_reader(the_reader)
def callback_select_files(self): fnames = askopenfilenames(initialdir=self.variables.browse_directory, filetypes=common_use_collection) if fnames is None or fnames in ['', ()]: return # update the default directory for browsing self.variables.browse_directory = os.path.split(fnames[0])[0] if len(fnames) == 1: the_reader = ComplexImageReader(fnames[0]) else: the_reader = ComplexImageReader(fnames) self.update_reader(the_reader)
def set_col_data(): # calculate the fourier transform with deskew in the column direction col_file, col_memmap, col_mean_value = create_deskewed_transform( self.variables.image_reader, dimension=1) self.variables.column_fourier_file = col_file self.variables.column_fourier_reader = ComplexImageReader( FlatSICDReader(self.variables.image_reader.get_sicd(), col_memmap)) self.column_centered_image_panel.set_image_reader( self.variables.column_fourier_reader) draw_deltak_lines(self.column_centered_image_panel.canvas) # rescale the row_mean_value so that the smoothed max value is essentially 1 if col_mean_value.size < 200: the_max = numpy.amax(col_mean_value) else: the_size = int(numpy.ceil(col_mean_value.size / 200.)) smoothed = numpy.convolve(col_mean_value, numpy.full((the_size, ), 1. / the_size, dtype='float64'), mode='valid') the_max = numpy.amax(smoothed) col_mean_value /= the_max self.variables.scaled_column_mean = col_mean_value # construct the proper weights and prepare information for weight plotting self.variables.derived_column_weights = the_sicd.Grid.Col.define_weight_function( populate=False)
def callback_select_directory(self): dirname = askdirectory(initialdir=self.variables.browse_directory, mustexist=True) if dirname is None or dirname in [(), '']: return # update the default directory for browsing self.variables.browse_directory = os.path.split(dirname)[0] the_reader = ComplexImageReader(dirname) self.update_reader(the_reader)
def callback_select_directory(self): dirname = askdirectory(initialdir=self.variables.browse_directory, mustexist=True) if dirname is None or dirname in [(), '']: return # update the default directory for browsing self.variables.browse_directory = os.path.split(dirname)[0] try: the_reader = ComplexImageReader(dirname) except IOError: showinfo('Opener not found', message='Directory {} was not successfully opened as a SICD type.'.format(dirname)) return self.update_reader(the_reader)
def callback_initialize_canvas_image(self): image_file_extensions = ['*.nitf', '*.NITF', '*.ntf', '*.NTF'] ftypes = [ ('NITF files', image_file_extensions), ('All files', '*'), ] new_fname = askopenfilename(initialdir=self.variables.browse_directory, filetypes=ftypes) if new_fname: self.variables.browse_directory = os.path.split(new_fname)[0] self.variables.image_reader = ComplexImageReader(new_fname) self.canvas_demo_image_panel.set_image_reader( self.variables.image_reader)
def callback_noise(self): """ Enable noise analysis """ if not self._verify_reader(): return # create a complex image reader - don't pass the same one around, so no hidden state reader = ComplexImageReader(self.variables.image_reader.base_reader) # open the rcs tool based on this reader root = tkinter.Toplevel() # create a new toplevel with its own mainloop, so it's blocking tool = RCSTool(root) tool.update_reader(reader) root.grab_set() root.wait_window() self._get_and_log_feedback('Noise Value')
def callback_sign(self): """ Enable Fourier sign analysis """ if not self._verify_reader(): return # create a complex image reader - don't pass the same one around, so no hidden state reader = ComplexImageReader(self.variables.image_reader.base_reader) # open the aperture tool based on this reader root = tkinter.Toplevel(self.root) # create a new toplevel with its own mainloop, so it's blocking tool = RegionSelection(root) tool.update_reader(reader) root.grab_set() root.wait_window() self._get_and_log_feedback('Fourier Sign')
def callback_full_fs(self): """ Enable the full image frequency analysis """ if not self._verify_reader(): return # create a complex image reader - don't pass the same one around, so no hidden state reader = ComplexImageReader(self.variables.image_reader.base_reader) # open the frequency support tool based on this reader root = tkinter.Toplevel(self.root) # create a new toplevel with its own mainloop, so it's blocking tool = FullFrequencySupportTool(root) tool.update_reader(reader) root.grab_set() root.wait_window() self._get_and_log_feedback('Full Image Frequency Support')