Skip to content

Write re-usable .fcsv python class #32

@hjmjohnson

Description

@hjmjohnson

As an Algortihm Developer,
I want to manipulate various .fcsv formats from python
so that a uniform API can be re-used for many purposes

Detailed Description

Generate a SlicerFiducials class to encapsulate the various common operations necessary for manipulating .fcsv files generated from the Slicer tools. Both historical and current .fcsv formats must be supported for reading and writing.

EXAMPLE_DIR='/Shared/sinapse/20190521_LandmarkIdentification/example'
OLD_FCSV='BCD_Original.fcsv'
NEW_FCSV='BCD_Original_markup.fcsv'
IMAGE='sub-XXXXX_ses-YYYYY_run-002_echo-1_T1w.nii.gz'

Tasks to be completed

  • Write a class that
  • can read (and autodetect) both the old and new formats
  • can write the landmark files in the new format
  • Class should be queryable for a single landmark physical point
  • if and the OPTIONAL image is given, query for a single landmark index location from that image
  • Given two landmark names, compute the Euclidean distance between those landmarks

Acceptance Criteria

Appendix

## Partial possible usecase
from slicerfiducials import SlicerFiducials

my_lmks_old = SlicerFiducials( 'BCD_Original.fcsv')
my_lmks_new = SlicerFiducials('BCD_Original_markup.fcsv', image='sub-XXXXX_ses-YYYYY_run-002_echo-1_T1w.nii.gz' )

## Compute IPD
ipd = my_lmks_old.euclidean_distance('RE','LE')

## compute difference between landmarks from two files
diff_lmks = SlicerFiducials.diff_files( my_lmks_old, my_lmks_new)

diff_lmks.Write('/tmp/diff.fcsv')

print(diff_lmks)

for name, point in my_lmks_new.iter():
    print(name)

## get a list of the landmark names
names =  my_lmks_new.names() 

Metadata

Metadata

Assignees

Labels

help wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions