libcrystfel  0.10.1
Macros | Typedefs | Enumerations | Functions
stream.h File Reference

Macros

#define STREAM_GEOM_START_MARKER   "----- Begin geometry file -----"
 
#define STREAM_GEOM_END_MARKER   "----- End geometry file -----"
 
#define STREAM_CELL_START_MARKER   "----- Begin unit cell -----"
 
#define STREAM_CELL_END_MARKER   "----- End unit cell -----"
 
#define STREAM_CHUNK_START_MARKER   "----- Begin chunk -----"
 
#define STREAM_CHUNK_END_MARKER   "----- End chunk -----"
 
#define STREAM_PEAK_LIST_START_MARKER   "Peaks from peak search"
 
#define STREAM_PEAK_LIST_END_MARKER   "End of peak list"
 
#define STREAM_CRYSTAL_START_MARKER   "--- Begin crystal"
 
#define STREAM_CRYSTAL_END_MARKER   "--- End crystal"
 
#define STREAM_REFLECTION_START_MARKER   "Reflections measured after indexing"
 
#define STREAM_REFLECTION_END_MARKER   "End of reflections"
 

Typedefs

typedef struct _stream Stream
 
typedef struct _streamindex StreamIndex
 

Enumerations

enum  StreamFlags {
  STREAM_REFLECTIONS = 2,
  STREAM_PEAKS = 4,
  STREAM_DATA_DETGEOM = 8
}
 

Functions

Streamstream_open_for_read (const char *filename)
 
Streamstream_open_for_write (const char *filename, const DataTemplate *dtempl)
 
Streamstream_open_fd_for_write (int fd, const DataTemplate *dtempl)
 
void stream_close (Stream *st)
 
void stream_write_geometry_file (Stream *st, const char *geom_filename)
 
void stream_write_target_cell (Stream *st, UnitCell *cell)
 
void stream_write_commandline_args (Stream *st, int argc, char *argv[])
 
void stream_write_indexing_methods (Stream *st, const char *indm_str)
 
int stream_has_old_indexers (Stream *st)
 
char * stream_audit_info (Stream *st)
 
char * stream_geometry_file (Stream *st)
 
int stream_get_fd (Stream *st)
 
int stream_rewind (Stream *st)
 
StreamIndex * stream_make_index (const char *filename)
 
int stream_select_chunk (Stream *st, StreamIndex *index, const char *filename, const char *ev)
 
void stream_index_free (StreamIndex *index)
 
struct imagestream_read_chunk (Stream *st, StreamFlags srf)
 
int stream_write_chunk (Stream *st, const struct image *image, StreamFlags srf)
 

Detailed Description

Stream functions (for indexing results)

Typedef Documentation

◆ Stream

typedef struct _stream Stream

An opaque structure representing a stream being read or written

Enumeration Type Documentation

◆ StreamFlags

A bitfield of things that can be read from or written to a stream. Use this together with stream_{read,write}_chunk to read/write the stream faster if you don't need all the information.

General information about crystals (including unit cell parameters) is always read and written.

Enumerator
STREAM_REFLECTIONS 

Read the integrated reflections

STREAM_PEAKS 

Read the peak search results

STREAM_DATA_DETGEOM 

Reconstruct the detgeom structure, and create (blank) data/mask arrays. (NB this is (currently) a slow operation)

Function Documentation

◆ stream_close()

void stream_close ( Stream st)
Parameters
stA Stream

Closes the stream

◆ stream_open_fd_for_write()

Stream* stream_open_fd_for_write ( int  fd,
const DataTemplate dtempl 
)
Parameters
fdFile descriptor (e.g. from open()) to use for stream data.

Creates a new Stream from fd, so that stream data can be written to fd using stream_write_chunk.

In contrast to stream_open_for_write, this function does not write any of the usual headers. This function is mostly for use when multiple substreams need to be multiplexed into a single master stream. The master would be opened using stream_open_for_write, and the substreams using this function.

Returns
A Stream, or NULL on failure.

◆ stream_open_for_write()

Stream* stream_open_for_write ( const char *  filename,
const DataTemplate dtempl 
)
Parameters
filenameFilename of new stream
dtemplA DataTemplate

Creates a new stream with name filename. If filename already exists, it will be overwritten.

Audit information (e.g. CrystFEL version number) will be written.

Returns
A Stream, or NULL on failure.

◆ stream_read_chunk()

struct image* stream_read_chunk ( Stream st,
StreamFlags  srf 
)

Read the next chunk from a stream and return an image structure

◆ stream_rewind()

int stream_rewind ( Stream st)
Parameters
stA Stream

Attempts to set the file pointer for st to the start of the stream, so that later calls to stream_read_chunk will repeat the sequence of chunks from the start.

Programs must not assume that this operation always succeeds!

Returns
Non-zero if the stream could not be rewound.

◆ stream_write_chunk()

int stream_write_chunk ( Stream st,
const struct image i,
StreamFlags  srf 
)
Parameters
stA Stream
iAn image structure
srfA StreamFlags enum saying what to write

Writes a new chunk to st.

Returns
non-zero on error.

◆ stream_write_commandline_args()

void stream_write_commandline_args ( Stream st,
int  argc,
char *  argv[] 
)
Parameters
stA Stream
argcnumber of arguments
argvcommand-line arguments

Writes the command line to st. argc and argv should be exactly as were given to main(). This should usually be called immediately after stream_open_for_write.

◆ stream_write_geometry_file()

void stream_write_geometry_file ( Stream st,
const char *  geom_filename 
)
Parameters
stA Stream
geom_filenamegeomtry file name

Writes the content of the geometry file to st. This should usually be called immediately after write_command.