CBICA / niCHART

The neuro-imaging brain aging chart [niCHART] is a comprehensive solution to analyze standard structural and functional brain MRI data across studies. [niCHART] and the associated pre-processing tools implement computational morphometry, functional signal analysis, quality control, statistical harmonization, data standardization, interactive visual
https://cbica.github.io/niCHART/
Other
13 stars 8 forks source link

Unexplained user errors #184

Closed melhemr closed 2 years ago

melhemr commented 2 years ago
Screen Shot 2022-03-10 at 3 10 28 PM Screen Shot 2022-03-10 at 3 12 26 PM

Using dataset and model supplied by Mathilde Antoniades

AbdulkadirA commented 2 years ago

@melhemr What is the age range in the data set? Which harmonization model was used? I think that the age range defined in datamodel.py of 25 to 95 was bigger than the one in the harmonization model. Thus, the age range should be extracted from the harmonization model.

melhemr commented 2 years ago

The dataset/harmonization model were created by Mathilde Antoniades when I was helping her to harmonize some PHENOM data. Weirdly, this only happened after trying to save the harmonized data to the dataset (as you can see in the error message, the traceback starts after saving modified data to pickle file, which means that harmonization had already taken place. I'm not sure why this has happened, but I have the datasets to try and recreate the problem.

AbdulkadirA commented 2 years ago

I think it is clear why it happens. I datamodel.py, the age range is set to 25 to 95. If the harmonization model has a smaller age range, it will crash. It only crashes once it tries to show one of the harmonized ROIs. The solution is to set the min and max to the min and max from the harmonization model instead of fixing it at 25 and 95.

Here is where the age range is set: https://github.com/CBICA/NiBAx/blob/185c32f4b74a6b4b96120714f086b00a1da02339/NiBAx/core/model/datamodel.py#L117

The max age can be obtained as follows (from harmonization.py)

age_max = self.datamodel.harmonization_model['smooth_model']['bsplines_constructor'].knot_kwds[0]['upper_bound']
age_min = self.datamodel.harmonization_model['smooth_model']['bsplines_constructor'].knot_kwds[0]['lower_bound']

I propose to add a function like GetMaxAgeOfMUSEHarmonizationModel() and GetMinAgeOfMUSEHarmonizationModel().

melhemr commented 2 years ago

@AbdulkadirA Great thank you for the suggestion! I also figured out that the other issue was due to the fact that this particular dataset included raw derived volumes, so when it came time to 'add the modified data', the list of column names included repeats. It will all make sense in the commit.

melhemr commented 2 years ago

age_min = self.datamodel.harmonization_model['smooth_model']['bsplines_constructor'].knot_kwds[0]['lower_bound']

Where would you put these functions? I got the functions to work, but they were defined within the GetNormativeRange function in datamodel.py, which doesn't seem correct

AbdulkadirA commented 2 years ago

@melhemr I propose to make them members of DataModel in NiBAx/core/model/datamodel.py, i.e. same level as GetNormativeRange().

melhemr commented 2 years ago

@melhemr I propose to make them members of DataModel in NiBAx/core/model/datamodel.py, i.e. same level as GetNormativeRange().

Screen Shot 2022-03-15 at 10 40 27 AM

When I put them on the same level, the functions appear as not defined (this is the error message that occurs when hovering over the yellow underlined functions)

ashishsingh18 commented 2 years ago

@melhemr I propose to make them members of DataModel in NiBAx/core/model/datamodel.py, i.e. same level as GetNormativeRange().

Screen Shot 2022-03-15 at 10 40 27 AM

When I put them on the same level, the functions appear as not defined (this is the error message that occurs when hovering over the yellow underlined functions)

@melhemr try calling the function as self.GetMinAgeOfMUSEHarmonizationModel(..)