1. A method for producing an electronic representation of an image of a target region through statistical inversion, comprising: mapping the target region with a grid, and describing a number of voxels in the grid with voxel-specific unknowns, representing said unknowns with components of a vector-valued variable, repeatedly generating a next version of said vector-valued variable by drawing for each component a value from a conditional distribution, and using the components of a so generated version of said vector-valued variable as said electronic representation; wherein: a theory matrix, elements of which indicate, what is the contribution of each voxel in the grid to a detection result obtained at a particular pixel of a detector, is stored in a compressed form, and only a subset of the theory matrix is decompressed from said compressed form for at least one of the following: updating the quantity Ax, where A is the theory matrix and x is the vector-valued variable, after said generating of a next version of said vector-valued variable, calculating the quantity A j T (Ax), where A is the theory matrix, A j T is the transpose of the j:th column of the theory matrix, and x is the vector-valued variable and for decompressing a column of elements of the theory matrix, which column corresponds to a voxel of the grid, the method comprises: using two perpendicular projections of said voxel and of the rays of a ray model to identify one or more rays that go through the voxel and to find the points at which said one or more rays penetrate the sides of the voxel, and calculating uncompressed values of said elements by scaling the projected length of each section of said one or more rays that falls within said voxel with a scaling factor proportional to the whole length of the respective ray; wherein: said using of two perpendicular projections of said voxel and of said rays of the ray model comprises: using coordinates of said voxel to identify a first entry in a first table and a second entry in a second table, wherein each of said first entry and said second entry comprises one or more ray-specific records, and wherein each of said ray-specific records comprises a ray-specific entry point coordinate and a ray-specific exit point coordinate, identifying those rays as going through the voxel for which the range between ray-specific entry and exit point coordinates comprised in said first entry has a non-empty intersection with the range between ray-specific entry and exit point coordinates comprised in said second entry, and using the ray-specific entry and exit point coordinates of the endpoints of said non-empty intersection to indicate points at which the corresponding ray penetrates the sides of the voxel.