|
@@ -6,12 +6,21 @@ and export collected data as CSV.
|
|
|
import argparse
|
|
|
import os
|
|
|
import re
|
|
|
+import typing
|
|
|
|
|
|
import pandas
|
|
|
|
|
|
from freesurfer_volume_reader import ashs, freesurfer, parse_version_string, \
|
|
|
remove_group_names_from_regex
|
|
|
|
|
|
+def concat_dataframes(dataframes: typing.Iterable[pandas.DataFrame]
|
|
|
+ ) -> pandas.DataFrame:
|
|
|
+
|
|
|
+ if parse_version_string(pandas.__version__) < (0, 23):
|
|
|
+ return pandas.concat(dataframes, ignore_index=True)
|
|
|
+ return pandas.concat(dataframes, ignore_index=True, sort=False)
|
|
|
+
|
|
|
+
|
|
|
VOLUME_FILE_FINDERS = {
|
|
|
'ashs': ashs.HippocampalSubfieldsVolumeFile,
|
|
|
|
|
@@ -52,11 +61,7 @@ def main():
|
|
|
volume_frame['source_type'] = source_type
|
|
|
volume_frame['source_path'] = volume_file.absolute_path
|
|
|
volume_frames.append(volume_frame)
|
|
|
-
|
|
|
- if parse_version_string(pandas.__version__) < (0, 23):
|
|
|
- united_volume_frame = pandas.concat(volume_frames, ignore_index=True)
|
|
|
- else:
|
|
|
- united_volume_frame = pandas.concat(volume_frames, ignore_index=True, sort=False)
|
|
|
+ united_volume_frame = concat_dataframes(volume_frames)
|
|
|
print(united_volume_frame.to_csv(index=False))
|
|
|
|
|
|
if __name__ == '__main__':
|