aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-05-20 22:42:49 +0200
committerThomas White <taw@physics.org>2020-07-29 18:42:57 +0200
commit23ea67dc03ac19f7a1457ecfdc8d5ee9cac68632 (patch)
treec9cf8cbc343b842c3da3803d67343f73071b96dd /src
parent302de26924528b31a2320c90fd944224674bd835 (diff)
Port indexamajig to new API, part II
This also removes a large chunk of legacy code
Diffstat (limited to 'src')
-rw-r--r--src/im-zmq.c23
-rw-r--r--src/im-zmq.h2
-rw-r--r--src/process_image.c3
3 files changed, 15 insertions, 13 deletions
diff --git a/src/im-zmq.c b/src/im-zmq.c
index f8743dbb..39f1d207 100644
--- a/src/im-zmq.c
+++ b/src/im-zmq.c
@@ -46,6 +46,7 @@
#include "hdf5-file.h"
#include "utils.h"
#include "im-zmq.h"
+#include "datatemplate_priv.h"
struct im_zmq
@@ -408,19 +409,19 @@ static double *find_msgpack_data(msgpack_object *obj, int *width, int *height)
}
-static double *zero_array(DataTemplate *dtempl, int *dw, int *dh)
+static double *zero_array(const DataTemplate *dtempl, int *dw, int *dh)
{
int max_fs = 0;
int max_ss = 0;
int pi;
double *data;
- for ( pi=0; pi<det->n_panels; pi++ ) {
- if ( det->panels[pi].orig_max_fs > max_fs ) {
- max_fs = det->panels[pi].orig_max_fs;
+ for ( pi=0; pi<dtempl->n_panels; pi++ ) {
+ if ( dtempl->panels[pi].orig_max_fs > max_fs ) {
+ max_fs = dtempl->panels[pi].orig_max_fs;
}
- if ( det->panels[pi].orig_max_ss > max_ss ) {
- max_ss = det->panels[pi].orig_max_ss;
+ if ( dtempl->panels[pi].orig_max_ss > max_ss ) {
+ max_ss = dtempl->panels[pi].orig_max_ss;
}
}
@@ -456,25 +457,25 @@ struct image *unpack_msgpack_data(msgpack_object *obj,
if ( obj == NULL ) {
ERROR("No MessagePack object!\n");
- return 1;
+ return NULL;
}
if ( !no_image_data ) {
data = find_msgpack_data(obj, &data_width, &data_height);
if ( data == NULL ) {
ERROR("No image data in MessagePack object.\n");
- return 1;
+ return NULL;
}
} else {
data = zero_array(dtempl, &data_width, &data_height);
}
image = image_new();
- if ( image == NULL ) return 1;
+ if ( image == NULL ) return NULL;
if ( unpack_slab(image, data, data_width, data_height) ) {
ERROR("Failed to unpack data slab.\n");
- return 1;
+ return NULL;
}
im_zmq_fill_in_beam_parameters(image->beam, image);
@@ -485,5 +486,5 @@ struct image *unpack_msgpack_data(msgpack_object *obj,
im_zmq_fill_in_clen(image->det);
fill_in_adu(image);
- return 0;
+ return image;
}
diff --git a/src/im-zmq.h b/src/im-zmq.h
index 270a7c3a..ddf3f172 100644
--- a/src/im-zmq.h
+++ b/src/im-zmq.h
@@ -55,7 +55,7 @@ extern ImageFeatureList *get_peaks_msgpack(msgpack_object *obj,
int half_pixel_shift);
extern struct image *unpack_msgpack_data(msgpack_object *obj,
- DataTemplate *dtempl,
+ const DataTemplate *dtempl,
int no_image_data);
#else /* defined(HAVE_MSGPACK) && defined(HAVE_ZMQ) */
diff --git a/src/process_image.c b/src/process_image.c
index d529a444..bca2a7f2 100644
--- a/src/process_image.c
+++ b/src/process_image.c
@@ -130,7 +130,7 @@ static struct image *file_wait_open_read(const char *filename,
if ( !wait_message_done ) {
STATUS("Waiting for '%s'\n",
- image->filename);
+ filename);
wait_message_done = 1;
}
@@ -194,6 +194,7 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs,
if ( pargs->msgpack_obj != NULL ) {
set_last_task(last_task, "unpacking messagepack object");
image = unpack_msgpack_data(pargs->msgpack_obj,
+ iargs->dtempl,
iargs->no_image_data);
if ( image == NULL ) return;
} else {