Hello Alex,
you'll probably have to use cas.getIndexRepository().getAllIndexedFS(type) to
get to your custom annotations. You can also define a custom index and then use
cas.getIndexRepository().getIndex(label).
Cheers,
Richard
Am 23.08.2011 um 15:54 schrieb Alexander Klenner:
> Greetings,
>
> I am still working on my image processing. As suggested I stored the image by
> using .setSofaDataArray and a ByteArrayFS. I also have an ImageArea Type with
> Features for x,y,width and height describing an actual image area (similar to
> the .getSubimage(x,y,width,height) method from java awt). ImageArea extends
> AnnotationBase instead of Annotation to get rid of all the text-specific
> stuff, which doesn't make much sense in this case. I also have the equivalent
> for getCoveredText implemented, returning the annotated ImageArea as a
> bufferedImage.
>
> Serialising and Deserialising works fine, the XCAS file gets quite large in
> comparison to the original image file but that is expected. All the found
> ImageAreas are annotated inside the XCAS with their Features set correctly.
> That looks like this inside the XCAS.xml file:
>
> [...]<de.types.ImageArea _indexed="1" _id="11" _ref_sofa="4" x="16" y="153"
> width="10" heigth="10"/><de.types.ImageArea _indexed="1" _id="17"
> _ref_sofa="4" x="16" y="164" width="10" heigth="10"/>[...]
>
> Now here is my problem: I wanted to save the actual ImageAreas as images
> using a different consumer. I just cannot find the annotations in my CAS
> object. But the annotations are there, otherwise they would not appear inside
> the XCAS.xml file, right? Here is what I tried:
> ...............
> Iterator iter = myJCas.getAnnotationIndex().iterator();
>
> while (iter.hasNext()) {
> //do something
> }
> ...............
> But iter is always empty, hence the while condition is never met.
>
> Isn't this the supposed approach to iterate over the annotations that were
> made before? I don't get any error messages, I just cannot find my
> annotations.
>
> Probably the solution is very easy but I just don't see it, again thanks for
> any help, it's really appreciated, I have no one else to talk to about UIMA
> but you guys on the mailing list.
>
> Thank you!
>
> Alex
--
-------------------------------------------------------------------
Richard Eckart de Castilho
Technical Lead
Ubiquitous Knowledge Processing Lab
FB 20 Computer Science Department
Technische Universität Darmstadt
Hochschulstr. 10, D-64289 Darmstadt, Germany
phone [+49] (0)6151 16-7477, fax -5455, room S2/02/B117
[email protected]
www.ukp.tu-darmstadt.de
Web Research at TU Darmstadt (WeRC) www.werc.tu-darmstadt.de
-------------------------------------------------------------------