aboutsummaryrefslogtreecommitdiff
path: root/src/im-zmq.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-05-20 16:46:41 +0200
committerThomas White <taw@physics.org>2020-07-29 18:42:57 +0200
commit8e30641ba8fe37575794adef60c340e6116e0e7b (patch)
treeee88eebfa1728d57a7b3331ebaba3f50c6b1500c /src/im-zmq.c
parentbe37f0ce53156221de0248ee43dd2b3551bcb771 (diff)
Port indexamajig to new API, part I
Diffstat (limited to 'src/im-zmq.c')
-rw-r--r--src/im-zmq.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/src/im-zmq.c b/src/im-zmq.c
index da0a5fff..f8743dbb 100644
--- a/src/im-zmq.c
+++ b/src/im-zmq.c
@@ -408,7 +408,7 @@ static double *find_msgpack_data(msgpack_object *obj, int *width, int *height)
}
-static double *zero_array(struct detector *det, int *dw, int *dh)
+static double *zero_array(DataTemplate *dtempl, int *dw, int *dh)
{
int max_fs = 0;
int max_ss = 0;
@@ -446,17 +446,14 @@ static double *zero_array(struct detector *det, int *dw, int *dh)
* ...
* }
*/
-int unpack_msgpack_data(msgpack_object *obj, struct image *image,
- int no_image_data)
+struct image *unpack_msgpack_data(msgpack_object *obj,
+ const DataTemplate *dtempl,
+ int no_image_data)
{
+ struct image *image;
int data_width, data_height;
double *data;
- if ( image->det == NULL ) {
- ERROR("Geometry not available.\n");
- return 1;
- }
-
if ( obj == NULL ) {
ERROR("No MessagePack object!\n");
return 1;
@@ -469,20 +466,21 @@ int unpack_msgpack_data(msgpack_object *obj, struct image *image,
return 1;
}
} else {
- data = zero_array(image->det, &data_width, &data_height);
+ data = zero_array(dtempl, &data_width, &data_height);
}
+ image = image_new();
+ if ( image == NULL ) return 1;
+
if ( unpack_slab(image, data, data_width, data_height) ) {
ERROR("Failed to unpack data slab.\n");
return 1;
}
- if ( image->beam != NULL ) {
- im_zmq_fill_in_beam_parameters(image->beam, image);
- if ( image->lambda > 1000 ) {
- ERROR("Warning: Missing or nonsensical wavelength "
- "(%e m).\n", image->lambda);
- }
+ im_zmq_fill_in_beam_parameters(image->beam, image);
+ if ( image->lambda > 1000 ) {
+ ERROR("Warning: Missing or nonsensical wavelength "
+ "(%e m).\n", image->lambda);
}
im_zmq_fill_in_clen(image->det);
fill_in_adu(image);