-- phpMyAdmin SQL Dump
-- version 3.2.5
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jul 02, 2010 at 06:03 PM
-- Server version: 5.1.44
-- PHP Version: 5.3.2

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `numedb`
--

-- --------------------------------------------------------

--
-- Table structure for table `collimator`
--

CREATE TABLE `collimator` (
  `CollimatorId` int(11) NOT NULL AUTO_INCREMENT,
  `CollimatorType` varchar(11) NOT NULL,
  `CollimatorMaterial` varchar(11) NOT NULL,
  `CollimatorRadius` double NOT NULL COMMENT 'in cm',
  `CollimatorLength` double NOT NULL,
  `OtherCollimatorGeometry` int(11) NOT NULL COMMENT 'Expand for non-parallel collimators',
  `CollimatorOffset` float NOT NULL,
  PRIMARY KEY (`CollimatorId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Dumping data for table `collimator`
--


-- --------------------------------------------------------

--
-- Table structure for table `dataacqparameters`
--

CREATE TABLE `dataacqparameters` (
  `DateTime` datetime NOT NULL COMMENT 'Study date',
  `LeadExperimenter` int(11) NOT NULL COMMENT 'Id from Researcher',
  `MachineID` varchar(30) NOT NULL COMMENT 'MachineName from Machine Table',
  `DetectorHeadUsed_1` int(11) NOT NULL COMMENT 'Head Ids from Head Table Table',
  `DetectorHeadUsed_2` int(11) DEFAULT NULL COMMENT 'Second Detector Head',
  `DetectorHeadUsed_3` int(11) DEFAULT NULL COMMENT '3rd Detector Head',
  `CollimatorUsed` int(11) NOT NULL COMMENT 'From Collimator Table',
  `IsGated?` tinyint(1) NOT NULL COMMENT 'Is the Acuisition Gated?',
  `DataDescription` int(11) NOT NULL COMMENT '???',
  `Patient` varchar(30) NOT NULL COMMENT 'PatientID from Patient Table',
  `DataCompression` int(11) NOT NULL,
  `DataEncode` int(11) NOT NULL,
  `TypeOfData` varchar(30) NOT NULL COMMENT 'Tomographic',
  `NumberOfImages` int(11) NOT NULL,
  `ImageByteOrder` varchar(20) NOT NULL COMMENT 'Endian',
  `ImageDataFormat` varchar(30) NOT NULL COMMENT 'Unsigned Int, etc.',
  `NumBytesPerPixel` int(11) NOT NULL,
  `NumEnergyWindow` int(11) NOT NULL,
  `EnergyWindowFor` int(11) NOT NULL COMMENT 'TracerId from Tracer Table',
  `EnergyWindowLowerLevel` double NOT NULL COMMENT 'Unit KeV',
  `EnergyWindowUpperLevel` double NOT NULL COMMENT 'Unit KeV',
  `FloodCorrected` tinyint(1) NOT NULL,
  `DecayCorrected` tinyint(1) NOT NULL,
  `NumAngleSteps` int(11) NOT NULL,
  `AngleStart` int(11) NOT NULL,
  `TotAngleRotation` int(11) NOT NULL,
  `AngleDirection` int(11) NOT NULL COMMENT '1 for ClockW, -1 opposite',
  `NumOfProjections` int(11) NOT NULL,
  `ExtentOfRotation` int(11) NOT NULL,
  `ProcessStatus` varchar(30) NOT NULL,
  `TimePerProjection` int(11) NOT NULL,
  `StudyDuration` int(11) NOT NULL,
  `PatientOrientation` varchar(10) NOT NULL COMMENT 'Feet_in, Feet_out',
  PRIMARY KEY (`DateTime`,`LeadExperimenter`,`MachineID`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `dataacqparameters`
--


-- --------------------------------------------------------

--
-- Table structure for table `detector`
--

CREATE TABLE `detector` (
  `DettectorId` int(11) NOT NULL AUTO_INCREMENT,
  `DetectorMaterial` varchar(30) NOT NULL,
  PRIMARY KEY (`DettectorId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Dumping data for table `detector`
--


-- --------------------------------------------------------

--
-- Table structure for table `detectorhead`
--

CREATE TABLE `detectorhead` (
  `MachineIn` varchar(30) NOT NULL COMMENT 'FK MachineName from Machine',
  `HeadId` int(11) NOT NULL COMMENT 'Specific Head in the Machine',
  `NumImagePerEnergyWin` int(11) NOT NULL,
  `MatrixSizeX` int(11) NOT NULL,
  `MatrixSizeY` int(11) NOT NULL,
  `SaleFactorX` double NOT NULL COMMENT 'Unit: mm/pixel',
  `ScaleFactorY` double NOT NULL COMMENT 'Unit: mm/pixel',
  `MaxPixelCount` int(11) NOT NULL,
  `DetectorDistanceFromCtrOfRot` double NOT NULL,
  `FocalLength` double NOT NULL COMMENT 'For ParCollimator DetRdius+HalfSizeOfVolInBigAxis',
  `DetectorBinWidth` double NOT NULL COMMENT 'Unit cm',
  `XYDirBins` int(1) NOT NULL,
  `ZDirBins` int(1) NOT NULL,
  `NumXYBins` int(3) NOT NULL,
  `NumZBins` int(3) NOT NULL,
  PRIMARY KEY (`MachineIn`,`HeadId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `detectorhead`
--


-- --------------------------------------------------------

--
-- Table structure for table `files`
--

CREATE TABLE `files` (
  `FileName` varchar(30) NOT NULL,
  `FileLocationPath` varchar(30) NOT NULL,
  `FileType` varchar(30) NOT NULL COMMENT '{TextParms, TextSourceCode, BinaryData, BinaryCode}',
  `DataAcqisition` int(11) NOT NULL COMMENT 'Data Acquisition PK',
  `InputFile_1` varchar(3) NOT NULL,
  `InputFile_2` varchar(30) NOT NULL,
  `InputFile_3` varchar(30) NOT NULL,
  `InputFile_4` varchar(30) NOT NULL,
  `LastModifiedOn` datetime NOT NULL,
  `BackUpInfo` varchar(30) NOT NULL,
  PRIMARY KEY (`FileName`,`FileLocationPath`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `files`
--


-- --------------------------------------------------------

--
-- Table structure for table `machinespec`
--

CREATE TABLE `machinespec` (
  `MachineName` varchar(30) NOT NULL COMMENT 'A Unique name',
  `Purpose` varchar(30) NOT NULL DEFAULT 'SPECT, PET, CT, X_CT' COMMENT 'Should be Non-null',
  `OrignSystem` varchar(30) NOT NULL COMMENT 'GE_Medical_Systems, etc.',
  `LocationInstitution` varchar(30) NOT NULL,
  `ImageModality` varchar(30) NOT NULL,
  `VersinOfKeys` double NOT NULL,
  `ConversionProgram` varchar(30) NOT NULL,
  `DateOfKeys` date NOT NULL,
  `ProgramAuthor` varchar(30) NOT NULL,
  `ProgramDate` date NOT NULL,
  `ContactPerson` varchar(30) NOT NULL,
  `NumHeads` int(11) NOT NULL COMMENT 'Main Detector Info Is on each Head in HeadTable',
  PRIMARY KEY (`MachineName`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COMMENT='Static Machine Parameters';

--
-- Dumping data for table `machinespec`
--


-- --------------------------------------------------------

--
-- Table structure for table `patient`
--

CREATE TABLE `patient` (
  `PatientId` int(11) NOT NULL COMMENT 'Auto Increment',
  `PatientName` varchar(40) NOT NULL,
  `PatientSex` char(1) NOT NULL,
  `PatientDOB` datetime NOT NULL,
  `PatientCondition` text NOT NULL COMMENT 'Expand to more fields',
  PRIMARY KEY (`PatientId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `patient`
--


-- --------------------------------------------------------

--
-- Table structure for table `researcher`
--

CREATE TABLE `researcher` (
  `ResearcherId` int(11) NOT NULL,
  `ResearcherName` varchar(30) NOT NULL,
  `ResearcherDept` varchar(30) NOT NULL,
  `ResearcherDiv` varchar(30) NOT NULL,
  `ResarcherInstitution` varchar(30) NOT NULL,
  `ResearcherPosition` varchar(30) NOT NULL,
  PRIMARY KEY (`ResearcherId`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `researcher`
--


-- --------------------------------------------------------

--
-- Table structure for table `sysmatrixprameters`
--

CREATE TABLE `sysmatrixprameters` (
  `SysMatrixFileProduced` varchar(30) NOT NULL COMMENT 'FileNameFrom BinDataFiles Table',
  `DaqId` int(11) NOT NULL COMMENT 'DaqPK from DataAcqParams Table',
  `VoxelInfo` int(11) NOT NULL COMMENT 'Voxel InfoPK from VolAndVoxel Table',
  `CollimatorId` int(11) NOT NULL COMMENT 'Coll Used PK from Collimator Table',
  `DetectorId` int(11) NOT NULL COMMENT 'Head Used PK from DetectorHead Table',
  `Code` varchar(30) NOT NULL COMMENT 'Object code file name from BinCodeFile Table',
  `Sinogram` varchar(30) NOT NULL COMMENT 'Input Image file name from BinDataTable',
  `AnyOtherInputFile?` tinyint(1) NOT NULL COMMENT 'Attenuation, correction, etc.',
  `AttenuationFile` varchar(30) NOT NULL COMMENT 'From BinDataFiles',
  `OtherInputFileUsed_2` varchar(30) NOT NULL COMMENT 'Scattering, etc., add more fileds if necessaryLater',
  `PostProcessCode` varchar(30) NOT NULL COMMENT 'If Sinogram is not raw but subsequently post-processed',
  `DateTime` datetime NOT NULL,
  `ProcessingPerson` varchar(30) NOT NULL COMMENT 'From Researcher Table',
  `RaySamplesPerVoxel` int(11) NOT NULL COMMENT 'Prameter used ',
  `RaysPerVoxel` int(11) NOT NULL,
  `MaxPtRespCount` int(11) NOT NULL COMMENT 'Num Rays Sent On Each Axis, 100 is big enough',
  `MachineDaqParmFile` varchar(30) NOT NULL COMMENT 'MachGenerated Data Aq Params, from TextParmFiles',
  `SysMatrxInputConfigFile` varchar(30) NOT NULL COMMENT 'Another input file from TextParamFile Table',
  PRIMARY KEY (`SysMatrixFileProduced`,`Code`,`Sinogram`,`AnyOtherInputFile?`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

--
-- Dumping data for table `sysmatrixprameters`
--


-- --------------------------------------------------------

--
-- Table structure for table `volandvoxelgeometry`
--

CREATE TABLE `volandvoxelgeometry` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `NumVoxels_X` int(11) NOT NULL,
  `NumVoxel_Y` int(11) NOT NULL,
  `NumVoxel_Z` int(11) NOT NULL,
  `AttnZCount` int(11) NOT NULL COMMENT 'Num Voxels used from Attn Map',
  `Voxel_Xwidth` double NOT NULL COMMENT 'Unit cm',
  `Voxel_Ywidth` double NOT NULL COMMENT 'Unit cm',
  `Voxel_Zwidth` double NOT NULL COMMENT 'Unit cm',
  `WhoWhenWhyCreated` text NOT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

--
-- Dumping data for table `volandvoxelgeometry`
--

