Page 1 of 1

How to search text annotation in TIFF file?

Posted: Wed Jul 23, 2008 3:20 pm
by Alex
VintaSoftAnnotation.NET Plug-in can be used for annotation of images stored in TIFF file. Later image can be searched in TIFF file using it's annotation. Example below shows how to search image into TIFF file.

Here is a code sample for VB.NET:

Code: Select all

  Dim images As ImageCollection = new ImageCollection()
  Dim annotations As AnnotationController = new AnnotationController(images)
  Dim imageIndex As Integer, annoIndex As Integer
  For imageIndex = 0 To images.Count - 1
    Dim imageAnnotations As AnnotationCollection = annotations(imageIndex)
    For annoIndex = 0 To imageAnnotations.Count - 1
         Dim textAnno As TextAnnotation = CType(imageAnnotations(annoIndex), TextAnnotation)
         If textAnno.GetType() Is GetType(TextAnnotation) Then
         If textAnno.Text = "MySearchString"
           MsgBox "Annotation 'MySearchString' is found!"
         End If
       End If
    Next annoIndex
  Next imageIndex
and here is a code sample for C#:

Code: Select all

  ImageCollection images = new ImageCollection();
  AnnotationController annotations = new AnnotationController(images);
  for (int imageIndex = 0; imageIndex < images.Count; imageIndex++)
    AnnotationCollection imageAnnotations = annotations[imageIndex];
    for (int annoIndex = 0; annoIndex < imageAnnotations.Count; annoIndex++)
       TextAnnotation textAnno = imageAnnotations[annoIndex] As TextAnnotation;
       if (textAnno != null)
         if (textAnno.Text == "MySearchString")
           MessageBox.Show("Annotation 'MySearchString' is found!");