aboutsummaryrefslogtreecommitdiff
path: root/libcrystfel/src/image.h
AgeCommit message (Collapse)Author
2024-02-06Julia: MM semantics for Image.crystalsThomas White
2024-02-06Julia: Image/PeakList memory semantics (again)Thomas White
Previous commit a6462e1f0 was still not right. If the image gets freed, the PeakList can be left with a dangling reference. If the peak list gets replaced at the C level (e.g. by running a new peak search), Julia will have no way of knowing about it. Instead of having the PeakList know if it's associated with an image, it's better to have the Image know (at the C level) if it's responsible for freeing the ImageFeatureList. As soon as the ImageFeatureList is exposed to the Julia GC via a PeakList object, it becomes Julia's responsibility to free it. The Julia Image structure contains a reference to the Julia PeakList, to prevent this from happening until either the image is freed or a new PeakList is substituted. The two references (Julia image.peaklist and C image->features) have to be kept in sync, and we check image->features every time the peaklist is requested.
2024-02-06Crystals shouldn't own RefLists (part 2)Thomas White
This commit replaces image.crystals with an array of small structs, each consisting of a Crystal-RefList pair. index.c and stream.c are updated, more to follow.
2024-02-06image_add_feature: Remove "image" argumentThomas White
It hasn't been needed for ages.
2023-09-23indexamajig: Re-use the image data arraysThomas White
We noticed that constant freeing and re-allocating the (potentially quite large) arrays resulted in much lower performance. Since we know that all images have the same data layout, we can safely re-use the arrays. This gives a large speedup.
2023-09-23image_create_dp_bad_sat: Don't worry about "sat"Thomas White
The saturation array is created by create_satmap when needed, which takes care that all panels get an array (so we only have to check image->sat != NULL). The array created by image_create_dp_bad_sat was actually leaked! In any case, saturation maps are rarely used. We can do without the extra allocations. The routine name has been changed accordingly, to prevent future confusion.
2023-05-05Move is_{hdf5,cbf,cbfgz}_file() to image.cThomas White
This also improves is_hdf5_file() to use the proper file signature, not just the extension. See 9040220452a9cc02706159c21c78e43b374446cf.
2023-05-02Remove image_write() and image_hdf5_write()Thomas White
This code isn't needed any more, now that we don't simulate images. It never worked very well - although we can read almost any sensible format, writing images that match an arbitrary schema is very difficult. See 41ed47a931e4c162c9a501981b6f19cd725f6e43 and https://gitlab.desy.de/thomas.white/crystfel/-/issues/81
2022-09-21Move create_detgeom to DataTemplate moduleThomas White
It seems to make more sense here, because it's all about interpreting the contents of the DataTemplate structure.
2022-08-18Restructure image data array creationThomas White
This adds a central procedure (image_create_dp_bad_sat) to create all the arrays. Then it's up to the loading procedure to put the values into the arrays. This also makes the loading procedures responsible for marking NaN/inf pixels in the bad pixel map. This avoids an additional sweep through the image data, and makes it possible to skip the NaN/inf check altogether if the image data comes, as it often does, in format which can't represent NaN/inf anyway. Finally, it removes quite a lot of duplicated code.
2022-06-02Seedee deserializationThomas White
2022-06-02indexamajig: Track metadata (e.g. for ASAP::O)Thomas White
2022-05-03Strip out time-accountsThomas White
2022-04-05indexamajig: Fix profiling when using streamed dataThomas White
2022-03-07Add image_read_with_time_accounting for fine-grained data load profilingThomas White
2021-07-16Rename DST_* to DATA_SOURCE_TYPE_*Thomas White
On some systems, this conflicts with DST_NONE in sys/time.h.
2021-06-16Add DST_NONE for 'no data source' (e.g. image came from stream)Thomas White
2021-05-12Rework header caching layerThomas White
This clears up multiple layering violations which were starting to get in the way. It enables "string" headers to be stored directly, and it will make it much simpler to add new header types in the future. Along the way, this changes all the floating point header stuff to use double precision. This is needed for EuXFEL event IDs. Closes: https://gitlab.desy.de/thomas.white/crystfel/-/issues/34
2021-04-23indexamajig: Generate a unique filename for ZMQ dataThomas White
The unique filename is needed by the GUI for looking up results in a stream. Otherwise, the filename is "(null)" for everything and the lookup just returns the first chunk in the stream. The filename is generated based on the unique serial number for each chunk, and is therefore unique across one run of indexamajig regardless of the number of worker processes (-j). This might have to change in future to accommodate jobs run across multiple nodes, if there is any demand for looking at results in one big concatenated stream. This also changes the condition for deciding when to look for a 'real' file, to take into account that there is always a non-NULL filename.
2021-04-19Unify loading of image data and header valuesThomas White
This moves the entry point for loading MsgPack data to a new function, image_read_data_block. Inside image.c, the image structure can be created using exactly the same functions as for data files.
2021-03-30Add header caching layerThomas White
This simultaneously implements --copy-header/--copy-hdf5-field and gives access to metadata (e.g. detector position or wavelength) when loading from a stream with header-specified values.
2021-03-05Mass update of copyright dates in source code commentsThomas White
2020-12-07Get rid of ImageFeature->rx,ry,rzThomas White
These needed to be kept up to date with a call to map_all_peaks every time anything changed - wavelength, detector position etc. Not doing so has already led to bugs in another branch, and probably already causes problems on this branch. This patch eliminates the rx,ry,rz completely. Anyone who needs reciprocal space coordinates for a peak is now responsible for calling detgeom_transform_coords themselves.
2020-09-08Un-export image_read_image_dataThomas White
Not needed since f5b3c4db36fa.
2020-08-07Remove image->avg_clenThomas White
Horrible API hack.
2020-08-04Add image_write()Thomas White
This is a one-to-one transfer of the old hdf5_write_image()
2020-08-04Add image_create_for_simulation()Thomas White
...and factorise common code
2020-07-29Remove config.h from libcrystfel headersThomas White
Same reason as removing them from tests. Also, libcrystfel might be used in projects which have HAVE_CONFIG_H defined.
2020-07-29stream_read_chunk: Add option to load image dataThomas White
2020-07-29Unify creation of blank image data arraysThomas White
2020-07-29Add --no-image-data and --no-mask-dataThomas White
2020-07-29Create detgeom and data arrays when reading from streamThomas White
2020-07-29Remove events.c, part 1Thomas White
2020-07-29Remove unused imagefile_typeThomas White
2020-07-29Reinstate mark_resolution_range_as_badThomas White
2020-07-29Move MessagePack stuff to separate fileThomas White
Note the nicer separation: ZMQ is in indexamajig only, whereas MessagePack becomes something generally accessible through libcrystfel.
2020-07-29Remove references to old headersThomas White
2020-07-29Remove "struct detector" completely, part IThomas White
record_image has been moved to pattern_sim.c
2020-07-29Remove image_reflection_closestThomas White
Not used anywhere!
2020-07-29Get rid of imagefile_field_list and stuff_from_streamThomas White
The only place this is used is in geoptimiser, to get the average_camera_length, itself a very bad solution.
2020-07-29Port indexamajig to new API, part IThomas White
2020-07-29Add image_expand_frames()Thomas White
2020-07-29Add image_read_peaks()Thomas White
Automatically detects file type, including HDF5 vs CXI
2020-07-29Remove "parent" from struct imagefeatureThomas White
It's not used anywhere, and removing it means that the image structure is no longer needed to search peaks
2020-07-29Add image_get_feature_const() and image_feature_list_copy()Thomas White
2020-07-29ImageFeatureList: Store panel number, not pointerThomas White
This makes the conversion to DataTemplate/detgeom MUCH easier.
2020-07-29Create detgeom structure on image loadThomas White
2020-07-29Basic image loading via new DataTemplate APIThomas White
2020-01-10Mass update of copyright datesThomas White
2019-09-12Avoid duplication of beam and detector parameters for pinkIndexerThomas White