Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New ROI objects created when editing existing ROIs? #64

Closed
jayyoung opened this issue Oct 26, 2016 · 6 comments
Closed

New ROI objects created when editing existing ROIs? #64

jayyoung opened this issue Oct 26, 2016 · 6 comments

Comments

@jayyoung
Copy link

jayyoung commented Oct 26, 2016

In the latest commit on the update branch, is this the right behaviour? I add a new ROI, and then every time I edit it by moving one of the vertices, a brand new ROI object is entered into the database with the same ID as the old one, but with the new vertices and a more recent timestamp, rather than (what I would expect, and how it worked in the past) updating the old ROI object.

Am I doing something wrong? This makes it hard to do what I have been doing before-- getting all the ROIs from the database, picking one, and seeing if a given point is in that ROI. I guess this is for learning dynamic ROIs online that might change over time? But I think there should be a service to just return the set of most up-to-date ROIs for everything. Maybe there is and I am just using the wrong service call?

@hkaraoguz ?

@hkaraoguz
Copy link
Collaborator

@jayyoung Yes now we also store the history of ROIs as @kunzel requested. Luckily I have also created a service for querying ROIS. You can use the service soma/query_rois for that. But I think there is no option to get the latest roi for each id. I will see how it can be done. Thanks for pointing this out.

@jayyoung
Copy link
Author

jayyoung commented Oct 26, 2016

Yeah that's the service I'm using, I updated everything to use the new methods, but noticed this behaviour.

It'd be really nice to be able to just query the most recent version of all the ROIs with a flag in the service call or something in order to get the current state. Or maybe instead of inserting a new entry into the database entirely when an ROI is updated, just keep the same database entry, but update a vector of the previous poses. So roi.poses[0] gets me the most recent posearray of the ROI, roi.poses[1] gets me the previous posearray, and so on. Not sure what's easiest/best, probably just a flag in the service call.

@hkaraoguz
Copy link
Collaborator

@jayyoung I have updated the roi query service with the flag returnmostrecent which will return you the most recent versions of rois when set to true. I have also opened a pull request for mongodb_store because the latest version of soma needs to have the updated version of mongodb_store. For an immediate solution you can use this version https://github.com/hkaraoguz/mongodb_store/tree/somaroiupdate

@jayyoung
Copy link
Author

Woo awesome! Thank you!

@hkaraoguz
Copy link
Collaborator

@jayyoung Did you check the functionality? Should we close this issue?

@jayyoung
Copy link
Author

jayyoung commented Nov 3, 2016

Yep sure sorry I only just got around to testing it. It seems to work just fine. Here is the test code I used to verify it in case you care:

import roslib
import rospy
from soma_msgs.msg import SOMAObject
from soma_manager.srv import *


if __name__ == '__main__':
    rospy.init_node('test_masks', anonymous = False)
    print("getting soma service")
    rospy.wait_for_service('/soma/query_rois')
    print("done")
    print("setting up proxy")
    soma_query = rospy.ServiceProxy('/soma/query_rois',SOMAQueryROIs)
    print("done")
    print("making query")

    query = SOMAQueryROIsRequest()
    query.returnmostrecent = True
    response = soma_query(query)

    print("found: " + str(len(response.rois)) + " rois using return_most_recent")
    for roi in response.rois:
        print(roi.id)

@jayyoung jayyoung closed this as completed Nov 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants