Example #1
0
 public static void test()
 {
     TransformRT[]   inertiaRTs = DatParser.parseInertiaFileToRT(@"P:\Data\Functional_Wrist\E01424\S15R\inertia15R.dat");
     TransformRT[]   ACS_RT     = DatParser.parseACSFileToRT(@"P:\Data\Functional_Wrist\E01424\S15R\AnatCoordSys.dat");
     TransformRT[]   motion     = DatParser.parseMotionFileToRT(@"P:\Data\Functional_Wrist\E01424\S02R\Motion15R02R.dat");
     TransformMatrix inertia    = new TransformMatrix(inertiaRTs[8]);
     TransformMatrix ACS        = new TransformMatrix(ACS_RT[0]);
     Posture         p          = CalculatePosture(ACS, inertia);
     Posture         p2         = CalculatePosture(ACS, inertia, new TransformMatrix(motion[0]), new TransformMatrix(motion[8]));
 }
Example #2
0
        private void LoadInertiaData_SingleBone(string filename, int boneIndex)
        {
            if (!File.Exists(filename))
            {
                return;
            }

            TransformRT[] acs = DatParser.parseACSFileToRT(filename);
            _bones[boneIndex].InertiaMatrix = new TransformMatrix(acs[0]);
        }
Example #3
0
        private void LoadKinematicTransforms()
        {
            int numPos = _wrist.motionFiles.Length;

            _numberPositions = numPos + 1; //add 1 for the neutral position
            for (int i = 0; i < numPos; i++)
            {
                TransformMatrix[] transforms = DatParser.parseMotionFileToTransformMatrix(_wrist.motionFiles[i]);
                for (int j = 0; j < WristFilesystem.NumBones; j++)
                {
                    _bones[j].SetTransformation(transforms[j], i + 1); //offset position index by 1, 0 is neutral now!
                }
            }
        }
Example #4
0
        private void LoadInertiaData()
        {
            if (File.Exists(_wrist.inertiaFile))
            {
                TransformRT[] inert = DatParser.parseInertiaFileToRT(_wrist.inertiaFile);
                for (int i = 0; i < WristFilesystem.NumBones; i++)     //skip the long bones
                {
                    _bones[i].InertiaMatrix = new TransformMatrix(inert[i]);
                }
            }

            //now try and load special inertia data
            LoadInertiaData_SingleBone(_wrist.acsFile, (int)WristFilesystem.BIndex.RAD);
            LoadInertiaData_SingleBone(_wrist.acsFile_uln, (int)WristFilesystem.BIndex.ULN);
        }
Example #5
0
        private void LoadKinematicTransforms()
        {
            _numPositionsPerSeries    = new int[_xrommFileSystem.Trials.Length + 1];
            _numPositionsPerSeries[0] = 1; //CT Scan

            //temporarily save kinematics here, before we can pass them on
            List <TransformMatrix>[] tempTM = new List <TransformMatrix> [_xrommFileSystem.NumBones];
            for (int i = 0; i < _xrommFileSystem.NumBones; i++)
            {
                tempTM[i] = new List <TransformMatrix>();
                tempTM[i].Add(new TransformMatrix()); //add initial identity matrix for CT position
            }

            //lets loop through each Trial now and load the data
            for (int i = 0; i < _xrommFileSystem.Trials.Length; i++)
            {
                //Read in the data
                TransformMatrix[][] fm = DatParser.parseXrommKinematicFileToTransformMatrix(_xrommFileSystem.Trials[i].KinematicFilename);

                if (fm.Length == 0)
                {
                    throw new WristException("Unable to load Trial no data, help!");
                }

                //add data for each bone to the correct location
                for (int j = 0; j < _xrommFileSystem.NumBones; j++)
                {
                    tempTM[j].AddRange(fm[j]);
                }


                _numPositionsPerSeries[i + 1] = fm[0].Length;
            }

            _numberPositions = tempTM[0].Count; //the total count!

            //finally, lets move all the data into the bone structure
            for (int i = 0; i < _xrommFileSystem.NumBones; i++)
            {
                _bones[i].InitializeDataStructures(_numberPositions);
                _bones[i].SetTransformation(tempTM[i].ToArray());
            }
        }