def setPixelsSizeY(self, y, imageIndex, binDataIndex):
     try:
         jutil.call(self.o, 'setPixelsSizeY',
                    '(Lome/xml/model/primitives/PositiveInteger;I)V',
                    PositiveInteger(y), imageIndex)
     except jutil.JavaException:
         jutil.call(self.o, 'setPixelsSizeY', 
                    '(Ljava/lang/Integer;II)V', y, imageIndex, binDataIndex)
示例#2
0
 def setPixelsSizeY(self, y, imageIndex, binDataIndex):
     try:
         jutil.call(self.o, 'setPixelsSizeY',
                    '(Lome/xml/model/primitives/PositiveInteger;I)V',
                    PositiveInteger(y), imageIndex)
     except jutil.JavaException:
         jutil.call(self.o, 'setPixelsSizeY', '(Ljava/lang/Integer;II)V', y,
                    imageIndex, binDataIndex)
示例#3
0
 def test_03_09_cw_get_method(self):
     sclass = J.class_for_name('java.lang.String')
     iclass = J.get_static_field('java/lang/Integer', 'TYPE', 
                                 'Ljava/lang/Class;')
     c = J.get_class_wrapper('java.lang.String')
     m = c.getMethod('charAt', [ iclass ])
     self.assertEqual(J.to_string(J.call(m, 'getReturnType', '()Ljava/lang/Class;')), 'char')
     m = c.getMethod('concat', [ sclass])
     self.assertEqual(J.to_string(J.call(m, 'getReturnType', '()Ljava/lang/Class;')), 
                      'class java.lang.String')
 def setLogicalChannelSamplesPerPixel(self, samplesPerPixel, imageIndex, channelIndex):
     'For a particular LogicalChannel, sets number of channel components in the logical channel.'
     try:
         jutil.call(self.o, 'setChannelSamplesPerPixel',
                    '(Lome/xml/model/primitives/PositiveInteger;II)V',
                    PositiveInteger(samplesPerPixel),
                    imageIndex, channelIndex)
     except jutil.JavaException:
         jutil.call(self.o, 'setLogicalChannelSamplesPerPixel',
                    '(Ljava/lang/Integer;II)V', samplesPerPixel,
                    imageIndex, channelIndex)
示例#5
0
 def setLogicalChannelSamplesPerPixel(self, samplesPerPixel, imageIndex,
                                      channelIndex):
     'For a particular LogicalChannel, sets number of channel components in the logical channel.'
     try:
         jutil.call(self.o, 'setChannelSamplesPerPixel',
                    '(Lome/xml/model/primitives/PositiveInteger;II)V',
                    PositiveInteger(samplesPerPixel), imageIndex,
                    channelIndex)
     except jutil.JavaException:
         jutil.call(self.o, 'setLogicalChannelSamplesPerPixel',
                    '(Ljava/lang/Integer;II)V', samplesPerPixel, imageIndex,
                    channelIndex)
 def setPixelsDimensionOrder(self, dimension_order, imageIndex, binDataIndex):
     '''Set the dimension order for a series'''
     # Post loci_tools 4.2 - use ome.xml.model.DimensionOrder
     try:
         jdimension_order = jutil.static_call(
             'ome/xml/model/enums/DimensionOrder', 'fromString',
             '(Ljava/lang/String;)Lome/xml/model/enums/DimensionOrder;',
             dimension_order)
         jutil.call(self.o, 'setPixelsDimensionOrder',
                    '(Lome/xml/model/enums/DimensionOrder;I)V',
                    jdimension_order, imageIndex)
     except jutil.JavaException:
         jutil.call(self.o, 'setPixelsDimensionOrder',
                    '(Ljava/lang/String;II)V',
                    dimension_order, imageIndex, binDataIndex)
 def setPixelsBigEndian(self, bigEndian, imageIndex, binDataIndex):
     '''Set the endianness for a particular image
     
     bigEndian - True for big-endian, False for little-endian
     imageIndex - index of the image in question from IFormatReader.get_index?
     binDataIndex - ???
     '''
     # Post loci_tools 4.2
     try:
         jutil.call(self.o, 'setPixelsBinDataBigEndian',
                    '(Ljava/lang/Boolean;II)V',
                    bigEndian, imageIndex, binDataIndex)
     except jutil.JavaException:
         jutil.call(self.o, 'setPixelsBigEndian', '(Ljava/lang/Boolean;II)V',
                    bigEndian, imageIndex, binDataIndex)
示例#8
0
    def setPixelsBigEndian(self, bigEndian, imageIndex, binDataIndex):
        '''Set the endianness for a particular image

        bigEndian - True for big-endian, False for little-endian
        imageIndex - index of the image in question from IFormatReader.get_index?
        binDataIndex - ???
        '''
        # Post loci_tools 4.2
        try:
            jutil.call(self.o, 'setPixelsBinDataBigEndian',
                       '(Ljava/lang/Boolean;II)V', bigEndian, imageIndex,
                       binDataIndex)
        except jutil.JavaException:
            jutil.call(self.o, 'setPixelsBigEndian',
                       '(Ljava/lang/Boolean;II)V', bigEndian, imageIndex,
                       binDataIndex)
示例#9
0
 def setPixelsDimensionOrder(self, dimension_order, imageIndex,
                             binDataIndex):
     '''Set the dimension order for a series'''
     # Post loci_tools 4.2 - use ome.xml.model.DimensionOrder
     try:
         jdimension_order = jutil.static_call(
             'ome/xml/model/enums/DimensionOrder', 'fromString',
             '(Ljava/lang/String;)Lome/xml/model/enums/DimensionOrder;',
             dimension_order)
         jutil.call(self.o, 'setPixelsDimensionOrder',
                    '(Lome/xml/model/enums/DimensionOrder;I)V',
                    jdimension_order, imageIndex)
     except jutil.JavaException:
         jutil.call(self.o, 'setPixelsDimensionOrder',
                    '(Ljava/lang/String;II)V', dimension_order, imageIndex,
                    binDataIndex)
示例#10
0
 def test_03_07_cw_get_fields(self):
     c = J.get_class_wrapper('java.lang.String')
     fields = c.getFields()
     fields = J.get_env().get_object_array_elements(fields)
     self.assertEqual(len(fields), 1)
     self.assertEqual(J.call(fields[0], 'getName', '()Ljava/lang/String;'),
                      "CASE_INSENSITIVE_ORDER")
示例#11
0
 def test_01_06_get_enumeration_wrapper(self):
     properties = J.static_call("java/lang/System", "getProperties",
                                "()Ljava/util/Properties;")
     keys = J.call(properties, "keys", "()Ljava/util/Enumeration;")
     enum = J.get_enumeration_wrapper(keys)
     has_java_vm_name = False
     while(enum.hasMoreElements()):
         key = J.to_string(enum.nextElement())
         if key == "java.vm.name":
             has_java_vm_name = True
     self.assertTrue(has_java_vm_name)
示例#12
0
 def test_02_03_death_and_resurrection(self):
     '''Put an object into another in Java, delete it in Python and recover it'''
     
     np.random.seed(24)
     my_value = np.random.randint(0, 1000)
     jobj = J.make_instance("java/lang/Integer", "(I)V", my_value)
     integer_klass = self.env.find_class("java/lang/Integer")
     jcontainer = self.env.make_object_array(1, integer_klass)
     self.env.set_object_array_element(jcontainer, 0, jobj)
     del jobj
     gc.collect()
     jobjs = self.env.get_object_array_elements(jcontainer)
     jobj = jobjs[0]
     self.assertEqual(J.call(jobj, "intValue", "()I"), my_value)
示例#13
0
 def test_01_11_class_for_name(self):
     c = J.class_for_name('java.lang.String')
     name = J.call(c, 'getCanonicalName', '()Ljava/lang/String;')
     self.assertEqual(name, 'java.lang.String')
示例#14
0
 def test_01_03_call(self):
     jstring = self.env.new_string_utf("Hello, world")
     self.assertEqual(J.call(jstring, "charAt", "(I)C", 0), "H")
示例#15
0
 def test_03_11_cw_get_constructor(self):
     c = J.get_class_wrapper('java.lang.String')
     sclass = J.class_for_name('java.lang.String')
     constructor = c.getConstructor([sclass])
     self.assertEqual(J.call(constructor, 'getName', '()Ljava/lang/String;'),
                      'java.lang.String')
示例#16
0
 def test_03_10_cw_get_methods(self):
     c = J.get_class_wrapper('java.lang.String')
     mmm = J.get_env().get_object_array_elements(c.getMethods())
     self.assertTrue(any([J.call(m, 'getName', '()Ljava/lang/String;') == 'concat'
                          for m in mmm]))
示例#17
0
 def test_03_08_cw_get_field(self):
     c = J.get_class_wrapper('java.lang.String')
     field = c.getField('CASE_INSENSITIVE_ORDER')
     modifiers = J.call(field, 'getModifiers', '()I')
     static = J.get_static_field('java/lang/reflect/Modifier','STATIC','I')
     self.assertEqual((modifiers & static), static)