aboutsummaryrefslogtreecommitdiff
path: root/julia/CrystFEL/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2023-10-13 09:09:50 +0200
committerThomas White <taw@physics.org>2024-02-06 16:59:34 +0100
commit87aa2caf1a226bfea9b6011412dd1a4e47330fa2 (patch)
tree842c316bea5811665cf0bb1572bd606cd77fc663 /julia/CrystFEL/src
parent99be17bf7d70046c9ef67d52b200241e67d54dcc (diff)
WIP on images
Diffstat (limited to 'julia/CrystFEL/src')
-rw-r--r--julia/CrystFEL/src/CrystFEL.jl4
-rw-r--r--julia/CrystFEL/src/detgeom.jl22
-rw-r--r--julia/CrystFEL/src/image.jl34
3 files changed, 59 insertions, 1 deletions
diff --git a/julia/CrystFEL/src/CrystFEL.jl b/julia/CrystFEL/src/CrystFEL.jl
index 859c8833..5afa9920 100644
--- a/julia/CrystFEL/src/CrystFEL.jl
+++ b/julia/CrystFEL/src/CrystFEL.jl
@@ -15,6 +15,10 @@ include("detgeom.jl")
using .DetGeoms
export Panel, DetGeom
+include("image.jl")
+using .Images
+export Image
+
include("symmetry.jl")
using .Symmetry
export SymOpList
diff --git a/julia/CrystFEL/src/detgeom.jl b/julia/CrystFEL/src/detgeom.jl
index 622883ad..d394ee7b 100644
--- a/julia/CrystFEL/src/detgeom.jl
+++ b/julia/CrystFEL/src/detgeom.jl
@@ -37,6 +37,13 @@ mutable struct Panel
end
+mutable struct DetGeom
+ panels::Ptr{Panel}
+ n_panels::Cint
+ top_group::Ptr{Cvoid}
+end
+
+
"""
Panel(name, width, height, (cnx, cny), clen, (fsx,fsy,fsz), (ssx,ssy,ssz), pixelsize, aduperphoton)
@@ -97,7 +104,20 @@ end
Create a CrystFEL `DetGeom` from a vector of `Panel`s. Optionally set the
panel group which should be the top of the hierarchy.
"""
-function DetGeom(panels; topgroup=nothing)
+function DetGeom(panels; topgroup=C_NULL)
+
+ pmem = Base.Libc.malloc(sizeof(panels[1])*length(panels))
+
+ for (i,panel) in enumerate(panels)
+ Base.unsafe_copyto!(pmem, pointer(panel), 1)
+ end
+
+ dg = DetGeom(pmem, length(panels), topgroup)
+
+ finalize(dg) do x
+ Base.Libc.free(dg.panels)
+ end
+
end
end # of module
diff --git a/julia/CrystFEL/src/image.jl b/julia/CrystFEL/src/image.jl
new file mode 100644
index 00000000..e73e5f9a
--- /dev/null
+++ b/julia/CrystFEL/src/image.jl
@@ -0,0 +1,34 @@
+module Images
+export Image
+
+guardian = []
+
+function protect(guardian, obj)
+ push!(guardian, obj)
+ obj
+end
+
+function unprotect(guardian, obj)
+ let pos = findfirst(==(obj), guardian)
+ if pos !== nothing
+ deleteat!(guardian, pos)
+ end
+ end
+end
+
+
+mutable struct Image
+end
+
+
+"""
+ Image()
+
+Create a CrystFEL image structure
+"""
+function Image(panels)
+
+
+end
+
+end # of module