[Loris-dev] Import mri - scripts

Sotirios Nikoloutsopoulos sotirisnik at gmail.com
Fri Sep 6 12:03:39 EDT 2019


 Here is the psc table
[image: image.png]

I created 2 candidates profiles through the interface

[image: image.png]

then runned dcmodify command to a dicom file

dcmodify -ma PatientName="DCC0000_258024_V1"
/home/lorisadmin/DICOMS/000535670/501/*.dcm

and got those warning: is this okay?
W: Found element (2001,105f) with VR UN and undefined length, reading a
sequence with transfer syntax LittleEndianImplicit (CP-246)
W: Found element (2005,1083) with VR UN and undefined length, reading a
sequence with transfer syntax LittleEndianImplicit (CP-246)
W: Found element (2005,1402) with VR UN and undefined length, reading a
sequence with transfer syntax LittleEndianImplicit (CP-246)
W: Found element (2005,140f) with VR UN and undefined length, reading a
sequence with transfer syntax LittleEndianImplicit (CP-246)
W: Found element (2001,105f) with VR UN and undefined length, reading a
sequence with transfer syntax LittleEndianImplicit (CP-246)
W: Found element (2005,1083) with VR UN and undefined length, reading a
sequence with transfer syntax LittleEndianImplicit (CP-246)

dcmodify at another Dicom didn't show warnings. Below you can see the
execution for the second dicom. Mnics could not be inserted due to
AcquisitionProtocol being unknown.

Running now the following command: /data/loris/bin/mri//uploadNeuroDB/
imaging_upload_file.pl -profile prod -upload_id 12
/data/incoming/DCC0001_602102_V1.tar.gz -verbose

 find -path \/tmp\/ImagingUpload\-18\-36\-mTrxXs -name '__MACOSX' -delete

dicomTar.pl \/tmp\/ImagingUpload\-18\-36\-mTrxXs
\/data\/loris\/data\/tarchive\/ -database -profile prod -verbose
 Source: /tmp/ImagingUpload-18-36-mTrxXs
Target: /data/loris/data/tarchive

Testing for database connectivity.
Database is available.

You will archive the dir : ImagingUpload-18-36-mTrxXs

You are creating a tar with the following command:

tar -cf /data/loris/data/tarchive/ImagingUpload-18-36-mTrxXs.tar
ImagingUpload-18-36-mTrxXs


getting md5sums and gzipping!!

* Taken from dir                   :    /tmp/ImagingUpload-18-36-mTrxXs
* Archive target location          :
 /data/loris/data/tarchive/DCM_2016-08-22_ImagingUpload-18-36-mTrxXs.tar
* Name of creating host            :    127.0.1.1
* Name of host OS                  :    Linux
* Created by user                  :    lorisadmin
* Archived on                      :    2019-09-06 18:36:50
* dicomSummary version             :    1
* dicomTar version                 :    1
* md5sum for DICOM tarball         :    b1dcdc8903dd2d9a5443227db2aa2814
 ImagingUpload-18-36-mTrxXs.tar
* md5sum for DICOM tarball gzipped :    aeae87f20155a6805f7e0cfe5212ea5f
 ImagingUpload-18-36-mTrxXs.tar.gz
* md5sum for complete archive      :    1d9258d1f077ebc49111ab7ba22a8d6e
 DCM_2016-08-22_ImagingUpload-18-36-mTrxXs.tar

Adding archive info into database

Removing temporary files from target location


Done adding archive info into database

\/data\/loris\/bin\/mri\//uploadNeuroDB/tarchiveLoader.pl -globLocation
-profile prod
\/data\/loris\/data\/tarchive\/\/DCM_2016\-08\-22_ImagingUpload\-18\-36\-mTrxXs\.tar
-uploadID 12 -verbose
 md5sum
/data/loris/data/tarchive/DCM_2016-08-22_ImagingUpload-18-36-mTrxXs.tar
PSCID is: DCC0001
 CandID id: 602102
 visit_label is: V1
PSCID is: DCC0001
 CandID id: 602102
 visit_label is: V1
candidate id 602102
Set centerID = 1
PSCID is: DCC0001
 CandID id: 602102
 visit_label is: V1
PSCID is: DCC0001
 CandID id: 602102
 visit_label is: V1

Number of MINC files that will be considered for inserting into the
database: 2

log dir is /data/loris/data//logs and log file is
/data/loris/data//logs/TarLoad-18-37-31ajWx.log
PSCID is: DCC0001
 CandID id: 602102
 visit_label is: V1
PSCID is: DCC0001
 CandID id: 602102
 visit_label is: V1
candidate id 602102

log dir is /data/loris/data//logs and log file is
/data/loris/data//logs/TarLoad-18-37-fanZFj.log
PSCID is: DCC0001
 CandID id: 602102
 visit_label is: V1
PSCID is: DCC0001
 CandID id: 602102
 visit_label is: V1
candidate id 602102

Cleaning up temp files: rm -rf
/tmp/TarLoad-18-37-to5pYZ/ImagingUpload-18-36-mTrxXs*

(loris-mri-python) lorisadmin at loris-VirtualBox:/data/loris/bin/mri$ cat
/data/loris/data/logs/TarLoad-18-37-fanZFj.log

==> Loading file from disk
/tmp/TarLoad-18-37-to5pYZ/dcc0001_602102_v1_20160822_072406_205e1d1_mri.mnc

--> mapping DICOM parameter for
/tmp/TarLoad-18-37-to5pYZ/dcc0001_602102_v1_20160822_072406_205e1d1_mri.mnc

==> computing md5 hash for MINC body.

--> md5: 02022dda60d9de429340fec838f50cfe

==> verifying acquisition protocol

Acquisition protocol is unknown

  --> The minc file cannot be registered since the AcquisitionProtocol is
unknown

Στις Τετ, 4 Σεπ 2019 στις 10:46 μ.μ., ο/η Christine Rogers, Ms. <
christine.rogers at mcgill.ca> έγραψε:

> Hi Sotirios:
>
> Sure -- you can delete imaging datasets with the *delete_imaging_upload*
> script --
> details here:
> https://github.com/aces/Loris-MRI/blob/21.0-dev/docs/scripts_md/delete_imaging_upload.md
>
> What's in your *psc* table?  (Is it properly populated? This is a
> pre-requisite to loading imaging data.
> <https://github.com/aces/Loris-MRI/blob/21.0-dev/docs/02-Install.md#221-database>
> )
> The foreign key constraint error on the candidate record is curious.
>
> There are also a few options for creating candidates when inserting
> imaging data:
>
> -- Method 1 : in 2 steps with the API then DICOM insertion pipeline
>
> a. via the LORIS API -- Create the candidates (and visits, optionally I
> think)
> How to:
> https://github.com/aces/Loris/blob/master/docs/API/LorisRESTAPI.md#30-candidate-api
> Ensure you get the DCCID/CandID assigned by LORIS.
>
> Then as a second step:
> b. Use the imaging insertion pipeline
> <https://github.com/aces/Loris-MRI/blob/minor/docs/05-PipelineLaunchOptions.md#51---pipeline-launch-options-for-dicom-datasets>
> to load your DICOMs.
> You will want to first ensure that the PatientName header in the DICOMs as
> well as tar package are correctly labelled with PSCID_DCCID_VisitLabel
>
> -- Method 2: for BIDS-format datasets:
> How to :
> https://github.com/aces/Loris-MRI/blob/master/docs/05-PipelineLaunchOptions.md#52---pipeline-launch-for-bids-datasets
>
> Be sure to use the *-c* and *-s* options when running the bids_import script,
> to automatically create your candidates and sessions.
>
> Best,
> Christine
>
> On Wed, Sep 4, 2019 at 11:43 AM Sotirios Nikoloutsopoulos <
> sotirisnik at gmail.com> wrote:
>
>> How do i delete a Study? And everytime do i have to create a new
>> candidate to get DCCID and a PSCID?
>>
>> *First execution:*
>>
>> (loris-mri-python) lorisadmin at loris-VirtualBox:/data/loris/bin/mri$ ./
>> batch_uploads_imageuploader.pl -profile prod < ~/Desktop/input.txt >
>> log.txt
>> Use of uninitialized value $_ in pattern match (m//) at ./
>> batch_uploads_imageuploader.pl line 144.
>> DBD::mysql::db do failed: Cannot add or update a child row: a foreign key
>> constraint fails (`LORIS`.`candidate`, CONSTRAINT `FK_candidate_1` FOREIGN
>> KEY (`RegistrationCenterID`) REFERENCES `psc` (`CenterID`)) at
>> /data/loris/bin/mri/uploadNeuroDB/NeuroDB/MRI.pm line 1060.
>> ERROR: Failed to insert record in table mri_scanner:
>> The following database commands failed:
>> PREPARE s FROM 'INSERT INTO mri_scanner
>> (CandID,Model,Software,Serial_number,Manufacturer) VALUES (?,?,?,?,?)';
>> SET
>> @x1='242126', at x2='Achieva', at x3='3.2.2\3.2.2.0', at x4='34037', at x5='Philips
>> Medical Systems';
>> EXECUTE s USING @x1, at x2, at x3, at x4, at x5;
>> Error obtained:Cannot add or update a child row: a foreign key constraint
>> fails (`LORIS`.`mri_scanner`, CONSTRAINT `FK_mri_scanner_1` FOREIGN KEY
>> (`CandID`) REFERENCES `candidate` (`CandID`)) (error code 1452)
>>
>>  ERROR: The validation has failed. Either re-run the validation again and
>> fix the problem. Or re-run tarchiveLoader.pl using -force to force the
>> execution.
>>
>>
>> The tarchiveLoader.pl insertion script has failed.
>> Can't exec "mail": No such file or directory at ./
>> batch_uploads_imageuploader.pl line 249.
>> print() on closed filehandle MAIL at ./batch_uploads_imageuploader.pl
>> line 250.
>> print() on closed filehandle MAIL at ./batch_uploads_imageuploader.pl
>> line 251.
>>
>>
>> *And second execution: *
>>
>> (loris-mri-python) lorisadmin at loris-VirtualBox:/data/loris/bin/mri$ ./
>> batch_uploads_imageuploader.pl -profile prod < ~/Desktop/input.txt >
>> log.txt
>> Use of uninitialized value $_ in pattern match (m//) at ./
>> batch_uploads_imageuploader.pl line 144.
>>
>> PROBLEM:
>> The user 'lorisadmin' has already inserted this study.
>> The unique study ID is '1.3.51.0.1.1.10.49.10.222.1422753.1420953'.
>> This is the information retained from the first time the study was
>> inserted:
>>
>> * Taken from dir                   :    /tmp/ImagingUpload-18-33-Qq7HGy
>> * Archive target location          :
>>  /data/loris/data/tarchive/DCM_2012-12-05_ImagingUpload-18-33-Qq7HGy.tar
>> * Name of creating host            :    127.0.1.1
>> * Name of host OS                  :    Linux
>> * Created by user                  :    lorisadmin
>> * Archived on                      :    2019-09-04 18:33:05
>> * dicomSummary version             :    1
>> * dicomTar version                 :    1
>> * md5sum for DICOM tarball         :    4a301b0318178b09b91e63544282364d
>>  ImagingUpload-18-33-Qq7HGy.tar
>> * md5sum for DICOM tarball gzipped :    9d95ea2b9111be236808bfd65d7e65ec
>>  ImagingUpload-18-33-Qq7HGy.tar.gz
>> * md5sum for complete archive      :    ab19a86357f1d4053aa3b81c8a071053
>>  DCM_2012-12-05_ImagingUpload-18-33-Qq7HGy.tar
>>
>>
>> Last update of record:
>>
>>
>>
>> The dicomTar.pl execution has failed.
>> Can't exec "mail": No such file or directory at ./
>> batch_uploads_imageuploader.pl line 249.
>> print() on closed filehandle MAIL at ./batch_uploads_imageuploader.pl
>> line 250.
>> print() on closed filehandle MAIL at ./batch_uploads_imageuploader.pl
>> line 251.
>>
>> Στις Τετ, 4 Σεπ 2019 στις 5:35 μ.μ., ο/η Christine Rogers, Ms. <
>> christine.rogers at mcgill.ca> έγραψε:
>>
>>> Hi Sotirios,
>>>
>>> Ok, this sounds like good progress.  Let us know when you next encounter
>>> issues as you progress through the Imaging Install/Setup docs
>>> <https://github.com/aces/Loris-MRI/blob/minor/docs/02-Install.md>.
>>> I'll look into how we can better handle the incoming/ directory next
>>> time.
>>> Best,
>>> Christine
>>>
>>> On Wed, Sep 4, 2019 at 10:23 AM Sotirios Nikoloutsopoulos <
>>> sotirisnik at gmail.com> wrote:
>>>
>>>> /data/loris/bin/mri/dicom-archive/.loris_mri/database_config.py is
>>>> populated correctly except its port is  'port'    : ''. Also i have tested
>>>> that i can connect to MySQL with lorisuser.
>>>>
>>>> I executed the script again, because the only error i had previously
>>>> was that the /data/incoming folder didn't exist and there are no errors
>>>> reported back except of warnings <<mysql: [Warning] Using a password on the
>>>> command line interface can be insecure>>.
>>>>
>>>>
>>>> Στις Τετ, 4 Σεπ 2019 στις 4:53 μ.μ., ο/η Christine Rogers, Ms. <
>>>> christine.rogers at mcgill.ca> έγραψε:
>>>>
>>>>> Hi Sotirios,
>>>>>
>>>>> It's possible -- if the script was unable to connect to the database
>>>>> during its execution (e.g. typo in the password), that would explain the
>>>>> underpopulated Image path and Loris-MRI code path you saw in the Config
>>>>> module.
>>>>> It's hard to tell without seeing the output from your script run --
>>>>> Did you see a sign of any such error?
>>>>> The Config fields are populated by the imaging_install.sh script (starting
>>>>> at line 222
>>>>> <https://github.com/aces/Loris-MRI/blob/21.0-dev/imaging_install.sh#L222>
>>>>> )
>>>>>
>>>>> For example, check if the database connection information was
>>>>> populated accurately in $mridir
>>>>> /dicom-archive/.loris_mri/database_config.py
>>>>>
>>>>> Best,
>>>>> Christine
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Sep 4, 2019 at 9:34 AM Sotirios Nikoloutsopoulos <
>>>>> sotirisnik at gmail.com> wrote:
>>>>>
>>>>>> Hi Christine,
>>>>>>
>>>>>> If you are referring to the imaging_install.sh here is an image with
>>>>>> the configurations i typed. Maybe the problem is somewhere at the last part
>>>>>> which asks to configure as much as possible automatically?
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>>
>>>>>> Στις Τετ, 4 Σεπ 2019 στις 4:16 μ.μ., ο/η Christine Rogers, Ms. <
>>>>>> christine.rogers at mcgill.ca> έγραψε:
>>>>>>
>>>>>>> Hi Sotirios,
>>>>>>>
>>>>>>> Glad to hear your LORIS core install is up and working and all the
>>>>>>> front-end pages are loading.
>>>>>>>
>>>>>>> > lorisadmin at loris-VirtualBox:/var/www/loris$ chmod 775 project
>>>>>>> > and the web interface worked.
>>>>>>>
>>>>>>> Yes, it's important that project/ have 775 permissions and that
>>>>>>> lorisadmin be part of the sudoers group, per step 1 in the install
>>>>>>> Readme <https://github.com/aces/Loris#install-steps>.
>>>>>>>
>>>>>>> > As for the Paths, LORIS-MRI code and Image should change LORIS to
>>>>>>> loris, right?
>>>>>>>
>>>>>>> These imaging paths will be updated during your imaging installation
>>>>>>> <https://github.com/aces/Loris/wiki/Setup> by an automated script
>>>>>>> -- you do not need to set them manually via the Config module.
>>>>>>> Please continue to follow the Setup Guide
>>>>>>> <https://github.com/aces/Loris/wiki/Setup> for detailed steps to
>>>>>>> follow.
>>>>>>>
>>>>>>> Best,
>>>>>>> Christine
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Wed, Sep 4, 2019 at 8:05 AM Sotirios Nikoloutsopoulos <
>>>>>>> sotirisnik at gmail.com> wrote:
>>>>>>>
>>>>>>>> As for the Paths, LORIS-MRI code and Image should change LORIS to
>>>>>>>> loris, right?
>>>>>>>>
>>>>>>>> [image: image.png]
>>>>>>>>
>>>>>>>>
>>>>>>>> Στις Τετ, 4 Σεπ 2019 στις 2:28 μ.μ., ο/η Sotirios Nikoloutsopoulos <
>>>>>>>> sotirisnik at gmail.com> έγραψε:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> i used
>>>>>>>>>
>>>>>>>>> curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
>>>>>>>>> sudo apt-get install -y nodejs
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> you had suggested in the past, make worked and now i can see all
>>>>>>>>> the contents in the web-interface, but i don't need make install?
>>>>>>>>>
>>>>>>>>> Thanks
>>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Loris-dev mailing list
>>>>>>>> Loris-dev at bic.mni.mcgill.ca
>>>>>>>> https://mailman.bic.mni.mcgill.ca/mailman/listinfo/loris-dev
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>>
>>>>>>> christine.rogers at mcgill.ca
>>>>>>> McGill Centre for Integrative Neuroscience | MCIN.ca
>>>>>>> Montreal Neurological Institute
>>>>>>> McGill University | Montreal | Canada
>>>>>>>
>>>>>> _______________________________________________
>>>>>> Loris-dev mailing list
>>>>>> Loris-dev at bic.mni.mcgill.ca
>>>>>> https://mailman.bic.mni.mcgill.ca/mailman/listinfo/loris-dev
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>>
>>>>> christine.rogers at mcgill.ca
>>>>> McGill Centre for Integrative Neuroscience | MCIN.ca
>>>>> Montreal Neurological Institute
>>>>> McGill University | Montreal | Canada
>>>>>
>>>> _______________________________________________
>>>> Loris-dev mailing list
>>>> Loris-dev at bic.mni.mcgill.ca
>>>> https://mailman.bic.mni.mcgill.ca/mailman/listinfo/loris-dev
>>>>
>>>
>>>
>>> --
>>>
>>> christine.rogers at mcgill.ca
>>> McGill Centre for Integrative Neuroscience | MCIN.ca
>>> Montreal Neurological Institute
>>> McGill University | Montreal | Canada
>>>
>>
>
> --
>
> christine.rogers at mcgill.ca
> McGill Centre for Integrative Neuroscience | MCIN.ca
> Montreal Neurological Institute
> McGill University | Montreal | Canada
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.bic.mni.mcgill.ca/pipermail/loris-dev/attachments/20190906/b89adf0c/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 61107 bytes
Desc: not available
URL: <http://mailman.bic.mni.mcgill.ca/pipermail/loris-dev/attachments/20190906/b89adf0c/attachment-0003.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 42220 bytes
Desc: not available
URL: <http://mailman.bic.mni.mcgill.ca/pipermail/loris-dev/attachments/20190906/b89adf0c/attachment-0004.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 29279 bytes
Desc: not available
URL: <http://mailman.bic.mni.mcgill.ca/pipermail/loris-dev/attachments/20190906/b89adf0c/attachment-0005.png>


More information about the Loris-dev mailing list