LEAD Technologies, Inc

Annotation File Formats

When saving an image that has annotations, the annotation information is stored in a separate file. LEADTOOLS supports annotations using the CDLL, .NET Windows Forms and WPF/Silverlight platforms.

There are multiple options for the format of the file that stores the annotation information. Most of these formats take advantage of the platform's own native compatibility and maximize the speed of loading and saving the annotation objects.

In some situations, you may want to provide versions of your annotations-based application in multiple platforms, for example, CDLL, .NET Windows Forms and .NET WPF. In this case, you can use the LEADTOOLS XML Annotation file format to store the annotations files. This format is compatible with all LEADTOOLS annotations platforms and a file saved from any of the platforms can be loaded into another directly.

The following table lists the LEADTOOLS Annotation Platform engine and the LEADTOOLS XML file format equivalent identifier:
Engine LEADTOOLS XML File Format Identifier
CDLL (LTANN) ANNFMT_XML
.NET Windows.Forms (Leadtools.Annotations) AnnCodecsFormat.Xml
WPF (Leadtools.Windows.Annotations) AnnCodecsFormat.Xml
Silverlight (Leadtools.Windows.Annotations) Supported through WCF

When using the LEADTOOLS Silverlight Annotations platform, an external WCF service must be called to load and save annotations to and from LEADTOOLS XML file format to Silverlight AnnCodecsFormat.Serialize. Your LEADTOOLS installations include the project for the WCF service in the following path:
<LEADTOOLS_INSTALLDIR>\Examples\DotNet\CS\AnnConversionClientDemo

You can compile the project and host the service in your machine to provide the interpolation between Silverlight and the rest of the platforms. Also, LEAD hosts a version of the WCF service for you to use free of charge at the following location:
http://demo.leadtools.com/annotationservice/annconversionservice.svc To use the service, create an instance of the AnnConversionService and use the Convert method.

For an example, refer to following:

            private void button1_Click(object sender, EventArgs e)
            {
                 string sourceAnnotationFile =@"C:\Users\Public\Documents\LEADTOOLS Images\cannon.ann";
                 string destinationAnnotationFile =@"C:\Users\Public\Documents\LEADTOOLS Images\cannon.xml";
                     
                 RawBinaryData rawBinaryData = new RawBinaryData();
                 rawBinaryData.Data =File.ReadAllBytes(sourceAnnotationFile);
                     
                 ConvertOptions options = new ConvertOptions();
                 options.Format =AnnFormat.XmlNative;
                 options.Source = rawBinaryData;
                 
                 ConvertRequest request = new ConvertRequest();
                 request.Options = options;
                     
                 using (AnnotationsConversionServiceClient conversionService = new AnnotationsConversionServiceClient())
                 {
                     ConvertResponse response = conversionService.Convert(request);
                 
                     if (response != null)
                     {
                         for (int i = 0; i < response.Files.Length; ++i)
                         {
                             string filename = Path.GetFileNameWithoutExtension(destinationAnnotationFile);
                             filename = string.Format("{0}{1}.{2}", Path.Combine(Path.GetDirectoryName(destinationAnnotationFile), filename), i + 1,"xml");
                             RawBinaryData data = response.Files[i] as RawBinaryData;
                             File.WriteAllBytes(filename, data.Data);
                         }
                     }
                 }
             }
             

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.