|
@@ -0,0 +1,27 @@
|
|
|
+import load_local_neo_odml_elephant
|
|
|
+
|
|
|
+import os.path
|
|
|
+import neo
|
|
|
+from reachgraspio import reachgraspio
|
|
|
+
|
|
|
+
|
|
|
+def convert(session_path, overwrite=False):
|
|
|
+ rio = reachgraspio.ReachGraspIO(
|
|
|
+ filename=session_path,
|
|
|
+ odml_directory=os.path.dirname(session_path),
|
|
|
+ verbose=False)
|
|
|
+
|
|
|
+ block = rio.read_block(lazy=True)
|
|
|
+
|
|
|
+ if os.path.exists(session_path + '.nix') and not overwrite:
|
|
|
+ raise ValueError(f'Nix file {session_path + ".nix"} already exists.')
|
|
|
+
|
|
|
+ print('Saving to nix')
|
|
|
+ with neo.NixIO(session_path + '.nix', 'ow') as nio:
|
|
|
+ nio.write_block(block)
|
|
|
+
|
|
|
+if __name__ == '__main__':
|
|
|
+ # session = '../datasets/l101210-001'
|
|
|
+ session = '../datasets/i140703-001'
|
|
|
+
|
|
|
+ convert(session, overwrite=True)
|