Hi Richard,

I found something similar in one of your posts in the mailing list archive 
before:

[...]Digging into the API again, I believe the fix should be this:

                MetaData metaData = (MetaData) 
jcas.getIndexRepository().getAllIndexedFS(MetaData.type).next()
[...]

If I get this right, in my example, ImageArea corresponds to MetaData? But 
ImageArea.type returns an Integer, where .getAllIndexedFS(Type arg0) needs a 
Type parameter. Now I am stuck with a similar problem, I cannot find anything 
in my CAS object that allows me to reference my ImageArea as a type. I'll try 
to figure out how to define a custom index as a next step.

Best regards,

Alex






--
Dipl. Bioinformatiker Alexander G. Klenner
Fraunhofer-Institute for Algorithms and Scientific Computing (SCAI)
Schloss Birlinghoven, D-53754 Sankt Augustin
Tel.: +49 - 2241 - 14 - 2736
E-mail: alexander.garvin.klen...@scai.fraunhofer.de
Internet: http://www.scai.fraunhofer.de


----- Original Message -----
From: "Richard Eckart de Castilho" <eckar...@tk.informatik.tu-darmstadt.de>
To: user@uima.apache.org
Sent: Tuesday, August 23, 2011 4:13:34 PM
Subject: Re: iterate over annotations

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
eckar...@tk.informatik.tu-darmstadt.de
www.ukp.tu-darmstadt.de
Web Research at TU Darmstadt (WeRC) www.werc.tu-darmstadt.de
-------------------------------------------------------------------




Reply via email to