Skip to content

Specify explicitly tracking software used for input #16

Open
@pcmasuzzo

Description

@pcmasuzzo

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions