Exemple #1
0
 def test_05_07_get_pixel_data_3d(self):
     svc = ij2.get_dataset_service(self.context)
     result = svc.create1(np.array([10, 7, 3]), 
                          "MyDataset", 
                          [ij2.Axes().Y, ij2.Axes().X, ij2.Axes().CHANNEL],
                          16, False, False)
     imgplus = result.getImgPlus()
     
     script = """
     ra = imgplus.randomAccess();
     for (x=0;x<imgplus.dimension(0);x++) {
         ra.setPosition(x, 0);
         for (y=0;y<imgplus.dimension(1);y++) {
             ra.setPosition(y, 1);
             for (c=0;c<imgplus.dimension(2);c++) {
                 ra.setPosition(c, 2);
                 ra.get().set(x + y * 10 + c * 100);
             }
         }
     }
     """
     J.run_script(script, dict(imgplus=imgplus))
     pixel_data = ij2.get_pixel_data(imgplus)
     self.assertSequenceEqual(pixel_data.shape, [10, 7, 3])
     i, j, c = np.mgrid[0:10, 0:7, 0:3]
     np.testing.assert_array_equal(pixel_data, i + j*10 + c*100)
Exemple #2
0
 def test_05_05_get_dataset_pixel_data_axes(self):
     svc = ij2.get_dataset_service(self.context)
     result = svc.create1(np.array([10, 15]), 
                          "MyDataset", [ij2.Axes().Y, ij2.Axes().X],
                          8, False, False)
     pixel_data = result.get_pixel_data(axes = [ij2.Axes().X, ij2.Axes().Y])
     self.assertSequenceEqual(pixel_data.shape, [15, 10])
Exemple #3
0
 def test_05_02_create1(self):
     svc = ij2.get_dataset_service(self.context)
     result = svc.create1(np.array([10, 15]), "MyDataset",
                          [ij2.Axes().X, ij2.Axes().Y], 8, False, False)
     self.assertEqual(result.getName(), "MyDataset")
     self.assertTrue(result.isInteger())
     self.assertFalse(result.isSigned())
     result.getImgPlus()
     result.getType()
 def test_05_02_create1(self):
     svc = ij2.get_dataset_service(self.context)
     result = svc.create1(np.array([10, 15]),
                          "MyDataset", [ij2.Axes().X, ij2.Axes().Y],
                          8, False, False)
     self.assertEqual(result.getName(), "MyDataset")
     self.assertTrue(result.isInteger())
     self.assertFalse(result.isSigned())
     result.getImgPlus()
     result.getType()
Exemple #5
0
 def test_07_01_wrap_interval(self):
     svc = ij2.get_dataset_service(self.context)
     result = svc.create1(np.array([10, 15]), "MyDataset",
                          [ij2.Axes().Y, ij2.Axes().X], 8, False, False)
     imgplus = ij2.wrap_interval(result.getImgPlus())
     self.assertEqual(imgplus.min1D(0), 0)
     self.assertEqual(imgplus.max1D(1), 14)
     self.assertSequenceEqual(imgplus.minND(), [0, 0])
     self.assertSequenceEqual(imgplus.maxND(), [9, 14])
     self.assertSequenceEqual(imgplus.dimensions(), [10, 15])
 def test_07_01_wrap_interval(self):
     svc = ij2.get_dataset_service(self.context)
     result = svc.create1(np.array([10, 15]), 
                          "MyDataset", [ij2.Axes().Y, ij2.Axes().X],
                          8, False, False)
     imgplus = ij2.wrap_interval(result.getImgPlus())
     self.assertEqual(imgplus.min1D(0), 0)
     self.assertEqual(imgplus.max1D(1), 14)
     self.assertSequenceEqual(imgplus.minND(), [0, 0])
     self.assertSequenceEqual(imgplus.maxND(), [9, 14])
     self.assertSequenceEqual(imgplus.dimensions(), [10, 15])
Exemple #7
0
 def test_05_01_dataset_service(self):
     svc = ij2.get_dataset_service(self.context)