![]() |
![]() |
![]() |
CrystFEL Reference Manual | ![]() |
---|---|---|---|---|
Top | Description |
typedef Stream; enum StreamReadFlags; #define CHUNK_END_MARKER #define CHUNK_START_MARKER #define CRYSTAL_END_MARKER #define CRYSTAL_START_MARKER #define PEAK_LIST_END_MARKER #define PEAK_LIST_START_MARKER #define REFLECTION_END_MARKER #define REFLECTION_START_MARKER #define GEOM_END_MARKER #define GEOM_START_MARKER Stream * open_stream_fd_for_write (int fd
); Stream * open_stream_for_read (const char *filename
); Stream * open_stream_for_write (const char *filename
); Stream * open_stream_for_write_2 (const char *filename
,const char *geom_filename
,int argc
,char *argv[]
); int get_stream_fd (Stream *st
); void close_stream (Stream *st
); int read_chunk (Stream *st
,struct image *image
); int read_chunk_2 (Stream *st
,struct image *image
,StreamReadFlags srf
); void write_chunk (Stream *st
,struct image *image
,struct hdfile *hdfile
,int include_peaks
,int include_reflections
); int rewind_stream (Stream *st
); int is_stream (const char *filename
); void write_command (Stream *st
,int argc
,char *argv[]
); void write_geometry_file (Stream *st
,const char *geom_filename
);
typedef enum { STREAM_READ_UNITCELL = 1, STREAM_READ_REFLECTIONS = 2, STREAM_READ_PEAKS = 4, STREAM_READ_CRYSTALS = 8, } StreamReadFlags;
A bitfield of things that can be read from a stream. Use this (and
read_chunk_2()
) to read the stream faster if you don't need the entire
contents of the stream.
Using either or both of STREAM_READ_REFLECTIONS
and STREAM_READ_UNITCELL
implies STREAM_READ_CRYSTALS
.
Stream * open_stream_fd_for_write (int fd
);
Creates a new Stream
from fd
, so that stream data can be written to fd
using write_chunk()
.
In contrast to open_stream_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 open_stream_for_write()
, and the substreams using this function.
|
File descriptor (e.g. from open() ) to use for stream data. |
Returns : |
a Stream , or NULL on failure. |
Stream * open_stream_for_write (const char *filename
);
Creates a new stream with name filename
, and adds the stream format
and version headers.
You may want to follow this with a call to write_command()
to record the
command line.
|
Filename of new stream |
Returns : |
a Stream , or NULL on failure. |
Stream * open_stream_for_write_2 (const char *filename
,const char *geom_filename
,int argc
,char *argv[]
);
Creates a new stream with name filename
, and adds the stream format
and version header, plus a verbatim copy of the geometry file
You may want to follow this with a call to write_command()
to record the
command line.
|
Filename of new stream |
|
The geometry filename to copy |
|
The number of arguments to the program |
|
The arguments to the program |
Returns : |
a Stream , or NULL on failure. |
int get_stream_fd (Stream *st
);
This function gets the integer file descriptor for st
, a bit like fileno()
.
This is useful in conjunction with open_stream_fd_for_write()
, to get the
underlying file descriptor to which the multiplexed stream data should be
written. In this case, the only other operations you should ever do (or have
done) on st
are open_stream_for_write()
and close_stream()
.
|
A Stream
|
Returns : |
an integer file descriptor |
void write_chunk (Stream *st
,struct image *image
,struct hdfile *hdfile
,int include_peaks
,int include_reflections
);
int rewind_stream (Stream *st
);
Attempts to set the file pointer for st
to the start of the stream, so that
later calls to read_chunk()
will repeat the sequence of chunks from the
start.
Programs must not assume that this operation always succeeds!
|
A Stream
|
Returns : |
non-zero if the stream could not be rewound. |
void write_command (Stream *st
,int argc
,char *argv[]
);
Writes the command line to st
. argc
and argv
should be exactly as were
given to main()
. This should usually be called immediately after
open_stream_for_write()
.
|
A Stream
|
|
number of arguments |
|
command-line arguments |
void write_geometry_file (Stream *st
,const char *geom_filename
);
Writes the content of the geometry file to st
. This should usually be
called immediately after write_command()
.
|
A Stream
|
|
geomtry file name |