Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify explicitly tracking software used for input #16

Open
pcmasuzzo opened this issue Apr 26, 2017 · 1 comment
Open

Specify explicitly tracking software used for input #16

pcmasuzzo opened this issue Apr 26, 2017 · 1 comment
Assignees

Comments

@pcmasuzzo
Copy link
Member

pcmasuzzo commented Apr 26, 2017

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.

@simleo
Copy link
Member

simleo commented Apr 26, 2017

We can add an option to force a specific format and fall back to some default for known file extensions (we do something similar in Bio-Formats).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants