/tomo/pyhst

To get this branch, use:
bzr branch http://darksoft.org/webbzr/tomo/pyhst
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
 * The PyHST program is Copyright (C) 2002-2011 of the
 * European Synchrotron Radiation Facility (ESRF) and
 * Karlsruhe Institute of Technology (KIT).
 *
 * PyHST is free software: you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * hst is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along
 * with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _PYHST_H
#define _PYHST_H

#ifdef HST_USE_FASTWRITER
# include <fastwriter.h>
#endif /* HST_USE_FASTWRITER */

#include "hst_setup.h"
#include "hst_reconstructor.h"

int hst_init(void);
void hst_free(void);
size_t hst_get_balanced_number_of_reconstructors();


typedef struct HSTContextT *HSTContextPtr;

/* Function to set filtering array */
typedef void (*HSTFilterFunction)(void *ctx, int dim_fft, float *filter);

typedef enum {
    HST_PINNED_R = 1,
    HST_PINNED_W = 2,
    HST_PINNED_RW = 3
} HSTPinnedAccess;

void *hst_pinned_malloc(size_t size, HSTPinnedAccess access);
void hst_pinned_free(void *ptr);

HSTContextPtr hst_create_context(void);
int hst_init_context(HSTContextPtr ctx, HSTSetup *setup, const float *custom_angles, const float *axis_corrections);
void hst_free_context(HSTContextPtr ctx);
void hst_destroy_context(HSTContextPtr ctx);

int hst_set_filter(HSTContextPtr ctx, HSTFilterFunction func, void *func_param);
int hst_set_output_file(HSTContextPtr ctx, FILE *output);
#ifdef HST_USE_FASTWRITER
int hst_set_fastwriter(HSTContextPtr ctx, fastwriter_t *output);
#endif /* HST_USE_FASTWRITER */
int hst_set_padding(HSTContextPtr ctx, int zero_padding);
int hst_set_axis_mode(HSTContextPtr ctx, int axis_to_the_center);


/**
 * Function returns the array of initialized processing modules which are going to be used in
 * reconstruction.
 * 
 * @param ctx is initialized HSTContext
 * @return NULL terminated array of configured reconstruction contexts. The result must not
 * be modified or freed.
 */
HSTReconstructorConstContextPtr *hst_get_configured_reconstructors(HSTContextPtr ctx);

/**
 * Supply new slices for reconstruction
 * @param ctx is initialized HSTContext
 * @param num_slices is a number of slices to reconstruct
 * @param result is an optional storage for reconstructed slices, if it is not supplied
 * the results will be directly stored in a file supplied by #hst_set_output_file function.
 * @param sinograms is flat memory with sinograms to reconstruct from (slice by slice)
 * @return Non-zero error code in case of errors
 */
int hst_reconstruct_slices(HSTContextPtr ctx, int num_slices, float *result, const float *sinograms);

int hst_reconstruct_start(HSTContextPtr ctx, int num_slices, const float *sinograms);
int hst_reconstruct_wait(HSTContextPtr ctx);


int hst_preprocess_start(HSTContextPtr ctx, int num_slices, const float *sinograms);
int hst_preprocess_wait(HSTContextPtr ctx);
int hst_preprocess_projection(HSTContextPtr ctx, int proj, float *data);


# ifdef PYHST_MEASURE_TIMINGS
double hst_get_io_timer(HSTContextPtr ctx);
double hst_get_recon_timer(HSTContextPtr ctx);
# endif /* PYHST_MEASURE_TIMINGS */

#endif /* _PYHST_H */