diff options
author | Thomas White <taw@physics.org> | 2023-12-20 13:52:51 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2024-02-06 16:59:34 +0100 |
commit | 6f801ee7d0823ad952ce2478a026a5059f13b380 (patch) | |
tree | f0f98f6498c6b25e86eb3d6be8230bfbfbe82b64 | |
parent | cbaf344d7716efb89e0edb6fbfedddf62d1fff65 (diff) |
Julia: Add chunkwrite()
-rw-r--r-- | julia/CrystFEL/src/CrystFEL.jl | 2 | ||||
-rw-r--r-- | julia/CrystFEL/src/streams.jl | 26 |
2 files changed, 26 insertions, 2 deletions
diff --git a/julia/CrystFEL/src/CrystFEL.jl b/julia/CrystFEL/src/CrystFEL.jl index 017bd530..7db1ba19 100644 --- a/julia/CrystFEL/src/CrystFEL.jl +++ b/julia/CrystFEL/src/CrystFEL.jl @@ -62,7 +62,7 @@ export Indexer, index include("streams.jl") using .Streams -export Stream +export Stream, chunkwrite include("millepede.jl") using .Millepede diff --git a/julia/CrystFEL/src/streams.jl b/julia/CrystFEL/src/streams.jl index 94a1de17..d0b98f5f 100644 --- a/julia/CrystFEL/src/streams.jl +++ b/julia/CrystFEL/src/streams.jl @@ -2,7 +2,8 @@ module Streams import ..CrystFEL: libcrystfel import ..CrystFEL.DataTemplates: DataTemplate, InternalDataTemplate -export Stream +import ..CrystFEL.Images: Image, InternalImage +export Stream, chunkwrite # Represents the real C-side (opaque) structure. mutable struct InternalStream end @@ -77,4 +78,27 @@ function Base.close(st::Stream) end +function streamflags(peaks, reflections, imagedata) + flags = 0 + if reflections + flags |= 2 + end + if peaks + flags |= 4 + end + if imagedata + flags |= 8 + end + return flags +end + + +function chunkwrite(st::Stream, image::Image; peaks=true, reflections=true) + flags = streamflags(peaks, reflections, false) + @ccall libcrystfel.stream_write_chunk(st.internalptr::Ptr{InternalStream}, + image.internalptr::Ptr{InternalImage}, + flags::Cint)::Cvoid +end + + end # of module |