def test_ResizeDimensionsFrom3To1Float(self):
     dim = btk.btkIntArray(3, 3)
     val = btk.btkDoubleArray(27, 1.950)
     test = btk.btkMetaDataInfo(dim, val)
     test.ResizeDimensions(1)
     self.assertEqual(len(test.GetDimensions()), 1)
     self.assertEqual(test.GetValueNumber(), 3)
Пример #2
0
 def test_ResizeDimensionsFrom3To1Float(self):
     dim = btk.btkIntArray(3, 3)
     val = btk.btkDoubleArray(27, 1.950)
     test = btk.btkMetaDataInfo(dim, val)
     test.ResizeDimensions(1)
     self.assertEqual(len(test.GetDimensions()), 1)
     self.assertEqual(test.GetValueNumber(), 3)
Пример #3
0
 def test_UtilsCreateChildFloat12Values(self):
     analog = btk.btkMetaData('ANALOG')
     btk.btkMetaDataCreateChild(analog, 'SCALE', btk.btkDoubleArray(12, 0.08333))
     scale = analog.GetChild('SCALE')        
     self.assertEqual(analog.GetChildNumber(), 1)
     self.assertEqual(scale.GetLabel(), 'SCALE')
     self.assertEqual(len(scale.GetDescription()), 0)
     self.assertEqual(scale.GetInfo().GetValueNumber(), 12)
Пример #4
0
 def test_UtilsCreateChildFloat12Values(self):
     analog = btk.btkMetaData('ANALOG')
     btk.btkMetaDataCreateChild(analog, 'SCALE',
                                btk.btkDoubleArray(12, 0.08333))
     scale = analog.GetChild('SCALE')
     self.assertEqual(analog.GetChildNumber(), 1)
     self.assertEqual(scale.GetLabel(), 'SCALE')
     self.assertEqual(len(scale.GetDescription()), 0)
     self.assertEqual(scale.GetInfo().GetValueNumber(), 12)
 def test_SetFormatFloat2Integer(self):
     dim = btk.btkIntArray(2, 5)
     val = btk.btkDoubleArray(25, 1.950)
     test = btk.btkMetaDataInfo(dim, val)
     self.assertEqual(test.GetFormat(), btk.btkMetaDataInfo.Real)
     test.SetFormat(btk.btkMetaDataInfo.Integer)
     self.assertEqual(test.GetFormat(), btk.btkMetaDataInfo.Integer)
     self.assertEqual(len(test.GetDimensions()), 2)
     self.assertEqual(test.GetValueNumber(), 25)
     for i in range(0,25):
         self.assertEqual(test.ToInt(i), 1)
Пример #6
0
 def test_SetFormatFloat2Integer(self):
     dim = btk.btkIntArray(2, 5)
     val = btk.btkDoubleArray(25, 1.950)
     test = btk.btkMetaDataInfo(dim, val)
     self.assertEqual(test.GetFormat(), btk.btkMetaDataInfo.Real)
     test.SetFormat(btk.btkMetaDataInfo.Integer)
     self.assertEqual(test.GetFormat(), btk.btkMetaDataInfo.Integer)
     self.assertEqual(len(test.GetDimensions()), 2)
     self.assertEqual(test.GetValueNumber(), 25)
     for i in range(0, 25):
         self.assertEqual(test.ToInt(i), 1)
 def test_SetDimensionForFloat(self):
     dim = [5,5]
     val = btk.btkDoubleArray(25, 1.950)
     test = btk.btkMetaDataInfo(dim, val)
     test.SetDimension(0, 6)
     self.assertEqual(len(test.GetDimensions()), 2)
     self.assertEqual(test.GetValueNumber(), 30)
     for i in range(0,5):
         self.assertEqual(test.ToDouble(i*6+5), 0.0)
     test.SetDimension(1, 6)
     self.assertEqual(test.GetValueNumber(), 36)
     for i in range(30,35):
         self.assertEqual(test.ToDouble(i), 0.0)
Пример #8
0
 def test_SetDimensionForFloat(self):
     dim = [5, 5]
     val = btk.btkDoubleArray(25, 1.950)
     test = btk.btkMetaDataInfo(dim, val)
     test.SetDimension(0, 6)
     self.assertEqual(len(test.GetDimensions()), 2)
     self.assertEqual(test.GetValueNumber(), 30)
     for i in range(0, 5):
         self.assertEqual(test.ToDouble(i * 6 + 5), 0.0)
     test.SetDimension(1, 6)
     self.assertEqual(test.GetValueNumber(), 36)
     for i in range(30, 35):
         self.assertEqual(test.ToDouble(i), 0.0)
Пример #9
0
 def test_SetFormatFloat2CharDim2(self):
     dim = [5, 5]
     val = btk.btkDoubleArray(25, 1.95)
     test = btk.btkMetaDataInfo(dim, val)
     self.assertEqual(test.GetFormat(), btk.btkMetaDataInfo.Real)
     test.SetFormat(btk.btkMetaDataInfo.Char)
     self.assertEqual(test.GetFormat(), btk.btkMetaDataInfo.Char)
     self.assertEqual(len(test.GetDimensions()), 3)
     self.assertEqual(test.GetDimensions()[0], 4)
     self.assertEqual(test.GetDimensions()[1], 5)
     self.assertEqual(test.GetDimensions()[2], 5)
     self.assertEqual(test.GetValueNumber(), 25)
     for i in range(0, 25):
         self.assertEqual(test.ToString(i), '1.95')
 def test_SetFormatFloat2CharDim2(self):
     dim = [5,5]
     val = btk.btkDoubleArray(25, 1.95)
     test = btk.btkMetaDataInfo(dim, val)
     self.assertEqual(test.GetFormat(), btk.btkMetaDataInfo.Real)
     test.SetFormat(btk.btkMetaDataInfo.Char)
     self.assertEqual(test.GetFormat(), btk.btkMetaDataInfo.Char)
     self.assertEqual(len(test.GetDimensions()), 3)
     self.assertEqual(test.GetDimensions()[0], 4)
     self.assertEqual(test.GetDimensions()[1], 5)
     self.assertEqual(test.GetDimensions()[2], 5)
     self.assertEqual(test.GetValueNumber(), 25)
     for i in range(0,25):
         self.assertEqual(test.ToString(i), '1.95')
Пример #11
0
 def test_Real2String2Real_Number(self):
     test = btk.btkMetaDataInfo(btk.btkDoubleArray(5, 1.2345))
     self.assertEqual(len(test.GetDimensions()), 1)
     self.assertEqual(test.GetDimensions()[0], 5)
     test.SetFormat(btk.btkMetaDataInfo.Char)
     self.assertEqual(len(test.GetDimensions()), 2)
     self.assertEqual(test.GetDimensions()[0], 6)
     self.assertEqual(test.GetDimensions()[1], 5)
     val = test.ToString()
     self.assertEqual(len(val), 5)
     for i in range(0, 5):
         self.assertEqual(val[i], '1.2345')
     test.SetFormat(btk.btkMetaDataInfo.Real)
     self.assertEqual(len(test.GetDimensions()), 1)
     self.assertEqual(test.GetDimensions()[0], 5)
     val2 = test.ToDouble()
     self.assertEqual(len(val2), 5)
     for i in range(0, 5):
         self.assertAlmostEqual(val2[i], 1.2345, 5)
 def test_Real2String2Real_Number(self):
     test = btk.btkMetaDataInfo(btk.btkDoubleArray(5, 1.2345))
     self.assertEqual(len(test.GetDimensions()), 1)
     self.assertEqual(test.GetDimensions()[0], 5)
     test.SetFormat(btk.btkMetaDataInfo.Char)
     self.assertEqual(len(test.GetDimensions()), 2)
     self.assertEqual(test.GetDimensions()[0], 6)
     self.assertEqual(test.GetDimensions()[1], 5)
     val = test.ToString()
     self.assertEqual(len(val), 5)
     for i in range(0,5):
         self.assertEqual(val[i], '1.2345')
     test.SetFormat(btk.btkMetaDataInfo.Real)
     self.assertEqual(len(test.GetDimensions()), 1)
     self.assertEqual(test.GetDimensions()[0], 5)
     val2 = test.ToDouble()
     self.assertEqual(len(val2), 5)
     for i in range(0,5):
         self.assertAlmostEqual(val2[i], 1.2345, 5)
Пример #13
0
 def test_Float2Double(self):
     test = btk.btkMetaDataInfo(btk.btkDoubleArray(5, 0.1))
     val = test.ToDouble()
     self.assertEqual(len(val), 5)
     for i in range(0, 5):
         self.assertAlmostEqual(val[i], 0.1, 5)
Пример #14
0
 def test_Real2Integer(self):
     test = btk.btkMetaDataInfo(btk.btkDoubleArray(5, 0.1))
     val = test.ToInt()
     self.assertEqual(len(val), 5)
     for i in range(0, 5):
         self.assertEqual(val[i], 0)
Пример #15
0
 def test_Real2String(self):
     test = btk.btkMetaDataInfo(btk.btkDoubleArray(5, 0.83333))
     val = test.ToString()
     self.assertEqual(len(val), 5)
     for i in range(0, 5):
         self.assertEqual(val[i], '0.83333')
 def test_Real2String(self):
     test = btk.btkMetaDataInfo(btk.btkDoubleArray(5, 0.83333))
     val = test.ToString()
     self.assertEqual(len(val), 5)
     for i in range(0,5):
         self.assertEqual(val[i], '0.83333')
 def test_Float2Double(self):
     test = btk.btkMetaDataInfo(btk.btkDoubleArray(5, 0.1))
     val = test.ToDouble()
     self.assertEqual(len(val), 5)
     for i in range(0,5):
         self.assertAlmostEqual(val[i], 0.1, 5)
 def test_Real2Integer(self):
     test = btk.btkMetaDataInfo(btk.btkDoubleArray(5, 0.1))
     val = test.ToInt()
     self.assertEqual(len(val), 5)
     for i in range(0,5):
         self.assertEqual(val[i], 0)