-
-
Notifications
You must be signed in to change notification settings - Fork 119
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
Periodic Khalimsky space and pre-Khalimsky space. #1086
Periodic Khalimsky space and pre-Khalimsky space. #1086
Conversation
So in (u|s)IsInside and (u|s)Get(Min|Max) too. The bug does not concerns full-dimension cells. Thus, the only affected file may be geometry/curves/GridCurves.ih (to be verified).
It was concerning cells that have not the maximal dimension. No other files in DGtal was impacted by this bug.
It would be nice also to document the user guide to KhalimskySpaceND accordingly (to add to todo list). |
And avoiding bit shift when possible, since compiler optimizes it anyway. Warning: the right bit-shift behaves differently than division for negative values (truncation).
To be compatible with periodic Khalimsky space.
I have checked some classes to see if the syntax is compatible with periodic Khalimsky Space. Not compatible syntax is e.g.:
The checked files and methods are listed in the todo list. Some methods of |
@JacquesOlivierLachaud could you please review this PR ? |
Looks great to me. Just 3 remarks:
|
I also see a file named |
Yes, you are right. You can remove it. |
Ok. I'll also rename |
Done |
Just fix the conflicts (in packageTopologyConcepts1.dox and KhalimskySpaceND.h) and we can merge. |
At least, all DGtalTools compile with these modifications. I have checked a few tools and they work. |
Yes, I have already checked DGtalTools (see the end of this PR's todolist). Actually, this PR helps me to found some bugs in DGtalTools (see DGtal-team/DGtalTools#256) and I have some fixes to pull to DGtalTools now. |
Actually, Travis now tries to compile the DGtaltools for each PR (see Travis.Yml). |
Thanks everyone for this nice PR |
Finally, after 6 months 😅 |
Introduction
This PR adds the possibility to specify a different closure type for each dimension, and to define periodic dimensions. In addition, some bugs in
KhalimskySpaceND
have been fixed.To ensure that the cells coordinates keep valid (ie inside the boundaries, even for periodic dimensions), many checks have been added in
KhalimskySpaceND
methods to enforce valid manipulation of the cells.Therefore, in order to keep the ability of low-level coordinate modification, the new class
KhalimskyPreSpaceND
model an unbounded cellular grid space that manipulates so-called pre-cell. All his methods are static and allow fast and unchecked read/write of the pre-cells.Pre-Space
Even if the conversion cell to pre-cell is allowed, the reverse conversion is only possible through dedicated methods of
KhalimskySpaceND
.CPreCellularGridSpace
is a new concept forKhalimskyPreSpaceND
andCCellularGridSpace
now depends onCPreCellularGridSpace
plus few methods related to the bounds.Periodic Khalimsky space
Along a periodic dimension, it is always possible to translate a cell without going out of space (
(u|s)IsInside
returns always true andIsMin
&IsMax
return always false). The Khalimsky coordinates returned by(u|s)KCoords
are always between2*myLower[k]
(like a closed dimension) and2*myUpper[k]+1
(like an open dimension) wheremyLower
andmyUpper
are the digital bounds given in theinit
method.(u|s)GetMin
,(u|s)GetMax
,(u|s)First
and(u|s)Last
return cells based on the reference domain bounds (like(u|s)KCoords
).Thus, storage classes based on a periodic Khalimsky space will only see cells in the reference domain (unless for cells whose coordinates were modified by hand, without using
KhalimskySpaceND
methods). In particular, the cubical complex PR #1079 is compatible with periodic Khalimsky space, at least for the collapsing function.The previous interface is kept unchanged (in particular the
init
method with only a bool to specify closed space) and thus, current code usingKhalimskySpaceND
should work like before.When using different closure type per dimension, or for periodic spaces, the method
isSpaceClosed
returns true if every dimension is closed (non-periodic) or periodic. Thus, ifisSpaceClosed
returns false, it doesn't mean that the space is open.Checklist
KhalimskySpaceND
, especially the behaviour of each method with periodic dimension.CCellularGridSpaceND
?Adding a template parameter to optimize the code when periodicity is not needed (the current performance impact must be tested).SurfelNeighborhood
(comparison withKhalimskySpaceND::min
&KhalimskySpaceND::max
),SurfelAdjacency
,ExplicitDigitalSurface
,Surfaces
:( as an issue )extractAllPointContours4C
(direct coordinates manipulation),sWriteBoundary
(direct coordinates manipulation),uFillInterior
(comparison withuGetMax
),cmake
mode (otherwise, Travis C.I. will fail).KSpace
(fromgrep -rl 'KSpace' *
)KhalimskySpace
orKSpace
and comparing it to the master.When possible, make classes use( as an issue )KhalimskyPreSpace
as default Khalimsky space and/or weaken concept check (to CPreCellularGridSpace).Disclaimer
Adding periodic dimensions implies to guarantee validity of the cells (to avoid too high extra computational cost of
KhalimskySpaceND
methods). Therefore, it was needed to deeply refactor this class and that explains this huge PR...The positive part is that highlights suspicious usages of
KhalimskySpaceND
(actually, some bugs was discovered) and features strong foundations for future classes that rely on bounded spaces.