Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

cleanup morphologyHDF5#285

Merged
mgeplf merged 5 commits intomasterfrom
cleanup_morphologyHDF5
May 5, 2021
Merged

cleanup morphologyHDF5#285
mgeplf merged 5 commits intomasterfrom
cleanup_morphologyHDF5

Conversation

@mgeplf
Copy link
Contributor

@mgeplf mgeplf commented Apr 15, 2021

  • make which datasets belong to which versions more clear
  • don't use try/catch to detect if datasets exist
  • try and clarify where member variables are read & saved
    • removed member variables _points, _pointsDims, _sections,
      since their locality can be kept local
  • fix version numbering in tests/data/h5/v1/endoplasmic-reticulum.h5
    mitochondria.h5
  • remove unnecessary morphio::

@mgeplf mgeplf added the WIP Work in Progress label Apr 15, 2021
@mgeplf mgeplf force-pushed the cleanup_morphologyHDF5 branch from f857bf6 to e7fbd40 Compare April 15, 2021 12:52
@mgeplf mgeplf requested a review from tomdele April 16, 2021 08:51
if (metadata.hasAttribute(_a_version)) {
const auto attr = metadata.getAttribute(_a_version);

std::array<uint32_t, 2> versions;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not initialized and I am not familiar with HighFive but shouldn't we init to something like : 0, 0 ?

if (vec.size() > 0) {
_points->read(vec.front().data());
if (hasNeurites) {
const size_t size = (points.size() + hd5fData.size() - section_offset);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for points.size() it should/must be 0 no ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@tomdele
Copy link
Contributor

tomdele commented Apr 20, 2021

I made the changes I proposed in :
#288
it also fixed the no soma problem.

If you are ok with this PR above we can merge both.

@asanin-epfl
Copy link
Contributor

Currently I have problems with hdf morphologies that have its soma points split among several offsets in structure:

HDF5 "scripts/three-point-soma-two-offset.h5" {
GROUP "/" {
   DATASET "points" {
      DATATYPE  H5T_IEEE_F32LE
      DATASPACE  SIMPLE { ( 8, 4 ) / ( 8, 4 ) }
      DATA {
      (0,0): -2, 0, 0, 1,
      (1,0): 0, 0, 0, 1,
      (2,0): 0, 0, 0, 1,
      (3,0): 2, 0, 0, 1,
      (4,0): 2, 0, 0, 1,
      (5,0): 3, 3, 0, 1,
      (6,0): 2, 0, 0, 1,
      (7,0): 4, 0, 4, 1
      }
   }
   DATASET "structure" {
      DATATYPE  H5T_STD_I32LE
      DATASPACE  SIMPLE { ( 4, 3 ) / ( 4, 3 ) }
      DATA {
      (0,0): 0, 1, -1,
      (1,0): 2, 1, -1,
      (2,0): 4, 3, 0,
      (3,0): 6, 2, 0
      }
   }
}
}

The 2nd half of soma is skipped and soma type is undefined.

three-point-soma-two-offset.h5
SomaType.SOMA_UNDEFINED
[[-2.  0.  0.]
 [ 0.  0.  0.]]
section points:
	 [2. 0. 0.]
	 [3. 3. 0.]
	 [2. 0. 0.]
	 [4. 0. 4.]

Should I be worried about this case when soma is represented by multiple offsets?

@tomdele
Copy link
Contributor

tomdele commented Apr 22, 2021

Do we have specs on that ?
Having unifurcation on Neurites --> why not, but on Somas...

To me without more specs (like: " we can have only one soma"), this is an undefined behavior an we should raise because we cannot figure out if this is double soma morphology (one single point soma and one cylinder soma) or if this is a poorly formatted 3 points soma.

@asanin-epfl
Copy link
Contributor

Do we have specs on that ?

There is something: "Soma: there is only one soma section, however, different tools interpret them differently:" (c). I propose to throw en exception for this case as we don't throw currently on the latest master branch.

@tomdele
Copy link
Contributor

tomdele commented Apr 22, 2021

Ok so we throw. I will update the code

@tomdele
Copy link
Contributor

tomdele commented Apr 22, 2021

Added a check here to ensure a single section soma and the soma being the first section:
f7c1c6a

mgeplf and others added 2 commits April 23, 2021 11:23
* make which datasets belong to which versions more clear
* don't use try/catch to detect if datasets exist
* try and clarify where member variables are read & saved
  * removed member variables _points, _pointsDims, _sections,
    since their locality can be kept local
* fix version numbering in tests/data/h5/v1/endoplasmic-reticulum.h5
                                            mitochondria.h5
* remove unnecessary `morphio::`
* Fix the no soma h5 morphologies
* wrong type for the structure
* fix data again
* Remove the size necessarily equal to zero.
* remove cassert
* Multiple sections soma
@tomdele tomdele force-pushed the cleanup_morphologyHDF5 branch from 2a888cf to 60f695a Compare April 23, 2021 09:35
@tomdele tomdele requested a review from asanin-epfl April 23, 2021 13:46
@tomdele
Copy link
Contributor

tomdele commented Apr 23, 2021

I put you as a reviewer but this is more to know if you have something to add or comment @asanin-epfl

@asanin-epfl
Copy link
Contributor

From my side looks fine. I'm working on docs update currently, so it's good for me. Also a question, should be a similar PR for the ASC reader?

mgeplf added 2 commits May 4, 2021 13:02
* test for extra somas/out of order during traversal of sections
* 100 % coverage
* added explicit glia tests
@mgeplf mgeplf removed the WIP Work in Progress label May 4, 2021
@mgeplf mgeplf requested a review from tomdele May 5, 2021 12:56
Comment on lines +238 to +241
bool hasSoma = true;
if (static_cast<SectionType>(vec[0][SECTION_TYPE]) != SECTION_SOMA) {
hasSoma = false;
} else if (vec.size() == 1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indeed much better

Copy link
Contributor

@tomdele tomdele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good !

@mgeplf
Copy link
Contributor Author

mgeplf commented May 5, 2021

I also tested it w/ NeuroM d177237, as cross check.

@mgeplf mgeplf merged commit 8e2a38f into master May 5, 2021
@mgeplf mgeplf deleted the cleanup_morphologyHDF5 branch May 5, 2021 15:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants