From cd20673d790b2c9d204a8c8fe93cedf6fdd8a1bf Mon Sep 17 00:00:00 2001 From: valerio <valerio@5a81b35b-ba03-0410-adc8-b2c5c5119f08> Date: Thu, 11 Mar 2010 09:12:49 +0000 Subject: [PATCH] Added information about reading/writing into image git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@1806 5a81b35b-ba03-0410-adc8-b2c5c5119f08 --- website/raw/docs/tut/imgintro.mkdown | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/website/raw/docs/tut/imgintro.mkdown b/website/raw/docs/tut/imgintro.mkdown index 4b27d3720..1c24ca5fd 100644 --- a/website/raw/docs/tut/imgintro.mkdown +++ b/website/raw/docs/tut/imgintro.mkdown @@ -47,6 +47,30 @@ origin (ie the pixel with the coordinates <0,0>) is in the top-left corner. A viewer window will pop up (see below), showing a white frame on a black background. The inner area of the white frame is the image, which is empty. +## Reading and writing into an image + +Data can be read and written from and into an image using the following commands: + + ::python + # writes the real value 23.4 into pixel 10,10 + im.SetReal(img.Point(10,10),23.4) + # reads the value in pixel 10,10 + val=im.GetReal(img.Point(10,10)) + +The complex equivalents are also available + + ::python + # writes the complex value value 2+3j into pixel 10,10 + im.SetComplex(img.Point(10,10),2+3j) + # reads the value in pixel 10,10 + val=im.GetComplex(img.Point(10,10)) + +The image knows in which domain it is, and will adjust the type of data being written +accordingly. For example, if one writes a complex value in a 'SPATIAL' image, the value +will be automatically converted to a real one by taking the amplitude of the complex number +On the other hand, if one writes a real value in a 'FREQUENCY' image, the value is automatically +converted to complex by setting the imaginary part to 0. + ## Applying algorithms Let us fill the image with random values. -- GitLab