Browse Source

rename column: `volume` -> `volume_mm^3`

```matlab
% - resolution: voxel size at which we want to work (in mm).
```
https://github.com/freesurfer/freesurfer/blob/release_6_0_0/HippoSF/src/segmentSubjectT1T2_autoEstimateAlveusML.m#L8

```matlab
vol=resolution^3*(sum(sum(sum(double(posteriorsFull(:,:,:,i))/65535))));
fprintf(fid,'%s %f\n',str,vol);
```
https://github.com/freesurfer/freesurfer/blob/release_6_0_0/HippoSF/src/segmentSubjectT1T2_autoEstimateAlveusML.m#L1945
Fabian Peter Hammerle 5 years ago
parent
commit
6c7366a6cb

+ 2 - 2
examples/barplot.py

@@ -33,7 +33,7 @@ def main():
     for hemisphere in ['left', 'right']:
         pyplot.ylim(0, 750)
         ax = seaborn.barplot(data=volume_frame_subfields[volume_frame_subfields['hemisphere'] == hemisphere],
-                             x='subfield', y='volume',
+                             x='subfield', y='volume_mm^3',
                              hue='subfield_segmentation_mode')
         ax.set_title('Hippocampal Subfield Volumes of Subject {}'.format(args.subject)
                      + '\n{} Hemisphere'.format(str.capitalize(hemisphere)))
@@ -41,7 +41,7 @@ def main():
         pyplot.clf()
     seaborn.set(font_scale=0.4)
     ax = seaborn.barplot(data=volume_frame[volume_frame['subfield'] == 'Whole_hippocampus'],
-                         x='hemisphere', y='volume',
+                         x='hemisphere', y='volume_mm^3',
                          hue='subfield_segmentation_mode')
     ax.set_title('Hippocampal Volume of Subject {}'.format(args.subject))
     pyplot.savefig('hippocampal_volume_{}.png'.format(args.subject))

+ 1 - 1
freesurfer_volume_reader/__init__.py

@@ -51,7 +51,7 @@ def parse_hippocampal_volume_file_path(volume_file_path: str) -> dict:
 def read_hippocampal_volume_file_dataframe(volume_file_path: str) -> pandas.DataFrame:
     volumes_frame = pandas.DataFrame(
         read_hippocampal_volumes_mm3(volume_file_path).items(),
-        columns=['subfield', 'volume'])
+        columns=['subfield', 'volume_mm^3'])
     for key, value in parse_hippocampal_volume_file_path(volume_file_path).items():
         volumes_frame[key] = value
     # volumes_frame['hemisphere'] = volumes_frame['hemisphere'].astype('category')

+ 4 - 4
tests/hippocampus_test.py

@@ -116,9 +116,9 @@ def test_parse_hippocampal_volume_file_path_invalid(volume_file_path):
          'subfield': ['Hippocampal_tail', 'subiculum', 'CA1', 'hippocampal-fissure',
                       'presubiculum', 'parasubiculum', 'molecular_layer_HP', 'GC-ML-DG',
                       'CA3', 'CA4', 'fimbria', 'HATA', 'Whole_hippocampus'],
-         'volume': [173.456789, 734.567891, 34.567891, 345.678917, 456.789173, 45.678917,
-                    56.789173, 567.891734, 678.917345, 789.173456, 89.173456, 91.734567,
-                    1734.567899],
+         'volume_mm^3': [173.456789, 734.567891, 34.567891, 345.678917, 456.789173, 45.678917,
+                         56.789173, 567.891734, 678.917345, 789.173456, 89.173456, 91.734567,
+                         1734.567899],
          'subject': 'alice',
          'hemisphere': 'left',
          'T1_input': True,
@@ -134,7 +134,7 @@ def test_read_hippocampal_volume_file_dataframe(volume_file_path, expected_dataf
 
 
 def assert_volume_frames_equal(left: pandas.DataFrame, right: pandas.DataFrame):
-    sort_by = ['volume', 'analysis_id']
+    sort_by = ['volume_mm^3', 'analysis_id']
     left.sort_values(sort_by, inplace=True)
     right.sort_values(sort_by, inplace=True)
     left.reset_index(inplace=True, drop=True)

+ 1 - 1
tests/subjects/bert/hippocampal-volumes.csv

@@ -1,4 +1,4 @@
-subfield,volume,subject,hemisphere,T1_input,analysis_id
+subfield,volume_mm^3,subject,hemisphere,T1_input,analysis_id
 Hippocampal_tail,123.456789,bert,left,True,
 subiculum,234.567891,bert,left,True,
 CA1,34.567891,bert,left,True,