[Ves] Passing data from VES to objective-C

Pat Marion pat.marion at kitware.com
Thu Apr 19 11:41:36 EDT 2012


I had a typo in my code example

vesKiwiBrain  should be:  vesKiwiBrainAtlasRepresentation* rep =
self->renderer.app->getBrainRepresentation();


On Thu, Apr 19, 2012 at 11:32 AM, Pat Marion <pat.marion at kitware.com> wrote:

> Hi Dan,
>
> Are you using vesKiwiViewerApp or have to forked/renamed it to create your
> own app class?  Either way, I'd add a new convenience method to your app
> class (or vesKiwiViewerApp) that returns the representation:
>
> vesKiwiBrainAtlasRepresentation*
> vesKiwiViewerApp::getBrainRepresentation();
>
> Next, modify vesKiwiBrainAtlasRepresentation (or fork and rename it to be
> your own class), so that rather than show a text label, it stores the 2D
> screen coordinates and the model id and string.  Then add api to the
> representation, something like:
>
> // return whether or not a model was selected during the last double tap
> event
> bool modelWasSelected();
>
> // return information about the model that was selected during the last
> double tap event
> int selectedModelId();
> std::string selectedModelName();
> vesVector2f selectedModelScreenCoordinates();
>
>
> Then, in objective-c, after calling:
>
> * *self->renderer.app->handleDoubleTap(currentLocation.x,
> currentLocation.y);
>
> You could do:
>
> vesKiwiBrain
> * *if (rep->modelWasSelected()) {
>
>   NSString* modelName = [NSString
> stringWithUTF8String:rep->selectedModelName().c_str()];
>   ...
>
> }
>
> Hope this helps!
>
> Pat
>
>
>
> On Thu, Apr 19, 2012 at 11:13 AM, Aashish Chaudhary <
> aashish.chaudhary at kitware.com> wrote:
>
>> Hi Dan,
>>
>> On Thu, Apr 19, 2012 at 10:46 AM, Belsey, Daniel (UK)
>> <Daniel.Belsey at baesystems.com> wrote:
>> > Hi,
>> >
>> >
>> >
>> > I’m new to all of VES, VTK, objective-C and iOS dev – so apologies if
>> any of
>> > this is obvious!
>>
>>
>> >
>> > My initial task is to modify the brain atlas example included in
>> Kiwiviewer,
>> > so that when a part of the brain is double-tapped, instead of the part’s
>> > name appearing as it does now, it instead appears in a message-box. The
>> idea
>> > being, further down the line we’ll be storing a web link instead of the
>> > part’s name, and then hopefully get some content from the web link and
>> > display this in the message box.
>> >
>> >
>> >
>> > We were originally going to do it with Android, but we don’t have a
>> linux
>> > machine available and had no joy getting it working on my windows
>> machine
>> > (and then found from this mailing list that Cygwin was unsupported
>> too!) so
>> > now there’s a Mac in the process of being set up and I’ve been asked to
>> do
>> > it for iOS instead.
>> >
>> >
>> >
>> > I’m having trouble wrapping my head around how to do this, however.
>> I’ve got
>> > a rough idea – presumably EAGLView.mm’s handleDoubleTapGesture method
>> can be
>> > modified to show a UIAlertView, but I don’t know quite how to get the
>> data
>> > from the app’s handleDoubleTap method.
>> >
>> >
>> >
>> > I’m assuming (and please correct me on this!) that
>> > vesKiwiViewerApp::handleDoubleTap gets called first, and that then calls
>> > BrainRepresentation::handleDoubleTap.
>>
>> If I recall this sounds correct.
>>
>> I’m not sure if this is true because I
>> > don’t really understand the use of rep; but, if this is true, I’m
>> guessing
>> > it wouldn’t be too hard to change the return types to String in both
>> cases
>> > (and make sure the conditionals still make sense), but even if this is
>> true,
>> > I’m then not sure how to handle this on the object-C side of things.
>> Would
>> > it just be as simple as adding:
>> >
>> >
>> >
>> > NSString* name = self->renderer.app->handleDoubleTap(currentLocation.x,
>> > currentLocation.y);
>>
>> I will let Pat give you more details on it but I would think that you
>> can derive your own representation from
>> vesKiwiBrainAtlasRepresentation and  then add a new  method that can
>> give
>> a string name of the model, call this method findModel(x,y) or something.
>>
>> HTH,
>> Aashish
>>
>>
>>
>> >
>>
>>
>> >
>> >
>> > Apologies for the vague email – I think I just need some direction!
>> >
>> >
>> >
>> > Many thanks in advance,
>> >
>> >
>> >
>> > Dan
>> >
>> >
>> >
>> >
>> > ********************************************************************
>> > This email and any attachments are confidential to the intended
>> > recipient and may also be privileged. If you are not the intended
>> > recipient please delete it from your system and notify the sender.
>> > You should not copy it or use it for any purpose nor disclose or
>> > distribute its contents to any other person.
>> > ********************************************************************
>> >
>> >
>> > _______________________________________________
>> > Ves mailing list
>> > Ves at public.kitware.com
>> > http://public.kitware.com/cgi-bin/mailman/listinfo/ves
>> >
>>
>>
>>
>> --
>> | Aashish Chaudhary
>> | R&D Engineer
>> | Kitware Inc.
>> | www.kitware.com
>> _______________________________________________
>> Ves mailing list
>> Ves at public.kitware.com
>> http://public.kitware.com/cgi-bin/mailman/listinfo/ves
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/ves/attachments/20120419/0409a4e1/attachment-0001.html>


More information about the Ves mailing list