Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use mutating unionFeatureMountain! #1012

Merged
merged 1 commit into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ext/CaesarImagesExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import Caesar: PackedScatterAlignPose2, PackedScatterAlignPose3
import Caesar: ImageTracks, FEATURE_VIA, FeatTrackValue, FeaturesDict, FeatureTracks, FeatureMountain, PIXELTRACK, MANYTRACKS
import Caesar: addFeatureTracks_Frame1_Q!, addFeatureTracks_Frame2_PfwdQ!, addFeatureTracks_Frame2_QbckR!
import Caesar: addFeatureTracks, consolidateFeatureTracks!, summarizeFeatureTracks!, buildFeatureMountain, buildFeatureMountainDistributed
import Caesar: unionFeatureMountain, sortKeysMinSighting
import Caesar: unionFeatureMountain, unionFeatureMountain!, sortKeysMinSighting

# NOTE usage requires ImageFeatures.jl
import Caesar: curateFeatureTracks
Expand Down
28 changes: 23 additions & 5 deletions ext/Images/FeatureMountain.jl
Original file line number Diff line number Diff line change
Expand Up @@ -411,8 +411,6 @@ end

## union features



function unionFeatureMountain(
fMa::Dict{Tuple{Symbol,Int},MANYTRACKS},
fMb::Dict{Tuple{Symbol,Int},MANYTRACKS},
Expand All @@ -437,7 +435,27 @@ function unionFeatureMountain(
return rM
end


function unionFeatureMountain!(
fMa::Dict{Tuple{Symbol,Int},MANYTRACKS},
fMb::Dict{Tuple{Symbol,Int},MANYTRACKS},
)
# Modify fMa by adding everything from fMb
for (ka,va) in fMb
# @info ka
# union if already exists
if haskey(fMa, ka)
# @info "CHECK TYPES" typeof(fMb[ka]) typeof(fMa[ka])
for (kr,vr) in va
if !haskey(fMa[ka], kr)
fMa[ka][kr] = vr # union(fMb[ka], fMa[ka])
end
end
else
fMa[ka] = va
end
end
return fMa
end

function sortKeysMinSighting(
featM::Dict{Tuple{Symbol,Int},<:Any};
Expand Down Expand Up @@ -492,10 +510,10 @@ function buildFeatureMountainDistributed(
featM = deepcopy(featM_1[1])
# union other tracks into featM
for fM in featM_1[2:end]
featM = Caesar.unionFeatureMountain(featM, fM)
featM = Caesar.unionFeatureMountain!(featM, fM)
end
for fM in featM_2
featM = Caesar.unionFeatureMountain(featM, fM)
featM = Caesar.unionFeatureMountain!(featM, fM)
end

return featM
Expand Down
1 change: 1 addition & 0 deletions ext/WeakdepsPrototypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ function buildFeatureMountain end
function buildFeatureMountainDistributed end

function unionFeatureMountain end
function unionFeatureMountain! end
function sortKeysMinSighting end

## ==============================================
Expand Down
Loading