diff options
author | Thomas White <taw@physics.org> | 2020-05-25 15:01:58 +0200 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2020-07-29 18:42:57 +0200 |
commit | aab8403884c4731f7365796de8f53315f4a61616 (patch) | |
tree | 6a7bc45b52c7943220c71de07caba9c681b2567d /libcrystfel | |
parent | 23ea67dc03ac19f7a1457ecfdc8d5ee9cac68632 (diff) |
Get rid of imagefile_field_list and stuff_from_stream
The only place this is used is in geoptimiser, to get the
average_camera_length, itself a very bad solution.
Diffstat (limited to 'libcrystfel')
-rw-r--r-- | libcrystfel/src/datatemplate.c | 8 | ||||
-rw-r--r-- | libcrystfel/src/datatemplate.h | 3 | ||||
-rw-r--r-- | libcrystfel/src/image.c | 3 | ||||
-rw-r--r-- | libcrystfel/src/image.h | 17 | ||||
-rw-r--r-- | libcrystfel/src/stream.c | 62 |
5 files changed, 14 insertions, 79 deletions
diff --git a/libcrystfel/src/datatemplate.c b/libcrystfel/src/datatemplate.c index f0e23ded..60c36358 100644 --- a/libcrystfel/src/datatemplate.c +++ b/libcrystfel/src/datatemplate.c @@ -1270,3 +1270,11 @@ void data_template_file_to_panel_coords(const DataTemplate *dt, *pfs = *pfs - dt->panels[pn].orig_min_fs; *pss = *pss - dt->panels[pn].orig_min_ss; } + + +void data_template_add_copy_header(DataTemplate *dt, + const char *header) +{ + /* FIXME: Add "header" to list of things to copy */ + STATUS("Adding %s\n", header); +} diff --git a/libcrystfel/src/datatemplate.h b/libcrystfel/src/datatemplate.h index 0adcdb0b..ac76c578 100644 --- a/libcrystfel/src/datatemplate.h +++ b/libcrystfel/src/datatemplate.h @@ -59,6 +59,9 @@ extern signed int data_template_find_panel(const DataTemplate *dt, extern void data_template_file_to_panel_coords(const DataTemplate *dt, float *pfs, float *pss); +extern void data_template_add_copy_header(DataTemplate *dt, + const char *header); + #ifdef __cplusplus } #endif diff --git a/libcrystfel/src/image.c b/libcrystfel/src/image.c index c7d46978..8b73e414 100644 --- a/libcrystfel/src/image.c +++ b/libcrystfel/src/image.c @@ -838,8 +838,7 @@ struct image *image_new() image->detgeom = NULL; image->filename = NULL; image->ev = NULL; - image->copyme = NULL; - image->stuff_from_stream = NULL; + image->copied_headers = NULL; image->avg_clen = -1.0; image->id = 0; image->serial = 0; diff --git a/libcrystfel/src/image.h b/libcrystfel/src/image.h index 90cb823d..1ea0bc35 100644 --- a/libcrystfel/src/image.h +++ b/libcrystfel/src/image.h @@ -44,8 +44,6 @@ struct detector; struct imagefeature; struct sample; struct image; -struct imagefile; -struct imagefile_field_list; #include "utils.h" #include "cell.h" @@ -155,11 +153,8 @@ struct image char *ev; /** @} */ - /** A list of image file headers to copy to the stream */ - const struct imagefile_field_list *copyme; - /** A list of metadata read from the stream */ - struct stuff_from_stream *stuff_from_stream; + char *copied_headers; /** Mean of the camera length values for all panels */ double avg_clen; @@ -235,9 +230,6 @@ extern int imagefile_read(struct imagefile *f, struct image *image, extern int imagefile_read_simple(struct imagefile *f, struct image *image); extern struct hdfile *imagefile_get_hdfile(struct imagefile *f); extern enum imagefile_type imagefile_get_type(struct imagefile *f); -extern void imagefile_copy_fields(struct imagefile *f, - const struct imagefile_field_list *copyme, - FILE *fh, struct event *ev); extern void imagefile_close(struct imagefile *f); extern signed int is_cbf_file(const char *filename); @@ -256,13 +248,6 @@ extern ImageFeatureList *image_read_peaks(const DataTemplate *dtempl, extern struct event_list *image_expand_frames(const DataTemplate *dtempl, const char *filename); -/* Field lists */ -extern struct imagefile_field_list *new_imagefile_field_list(void); -extern void free_imagefile_field_list(struct imagefile_field_list *f); - -extern void add_imagefile_field(struct imagefile_field_list *copyme, - const char *name); - #ifdef __cplusplus } #endif diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c index 8255a711..419acd36 100644 --- a/libcrystfel/src/stream.c +++ b/libcrystfel/src/stream.c @@ -1144,55 +1144,6 @@ static void read_crystal(Stream *st, struct image *image, StreamReadFlags srf) } -void free_stuff_from_stream(struct stuff_from_stream *sfs) -{ - int i; - if ( sfs == NULL ) return; - for ( i=0; i<sfs->n_fields; i++ ) { - free(sfs->fields[i]); - } - free(sfs->fields); - free(sfs); -} - - -static int read_and_store_field(struct image *image, const char *line) -{ - char **new_fields; - char *nf; - - if ( image->stuff_from_stream == NULL ) { - image->stuff_from_stream = - malloc(sizeof(struct stuff_from_stream)); - if ( image->stuff_from_stream == NULL) { - ERROR("Failed reading entries from stream\n"); - return 1; - } - image->stuff_from_stream->fields = NULL; - image->stuff_from_stream->n_fields = 0; - } - - new_fields = realloc(image->stuff_from_stream->fields, - (1+image->stuff_from_stream->n_fields)* - sizeof(char *)); - if ( new_fields == NULL ) { - ERROR("Failed reading entries from stream\n"); - return 1; - } - image->stuff_from_stream->fields = new_fields; - - nf = strdup(line); - if ( nf == NULL ) { - ERROR("Failed to allocate field from stream\n"); - return 1; - } - image->stuff_from_stream->fields[image->stuff_from_stream->n_fields] = nf; - image->stuff_from_stream->n_fields++; - - return 0; -} - - /** * Read the next chunk from a stream and fill in 'image' */ @@ -1210,7 +1161,7 @@ int read_chunk_2(Stream *st, struct image *image, StreamReadFlags srf) image->crystals = NULL; image->n_crystals = 0; image->ev = NULL; - image->stuff_from_stream = NULL; + image->copied_headers = NULL; if ( (srf & STREAM_READ_REFLECTIONS) || (srf & STREAM_READ_UNITCELL) ) { srf |= STREAM_READ_CRYSTALS; @@ -1291,17 +1242,6 @@ int read_chunk_2(Stream *st, struct image *image, StreamReadFlags srf) } } - if ( strstr(line, " = ") != NULL ) { - - int fail; - - fail = read_and_store_field(image, line); - if ( fail ) { - ERROR("Failed to read fields from stream.\n"); - return 1; - } - } - if ( (srf & STREAM_READ_PEAKS) && strcmp(line, PEAK_LIST_START_MARKER) == 0 ) { |