Yeti,
the first issue you mention is what I exactly intend to do. I have physically squared scans but not pixelwise. My problem is I do not know where to find the function in the API (header). And if so, it has the structure of: gwy_app_data_window_change_square (GtkWidget *item, gpointer user_data) What I actually get in my code is only a GwyDataView to work with. It will be displayed in the following way: [code] GwyContainer *data[2]; GwyDataField *data_field; GwyDataView *data_view[2]; GwyLayerBasic *base_layer[3]; gwy_app_data_browser_get_current(GWY_APP_DATA_FIELD, &data_field, 0); data[0] = gwy_container_new(); gwy_container_set_object_by_name(data[0], "/0/data", data_field) ; data_view[0] = GWY_DATA_VIEW(gwy_data_view_new(data[0])); base_layer[0] = GWY_LAYER_BASIC(gwy_layer_basic_new()); g_object_set(base_layer[0], "data-key", "/0/data", "gradient-key", "/0/base/palette", "range-type-key", "/0/base/range-type", NULL); gwy_data_view_set_base_layer(data_view[0], (GwyPixmapLayer*) base_layer[0]); gtk_container_add(GTK_CONTAINER(Viewport), GTK_WIDGET(data_view[0])); [/code] Is it sufficient to apply square_samples() to data[0] before adding the data_view[0] to the viewport? Cheers, /M On 0, "David Nečas (Yeti)" <[email protected]> wrote: > On Fri, Jul 18, 2014 at 10:42:08AM +0200, Mathias Müller wrote: > > I just wanted to write kind of module for gwyddion. However, I got > > stuck at the point where data is displayed which is physically squared > > but not pixel size. Looking into the API it says one can get the > > pixel and physical size of a GwyDataView. How is it possible to > > reshape the view to make it squared (setting pixel size?)? > > The style is controled by /0/data/realsquare (for channel 0). TRUE > means physical; FALSE or unset means pixelwise. The function > gwy_app_data_window_change_square() only changes how the channel is > displayed and if this is what you need it is easy. > > Otherwise I'm not sure what you want to change: > > (a) The physical dimensions, but not the number of pixels, i.e. fix the > pixel size. This can be easily done by gwy_data_field_set_xreal() or > gwy_data_field_set_yreal(). > > (b) The number of pixels, but not the physical dimensions of the entire > image. This requires resampling. See e.g. square_samples() in > basicops.c. > > > I found some hints in the gwyddion source, but really don't wanna copy > > paste foreign code. This simply bloats up the code for this module. > > Well, you may want a different logic of what and how to resample than > square_samples(). I would make a standard library function for squaring > the pixels if I was sure what it should do in all cases... > > Regards, > > Yeti ------------------------------------------------------------------------------ Want fast and easy access to all the code in your enterprise? Index and search up to 200,000 lines of code with a free copy of Black Duck Code Sight - the same software that powers the world's largest code search on Ohloh, the Black Duck Open Hub! Try it now. http://p.sf.net/sfu/bds _______________________________________________ Gwyddion-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gwyddion-users
