Skip to content

Commit cae8990

Browse files
committed
physiological file download path
add raisinbread sql [SQL/MEG] Add the MEG CTF head shape tables (#10412) The MEG CTF format uses a `headshape.pos` file to register the head shape of the participant. This file is CTF-specific but BIDS-standard (the BIDS MEG specification basically allows to use native files of all specific data types), and is usually shared across all the MEG acquisitions of a session. This adds some tables to register this data in the LORIS physiological database and link it to the relevant MEG files. The `headshape.pos` file format is unfortunately very sparsely documented. It is a textual file format whose contents looks like this: ``` 85 1 5.60644227 -6.38055462 0.79194871 2 8.06310971 -4.72750212 0.59046631 3 7.58675759 -5.78050209 3.05185917 ... NAS 8.57169649 -0.14219376 -3.33998151 LPA -0.58286578 7.02263278 0.27529669 RPA -1.40471662 -7.10183109 0.57320080 ``` The first line is the number of points. The coordinates are in centimeters. It might be useful to use a proper `physiological_coord_system` in the future, but this can easily be added later IMO, so I'd like to start by merging this minimal implementation.
1 parent ed5228f commit cae8990

6 files changed

Lines changed: 27 additions & 12 deletions

File tree

SQL/0000-00-05-ElectrophysiologyTables.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ CREATE TABLE `physiological_file` (
5454
`AcquisitionTime` DATETIME DEFAULT NULL,
5555
`InsertedByUser` VARCHAR(50) NOT NULL,
5656
`FilePath` VARCHAR(255) NOT NULL,
57+
`DownloadPath` VARCHAR(255) NOT NULL,
5758
`Index` INT(5) DEFAULT NULL,
5859
`ParentID` INT(10) unsigned DEFAULT NULL,
5960
`HeadShapeFileID` INT(10) unsigned DEFAULT NULL,
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
-- Add the column as nullable first.
2+
ALTER TABLE `physiological_file`
3+
ADD COLUMN `DownloadPath` VARCHAR(255) DEFAULT NULL AFTER `FilePath`;
4+
5+
-- Populate the download path using the file path value.
6+
UPDATE `physiological_file`
7+
SET `DownloadPath` = `FilePath`;
8+
9+
-- Add the non-null constraint once the data is populated.
10+
ALTER TABLE `physiological_file`
11+
MODIFY COLUMN `DownloadPath` VARCHAR(255) NOT NULL;

modules/electrophysiology_browser/php/models/electrophysiofile.class.inc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ class ElectrophysioFile implements \LORIS\Data\DataInstance
5252
FileType,
5353
AcquisitionTime,
5454
InsertedByUser,
55-
FilePath
55+
FilePath,
56+
DownloadPath
5657
FROM physiological_file
5758
LEFT JOIN physiological_modality as pm
5859
USING (PhysiologicalModalityID)

modules/electrophysiology_browser/php/sessions.class.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ class Sessions extends \NDB_Page
671671
function getPhysioFileDownloadlinks(ElectrophysioFile $physioFileObj): array
672672
{
673673
$physioFileID = $physioFileObj->getParameter('PhysiologicalFileID');
674-
$physioFile = $physioFileObj->getParameter('FilePath');
674+
$physioFile = $physioFileObj->getParameter('DownloadPath');
675675
$db = $this->loris->getDatabaseConnection();
676676
$downloadLinks = [];
677677

modules/electrophysiology_browser/test/EEGBrowserIntegrationTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ function setUp(): void
124124
'PhysiologicalOutputTypeID' => 22,
125125
'InsertedByUser' => 'Unit Tester',
126126
'FilePath' => '/path/to/test/file',
127+
'DownloadPath' => '/path/to/test/file',
127128
'FileType' => 'testType'
128129
]
129130
);
@@ -134,6 +135,7 @@ function setUp(): void
134135
'PhysiologicalOutputTypeID' => 23,
135136
'InsertedByUser' => 'Unit Tester',
136137
'FilePath' => '/path/to/test/file2',
138+
'DownloadPath' => '/path/to/test/file2.tar',
137139
'FileType' => 'testType2'
138140
]
139141
);
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
SET FOREIGN_KEY_CHECKS=0;
22
TRUNCATE TABLE `physiological_file`;
33
LOCK TABLES `physiological_file` WRITE;
4-
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (1,1,1,167,'2019-08-21 15:09:57','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT167/ses-V1/eeg/sub-OTT167_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
5-
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (2,1,1,168,'2019-08-21 15:10:06','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT168/ses-V1/eeg/sub-OTT168_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
6-
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (3,1,1,174,'2019-08-21 15:10:13','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT174/ses-V1/eeg/sub-OTT174_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
7-
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (4,1,1,176,'2019-08-21 15:10:21','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT176/ses-V1/eeg/sub-OTT176_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
8-
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (5,1,1,175,'2019-08-21 15:10:36','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT175/ses-V1/eeg/sub-OTT175_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
9-
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (6,1,1,172,'2019-08-21 15:10:43','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT172/ses-V1/eeg/sub-OTT172_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
10-
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (7,1,1,170,'2019-08-21 15:10:49','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT170/ses-V1/eeg/sub-OTT170_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
11-
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (8,1,1,173,'2019-08-21 15:10:57','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT173/ses-V1/eeg/sub-OTT173_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
12-
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (9,1,1,171,'2019-08-21 15:11:07','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT171/ses-V1/eeg/sub-OTT171_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
13-
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (10,1,1,166,'2019-08-21 15:11:21','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT166/ses-V1/eeg/sub-OTT166_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
4+
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `DownloadPath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (1,1,1,167,'2019-08-21 15:09:57','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT167/ses-V1/eeg/sub-OTT167_ses-V1_task-faceO_eeg.edf','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT167/ses-V1/eeg/sub-OTT167_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
5+
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `DownloadPath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (2,1,1,168,'2019-08-21 15:10:06','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT168/ses-V1/eeg/sub-OTT168_ses-V1_task-faceO_eeg.edf','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT168/ses-V1/eeg/sub-OTT168_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
6+
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `DownloadPath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (3,1,1,174,'2019-08-21 15:10:13','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT174/ses-V1/eeg/sub-OTT174_ses-V1_task-faceO_eeg.edf','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT174/ses-V1/eeg/sub-OTT174_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
7+
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `DownloadPath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (4,1,1,176,'2019-08-21 15:10:21','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT176/ses-V1/eeg/sub-OTT176_ses-V1_task-faceO_eeg.edf','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT176/ses-V1/eeg/sub-OTT176_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
8+
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `DownloadPath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (5,1,1,175,'2019-08-21 15:10:36','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT175/ses-V1/eeg/sub-OTT175_ses-V1_task-faceO_eeg.edf','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT175/ses-V1/eeg/sub-OTT175_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
9+
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `DownloadPath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (6,1,1,172,'2019-08-21 15:10:43','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT172/ses-V1/eeg/sub-OTT172_ses-V1_task-faceO_eeg.edf','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT172/ses-V1/eeg/sub-OTT172_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
10+
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `DownloadPath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (7,1,1,170,'2019-08-21 15:10:49','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT170/ses-V1/eeg/sub-OTT170_ses-V1_task-faceO_eeg.edf','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT170/ses-V1/eeg/sub-OTT170_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
11+
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `DownloadPath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (8,1,1,173,'2019-08-21 15:10:57','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT173/ses-V1/eeg/sub-OTT173_ses-V1_task-faceO_eeg.edf','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT173/ses-V1/eeg/sub-OTT173_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
12+
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `DownloadPath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (9,1,1,171,'2019-08-21 15:11:07','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT171/ses-V1/eeg/sub-OTT171_ses-V1_task-faceO_eeg.edf','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT171/ses-V1/eeg/sub-OTT171_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
13+
INSERT INTO `physiological_file` (`PhysiologicalFileID`, `PhysiologicalModalityID`, `PhysiologicalOutputTypeID`, `SessionID`, `InsertTime`, `FileType`, `AcquisitionTime`, `InsertedByUser`, `FilePath`, `DownloadPath`, `Index`, `ParentID`, `HeadShapeFileID`) VALUES (10,1,1,166,'2019-08-21 15:11:21','edf',NULL,'cecile','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT166/ses-V1/eeg/sub-OTT166_ses-V1_task-faceO_eeg.edf','bids_imports/Face13_BIDSVersion_1.1.0/sub-OTT166/ses-V1/eeg/sub-OTT166_ses-V1_task-faceO_eeg.edf',NULL,NULL,NULL);
1414
UNLOCK TABLES;
1515
SET FOREIGN_KEY_CHECKS=1;

0 commit comments

Comments
 (0)