As for now, the library has one reader ([readfile.py](https://github.com/CellMigStandOrg/cell_track_dpkg/blob/master/dpkg/readfile.py)), which reads file input depending on tracking software used:
def read_file(f, track_dict):
"""Takes file from command line.
Keyword arguments:
f -- the file (from command line)
track_dict -- only needed for some file formats!
"""
# check for file extension
if f.endswith('.xls'):
# first thing, try to convert it to a plain csv
try:
xls_to_csv(f)
name, extension = os.path.splitext(f)
f = name + '.csv'
print('XLS converted into csv...')
except XLRDError:
# copy the file and save it as csv
import shutil
name, extension = os.path.splitext(f)
shutil.copyfile(f, name + '.csv')
f = name + '.csv'
print('Not an excel file.' + ' Copied and simply renamed to csv.')
elif f.endswith('.xml'):
# right now XML associated only to TrackMate, might not be the case in
# the future
(objects, links) = read_trackMate(f)
print('Successfully parsed a TrackMate XML file...')
if f.endswith('.csv'):
It would be much more clear and less error-prone to force the usage of a specific reader for each of the tracking software covered by the library.
As for now, the library has one reader (
[readfile.py](https://github.com/CellMigStandOrg/cell_track_dpkg/blob/master/dpkg/readfile.py)
), which reads file input depending on tracking software used:It would be much more clear and less error-prone to force the usage of a specific reader for each of the tracking software covered by the library.