Command line tools for DICOM manipulation, DICOM Toolkit, (DCMTK)
findscu -P -k 0008,0052=STUDY -aet <AET> -aec <AEC> IPAddress Port# -k 0010,0020=<MRN> -k 0020,000d -k 0008,1030 -k 0008,0020 -k 0008,0050
findscu -S -k 0008,0052=SERIES -aet <AET> -aec <AEC> IPAddress Port# -k 0020,000D=<StudyUID> -k 0020,000E -k 0008,0060 -k 0010,0020=<MRN> -k 0008,103e
findscu -v -S -k 0008,0052=IMAGE -aet <AET> -aec <AEC> IPAddress Port# -k 0020,000D=<StudyUID> -k 0020,000e=<SeriesUID> -k 0008,1030 -k 0008,0020 -k 0008,0050 -k 0018,0050 -k 0008,0018
movescu -v -S -k 0008,0052=SERIES -aet <AET> -aec <AEC> IPAddress Port# -k 0020,000D=<StudyUID> -k 0020,000e=<SeriesUID>
Slicer, will create an SQL database of DICOM files to manage your project
wget http://nrg.wustl.edu/projects/DICOM/sample1.zip
vglrun /opt/apps/SLICER/Slicer-4.3.1-linux-amd64/Slicer
$ sqlite3 ctkDICOM.sql SQLite version 3.6.22 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> select * from sqlite_master; table|SchemaInfo|SchemaInfo|2|CREATE TABLE 'SchemaInfo' ( 'Version' VARCHAR(1024) NOT NULL ) table|Images|Images|3|CREATE TABLE 'Images' ( 'SOPInstanceUID' VARCHAR(64) NOT NULL, 'Filename' VARCHAR(1024) NOT NULL , 'SeriesInstanceUID' VARCHAR(64) NOT NULL , 'InsertTimestamp' VARCHAR(20) NOT NULL , PRIMARY KEY ('SOPInstanceUID') ) index|sqlite_autoindex_Images_1|Images|4| table|Patients|Patients|5|CREATE TABLE 'Patients' ( 'UID' INTEGER PRIMARY KEY AUTOINCREMENT, 'PatientsName' VARCHAR(255) NULL , 'PatientID' VARCHAR(255) NULL , 'PatientsBirthDate' DATE NULL , 'PatientsBirthTime' TIME NULL , 'PatientsSex' varchar(1) NULL , 'PatientsAge' varchar(10) NULL , 'PatientsComments' VARCHAR(255) NULL ) table|sqlite_sequence|sqlite_sequence|6|CREATE TABLE sqlite_sequence(name,seq) table|Series|Series|7|CREATE TABLE 'Series' ( 'SeriesInstanceUID' VARCHAR(64) NOT NULL , 'StudyInstanceUID' VARCHAR(64) NOT NULL , 'SeriesNumber' INT NULL , 'SeriesDate' DATE NULL , 'SeriesTime' VARCHAR(20) NULL , 'SeriesDescription' VARCHAR(255) NULL , 'Modality' VARCHAR(20) NULL , 'BodyPartExamined' VARCHAR(255) NULL , 'FrameOfReferenceUID' VARCHAR(64) NULL , 'AcquisitionNumber' INT NULL , 'ContrastAgent' VARCHAR(255) NULL , 'ScanningSequence' VARCHAR(45) NULL , 'EchoNumber' INT NULL , 'TemporalPosition' INT NULL , PRIMARY KEY ('SeriesInstanceUID') ) index|sqlite_autoindex_Series_1|Series|8| table|Studies|Studies|11|CREATE TABLE 'Studies' ( 'StudyInstanceUID' VARCHAR(64) NOT NULL , 'PatientsUID' INT NOT NULL , 'StudyID' VARCHAR(255) NULL , 'StudyDate' DATE NULL , 'StudyTime' VARCHAR(20) NULL , 'AccessionNumber' VARCHAR(255) NULL , 'ModalitiesInStudy' VARCHAR(255) NULL , 'InstitutionName' VARCHAR(255) NULL , 'ReferringPhysician' VARCHAR(255) NULL , 'PerformingPhysiciansName' VARCHAR(255) NULL , 'StudyDescription' VARCHAR(255) NULL , PRIMARY KEY ('StudyInstanceUID') ) index|sqlite_autoindex_Studies_1|Studies|12| index|ImagesFilenameIndex|Images|14|CREATE UNIQUE INDEX 'ImagesFilenameIndex' ON 'Images' ('Filename') index|ImagesSeriesIndex|Images|15|CREATE INDEX 'ImagesSeriesIndex' ON 'Images' ('SeriesInstanceUID') index|SeriesStudyIndex|Series|16|CREATE INDEX 'SeriesStudyIndex' ON 'Series' ('StudyInstanceUID') index|StudiesPatientIndex|Studies|17|CREATE INDEX 'StudiesPatientIndex' ON 'Studies' ('PatientsUID') table|Directories|Directories|18|CREATE TABLE 'Directories' ( 'Dirname' VARCHAR(1024) , PRIMARY KEY ('Dirname') ) index|sqlite_autoindex_Directories_1|Directories|19|
sqlite> select * from Patients; 1|Sample Patient|Sample ID|1975-12-31||F||
sqlite> select * from Studies where PatientsUID=1; 1.3.12.2.1107.5.2.32.35177.30000006121218324675000000034|1|1|2006-12-14|091206.156000|.||Hospital|||head^DHead
sqlite> select * from Series where StudyInstanceUID='1.3.12.2.1107.5.2.32.35177.30000006121218324675000000034'; 1.3.12.2.1107.5.2.32.35177.3.2006121409455295707319315.0.0.0|1.3.12.2.1107.5.2.32.35177.30000006121218324675000000034|6|2006-12-14|095148.593000|t2_spc_1mm_p2|MR|HEAD|1.3.12.2.1107.5.2.32.35177.1.20061214091206328.0.0.0|1||SE|1|0 1.3.12.2.1107.5.2.32.35177.3.2006121409371282268118605.0.0.0|1.3.12.2.1107.5.2.32.35177.30000006121218324675000000034|5|2006-12-14|094549.875000|t1_mpr_1mm_p2_pos50|MR|HEAD|1.3.12.2.1107.5.2.32.35177.1.20061214091206328.0.0.0|1||GR|1|0 1.3.12.2.1107.5.2.32.35177.3.2006121409284535196417894.0.0.0|1.3.12.2.1107.5.2.32.35177.30000006121218324675000000034|4|2006-12-14|093711.593000|t1_mpr_1mm_p2_pos50|MR|HEAD|1.3.12.2.1107.5.2.32.35177.1.20061214091206328.0.0.0|1||GR|1|0
sqlite> select * from Images where SeriesInstanceUID='1.3.12.2.1107.5.2.32.35177.3.2006121409371282268118605.0.0.0' limit 3; 1.3.12.2.1107.5.2.32.35177.3.2006121409454232379618816|/home/bootcamp/Data/sample1/1.MR.head_DHead.5.33.20061214.091206.156000.2379618816.dcm|1.3.12.2.1107.5.2.32.35177.3.2006121409371282268118605.0.0.0|2014-08-16T12:20:00 1.3.12.2.1107.5.2.32.35177.3.2006121409454929962319192|/home/bootcamp/Data/sample1/1.MR.head_DHead.5.127.20061214.091206.156000.9962319192.dcm|1.3.12.2.1107.5.2.32.35177.3.2006121409371282268118605.0.0.0|2014-08-16T12:20:01 1.3.12.2.1107.5.2.32.35177.3.2006121409454611312919020|/home/bootcamp/Data/sample1/1.MR.head_DHead.5.84.20061214.091206.156000.1312919020.dcm|1.3.12.2.1107.5.2.32.35177.3.2006121409371282268118605.0.0.0|2014-08-16T12:20:01
sqlite> select pt.patientid,sd.PatientsUID,se.seriesNumber,se.seriesdate,se.seriesinstanceuid from studies sd join series se on sd.Studyinstanceuid=se.studyinstanceuid join patients pt on sd.patientsuid=pt.uid limit 20 ;
.mode csv .output segmentation.csv select pt.PatientID, sd.OID, sd.StudyDate, t1.SeriesDescription , --t1.SeriesInstanceUID , t2.SeriesDescription , --t2.SeriesInstanceUID , fl.SeriesDescription , --fl.SeriesInstanceUID , tc.SeriesDescription , --tc.SeriesInstanceUID , sd.StudyDescription from Studies sd join Patients pt on sd.PatientsUID=pt.UID join Series t1 on sd.StudyInstanceUID=t1.StudyInstanceUID join Series t2 on sd.StudyInstanceUID=t2.StudyInstanceUID join Series fl on sd.StudyInstanceUID=fl.StudyInstanceUID join Series tc on sd.StudyInstanceUID=tc.StudyInstanceUID where t1.SeriesDescription like '%T1%' and t1.SeriesDescription not like '%+C%' and t1.SeriesDescription not like '%ther%' and t1.SeriesDescription not like '%t-map%' and t1.SeriesDescription not like '%post%' and t1.SeriesDescription not like '%fiber%' and t1.SeriesDescription not like '%CRANIOTOMY%' and t1.SeriesDescription not like '%dt1%' and t2.SeriesDescription like '%T2%' and t2.SeriesDescription not like '%cor%' and t2.SeriesDescription not like '%T2*%' and t2.SeriesDescription not like '%t-map%' and t2.SeriesDescription not like '%+c%' and t2.SeriesDescription not like '%flair%' and t2.SeriesDescription not like '%weighted%' and t2.SeriesDescription not like '%2%*%' and t2.SeriesDescription not like '%star%' and fl.SeriesDescription like '%flair%' and fl.SeriesDescription not like '%cor%' and sd.StudyDescription like 'MRI%BRAIN%CONTRAST' and tc.SeriesDescription like '%T1%' and tc.SeriesDescription like '%+C%' and tc.SeriesDescription like '%sag%'; .output stdout
http://sourceforge.net/projects/mksqlite/
Use GNU make, to run multiple commands simulateously for batch processing on a single workstation. The below example will execute 4 processes.
$ make -j 4 -f parallel.makefile echo target1 cmd1 echo target2 cmd1 echo target3 cmd1 echo target4 cmd1 target3 cmd1 target4 cmd1 target2 cmd1 target1 cmd1 echo target3 cmd2 echo target1 cmd2 echo target2 cmd2 echo target4 cmd2 target3 cmd2 target1 cmd2 echo target3 cmd3 echo target1 cmd3 target2 cmd2 target3 cmd3 echo target2 cmd3 target4 cmd2 echo target4 cmd3 target1 cmd3 target2 cmd3 target4 cmd3The file parallel.makefile contains
all: target1 target2 target3 target4 target1: echo $@ cmd1 echo $@ cmd2 echo $@ cmd3 target2: echo $@ cmd1 echo $@ cmd2 echo $@ cmd3 target3: echo $@ cmd1 echo $@ cmd2 echo $@ cmd3 target4: echo $@ cmd1 echo $@ cmd2 echo $@ cmd3
rsync -avz -v --include='*/' --include='fem_stats*.e' --exclude='*' source/ target/
to set permissions recursively on a directory chmod -R g+=rwXs * or find ./some/directory/ -type f -exec chmod g+rw {} \; #files find ./some/directory/ -type d -exec chmod g+rwx {} \; #directories umask 0027 for -rwxr-x--- (dir) -rw-r----- (file) default permissions
SCRGP2$ inferior_tty.py 'inferior_tty' two characters sequence commands: 'C-a q' exit immediately 'C-a c' close the slave pseudo terminal and exit after the gdb inferior has terminated 'C-a a' send a 'C-a' character /dev/pts/15 pseudo terminal has been created. Set the tty for the program being debugged with the gdb commands: set inferior-tty /dev/pts/1 set environment TERM = screen SCRGP2$ pyclewn --tty=/dev/pts/1 -a '--args ./FocusUltraSoundModel -snes_monitor -da_vec_type cusp -snes_converged_reason -ksp_monitor -log_summary -pc_type jacobi -dm_mat_type seqaijcusp'