diff options
-rw-r--r-- | libcrystfel/src/image.h | 2 | ||||
-rw-r--r-- | libcrystfel/src/stream.c | 2 | ||||
-rw-r--r-- | src/im-sandbox.c | 16 | ||||
-rw-r--r-- | src/process_image.c | 4 | ||||
-rw-r--r-- | src/process_image.h | 3 |
5 files changed, 23 insertions, 4 deletions
diff --git a/libcrystfel/src/image.h b/libcrystfel/src/image.h index 6589ac1a..2498b5c2 100644 --- a/libcrystfel/src/image.h +++ b/libcrystfel/src/image.h @@ -183,6 +183,8 @@ struct image { int id; /* ID number of the thread * handling this image */ + int serial; /* Monotonically ascending serial + * number for this image */ struct sample *spectrum; int nsamples; /* Number of wavelengths */ diff --git a/libcrystfel/src/stream.c b/libcrystfel/src/stream.c index 04627a0c..6ae6fd64 100644 --- a/libcrystfel/src/stream.c +++ b/libcrystfel/src/stream.c @@ -634,6 +634,8 @@ void write_chunk(Stream *st, struct image *i, struct hdfile *hdfile, fprintf(st->fh, "Event: %s\n", get_event_string(i->event)); } + fprintf(st->fh, "Image serial number: %i\n", i->serial); + indexer = indexer_str(i->indexed_by); fprintf(st->fh, "indexed_by = %s\n", indexer); free(indexer); diff --git a/src/im-sandbox.c b/src/im-sandbox.c index 4d010cc2..45a058ba 100644 --- a/src/im-sandbox.c +++ b/src/im-sandbox.c @@ -108,6 +108,7 @@ struct sandbox int *filename_pipes; int *stream_pipe_write; struct filename_plus_event **last_filename; + int serial; char *tmpdir; @@ -444,8 +445,9 @@ static void run_work(const struct index_args *iargs, char filename[1024]; char event_str[1024]; struct event* ev; + int ser; - sscanf(bd.line, "%s %s", filename, event_str); + sscanf(bd.line, "%s %s %i", filename, event_str, &ser); pargs.filename_p_e->filename = strdup(filename); if ( strcmp(event_str, "/") != 0 ) { @@ -465,7 +467,7 @@ static void run_work(const struct index_args *iargs, pargs.n_crystals = 0; process_image(iargs, &pargs, st, cookie, tmpdir, - results_pipe); + results_pipe, ser); /* Request another image */ c = sprintf(buf, "%i\n", pargs.n_crystals); @@ -903,6 +905,7 @@ void create_sandbox(struct index_args *iargs, int n_proc, char *prefix, sb->suspend_stats = 0; sb->n_proc = n_proc; sb->iargs = iargs; + sb->serial = 1; sb->reader->fds = NULL; sb->reader->fhs = NULL; @@ -1124,6 +1127,8 @@ void create_sandbox(struct index_args *iargs, int n_proc, char *prefix, } else { + char tmp[256]; + r = write(sb->filename_pipes[i], nextImage->filename, strlen(nextImage->filename)); @@ -1155,6 +1160,13 @@ void create_sandbox(struct index_args *iargs, int n_proc, char *prefix, } + snprintf(tmp, 255, " %i", sb->serial++); + r = write(sb->filename_pipes[i], + tmp, strlen(tmp)); + if ( r < 0 ) { + ERROR("write pipe\n"); + } + r = write(sb->filename_pipes[i], "\n", 1); if ( r < 0 ) { ERROR("write pipe\n"); diff --git a/src/process_image.c b/src/process_image.c index 225d50e3..68708fd7 100644 --- a/src/process_image.c +++ b/src/process_image.c @@ -112,7 +112,8 @@ static void refine_radius(Crystal *cr) void process_image(const struct index_args *iargs, struct pattern_args *pargs, - Stream *st, int cookie, const char *tmpdir, int results_pipe) + Stream *st, int cookie, const char *tmpdir, int results_pipe, + int serial) { float *data_for_measurement; size_t data_size; @@ -134,6 +135,7 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs, image.det = iargs->det; image.crystals = NULL; image.n_crystals = 0; + image.serial = serial; hdfile = hdfile_open(image.filename); if ( hdfile == NULL ) { diff --git a/src/process_image.h b/src/process_image.h index 7c48d711..5d9f2c27 100644 --- a/src/process_image.h +++ b/src/process_image.h @@ -99,7 +99,8 @@ struct pattern_args extern void process_image(const struct index_args *iargs, struct pattern_args *pargs, Stream *st, - int cookie, const char *tmpdir, int results_pipe); + int cookie, const char *tmpdir, int results_pipe, + int serial); #endif /* PROCESS_IMAGEs_H */ |