Example #1
0
def createOMEXMLMetadata():
    '''Creates an OME-XML metadata object using reflection, to avoid direct
    dependencies on the optional loci.formats.ome package.
    '''
    return jutil.static_call('loci/formats/MetadataTools',
                             'createOMEXMLMetadata',
                             '()Lloci/formats/meta/IMetadata;')
Example #2
0
 def test_01_09_jdictionary_to_string_dictionary(self):
     properties = J.static_call("java/lang/System", "getProperties",
                                "()Ljava/util/Properties;")
     d = J.get_dictionary_wrapper(properties)
     pyd = J.jdictionary_to_string_dictionary(properties)
     keys = J.jenumeration_to_string_list(d.keys())
     for key in keys:
         value = J.to_string(d.get(key))
         self.assertEqual(pyd[key], value)
Example #3
0
 def test_01_08_jenumeration_to_string_list(self):
     properties = J.static_call("java/lang/System", "getProperties",
                                "()Ljava/util/Properties;")
     d = J.get_dictionary_wrapper(properties)
     keys = J.jenumeration_to_string_list(d.keys())
     enum = J.get_enumeration_wrapper(d.keys())
     for i in range(d.size()):
         key = J.to_string(enum.nextElement())
         self.assertEqual(key, keys[i])
Example #4
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)
 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)
Example #6
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)
Example #7
0
 def test_01_07_get_dictionary_wrapper(self):
     properties = J.static_call("java/lang/System", "getProperties",
                                "()Ljava/util/Properties;")
     d = J.get_dictionary_wrapper(properties)
     self.assertTrue(d.size() > 10)
     self.assertFalse(d.isEmpty())
     keys = J.get_enumeration_wrapper(d.keys())
     values = J.get_enumeration_wrapper(d.elements())
     n_elems = d.size()
     for i in range(n_elems):
         self.assertTrue(keys.hasMoreElements())
         key = J.to_string(keys.nextElement())
         self.assertTrue(values.hasMoreElements())
         value = J.to_string(values.nextElement())
         self.assertEqual(J.to_string(d.get(key)), value)
     self.assertFalse(keys.hasMoreElements())
     self.assertFalse(values.hasMoreElements())
Example #8
0
 def test_01_03_01_static_call(self):
     result = J.static_call("Ljava/lang/String;", "valueOf", 
                            "(I)Ljava/lang/String;",123)
     self.assertEqual(result, "123")
def createOMEXMLMetadata():
    '''Creates an OME-XML metadata object using reflection, to avoid direct 
    dependencies on the optional loci.formats.ome package.
    '''
    return jutil.static_call('loci/formats/MetadataTools', 'createOMEXMLMetadata', '()Lloci/formats/meta/IMetadata;')