Skip to content
Snippets Groups Projects
Commit 922a63b7 authored by François  LAURENT's avatar François LAURENT
Browse files

fixes #38

parent 86b177f6
No related branches found
No related tags found
No related merge requests found
Pipeline #82028 failed
......@@ -858,10 +858,8 @@ uuid = "eebad327-c553-4316-9ea0-9fa01ccd7688"
version = "0.1.1"
[[deps.PlanarLarvae]]
deps = ["DelimitedFiles", "JSON3", "MAT", "Meshes", "OrderedCollections", "StaticArrays", "StructTypes"]
git-tree-sha1 = "f45e4befaca93ceeab1830cce9239394ac01c45d"
repo-rev = "main"
repo-url = "https://gitlab.pasteur.fr/nyx/planarlarvae.jl"
deps = ["DelimitedFiles", "JSON3", "MAT", "Meshes", "OrderedCollections", "SHA", "StaticArrays", "StructTypes"]
path = "../PlanarLarvae"
uuid = "c2615984-ef14-4d40-b148-916c85b43307"
version = "0.4.0"
......
......@@ -16,7 +16,6 @@ Observables = "510215fc-4207-5dde-b226-833fc4488ee2"
ObservationPolicies = "6317928a-6b1a-42e8-b853-b8e2fc3e9ca3"
OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
PlanarLarvae = "c2615984-ef14-4d40-b148-916c85b43307"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
TidyObservables = "c8131bbd-73a8-4254-a42d-d5d4c5febb31"
......
module LarvaTagger
using PlanarLarvae, PlanarLarvae.Chore, PlanarLarvae.Trxmat, PlanarLarvae.Datasets,
PlanarLarvae.FIMTrack
PlanarLarvae.FIMTrack, PlanarLarvae.Loaders
using ObservationPolicies
using TidyObservables
......@@ -16,26 +16,8 @@ using Observables
using Meshes
using Logging
import Dates
using SHA
using OrderedCollections
# move this into PlanarLarvae.jl
function guessfileformat(path)
f = open(path, "r")
try
s = String(read(f, 19))
(s == "MATLAB 7.3 MAT-file") && return :trx
isnothing(match(r"^[0-9]{8}_[0-9}{6}\s\[0-9]*$", s)) || return :chore
isnothing(match(r"^\{\s*\"", s)) || return :json
isnothing(match(r"^,larva\([0-9]+", s)) || return :fimtrack
finally
close(f)
end
end
#
export larvaviewer, larvaeditor
include("misc.jl")
......
......@@ -62,13 +62,13 @@ struct FilterEvents
allow_multiple_tags::Observable{Bool}
end
FilterEvents() = FilterEvents(Observable{LarvaID}(0), Observable(false))
FilterEvents() = FilterEvents(Observable{LarvaID}(NoLarva), Observable(false))
function filterevents(controller)
events = get!(gethub(controller), :filterevents, FilterEvents())
if isempty(Observables.listeners(events.discard_larva_edits))
on(events.discard_larva_edits) do id
@assert 0 < id
@assert id != NoLarva
larva = getlarva(controller, id)
empty!(larva.usertags[])
end
......
......@@ -274,8 +274,7 @@ function savetofile(controller, file; datafile=nothing)
end
end
datafilepath = isfile(datafile) ? datafile : joinpath(cwd(controller), datafile)
get!(dataset.attributes, :dependencies,
Dict(:filename=>basename(datafile), :sha1=>checksum(datafilepath)))
push_dependency!(dataset, datafilepath)
PlanarLarvae.Datasets.to_json_file(filepath, dataset)
end
end
......@@ -329,20 +328,7 @@ function read_json_labels(path)
end
#
datadir = dirname(path)
deps = run.attributes[:dependencies]
if deps isa Vector
deps = Dict{Symbol, String}[Dict(Symbol(key)=>val
for (key, val) in pairs(dep))
for dep in deps]
else
deps = [Dict{Symbol, String}(Symbol(key)=>val for (key, val) in deps)]
end
run.attributes[:dependencies] = deps
datafile = nothing
for dep in deps
datafile = joinpath(datadir, dep[:filename])
checksum(datafile) == dep[:sha1] || throw("checksums do not equal")
end
datafile = get_dependencies(run, path)[1]
datafmt = guessfileformat(datafile)
data′= nothing
if datafmt === :trx
......
......@@ -451,7 +451,7 @@ end
function larvafilter(larvae, controller::ControllerHub; kwargs...)
entries = [larvainfo(controller, id) for id in keys(larvae)]
on(async_latest(getactivelarva(controller))) do id
if 0 < id
if id != NoLarva
for entry in entries
if id == entry.id
entry.reviewed[] = true
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment