-
Notifications
You must be signed in to change notification settings - Fork 10
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
Support image annotation text file (backend) #340
Comments
@pford @veggiesaurus with this doc https://docs.google.com/document/d/1_eo3kmzHrMGDLuYmbMi6RQHytf0NiGyR_igRlBFjssc/edit I tried to find common properties of the casa region format and the ds9 region format. Please have a look. There are properties that are supported in one but not the other. Perhaps what we can do in CARTA is that we only support common properties as listed in the document. Please feel free to share your thoughts. : ) |
Since we currently only support region colours, line thicknesses and dash length on the frontend, I'd suggest we start with just those three properties. The colour could be sent as it is defined in the file, as a |
@pford can we implement the three important parameters (colour, line width and dash) for 1.4? |
@pford for 1.4 we just need the above three (colour, line width and dash). For the rest, we can wait until 1.5 or later |
@veggiesaurus SET_REGION has the region parameters as separate fields, and I could just add the style parameters. But IMPORT_REGION_ACK and RESUME_SESSION.ImageProperties contain RegionProperties submessage arrays consisting of region_id and RegionInfo, so I would need to add the style parameters to RegionInfo. What do you think about changing SET_REGION to use RegionInfo as a single field? I think we can keep the SET_REGION.region_id field; RegionProperties was added to send a list of regions. |
@pford are you saying we have something like this?
(and then updating I'd also like to change from using
To me, that makes more logical sense. I suppose we could apply the same approach to the |
Yes, just to avoid having to change region parameters in two places. But I can also set the backend struct from the SetRegion parameters as before. I am fine with removing RegionProperties in favor of a map. |
Ok, let's go with the map approach for both region properties and image properties, and make use of region info in the setregion function as you suggested. If you sort out the protobuf branch and backend branch I'll put together a frontend branch. Shouldn't be much trouble |
I think we should keep the file_id field in SetRegion, not needed in ImportRegionAck and needs to be in ImageProperties (not RegionInfo) for ResumeSession. |
Ok, that sounds sensible |
I have pushed protobuf branch pam/region_style and backend branch pam/340_region_style. These changes will break the ICD tests and the scripting client if there is a way to set a region. If my protobuf changes look okay to you, I will put a comment in the interface channel. I cannot set a region (and therefore cannot export it) in this branch until the frontend is done. I'll try testing region import. |
@pford I've created a frontend branch I also managed to crash the backend somehow, when deleting regions. But can't reproduce this issue reliably. I'll file an issue for it if I manage to do it again edit: I wonder if this has something to do with the map key being an int instead of a string 🤔 Probably not, because it seems to work fine for the other maps we use edit2: The binary message being sent back ( edit3: Ok, I see the problem. The map wasn't getting set. I've pushed a commit to your branch that fixes this issue 😄 |
Hmm I made the RegionInfo line_width field an int, but it could be a float in the frontend. The casaviewer and the SAOImageDS9 viewer only allow integral line widths in their GUIs (drop-down or spinner). The imageanalysis code returns line width from a CRTF import as an unsigned int. What should we do? |
Probably fine to keep it an int then. I don't mind making the line width integral in the frontend too |
Apparently CRTF and DS9 only accept color names and RGB as color strings. Should I convert the hex to rgb, or just send the rgb from the frontend? edit: I wrote a converter function |
The backend branch is ready to test when the frontend supports it. The message contents in the console look correct.
|
Sorry, I completely missed this. The front-end can deal with hex, RGB or colour names. I can easily convert to RGB if you'd prefer? Am already using a battle tested front-end library that handles it |
All three formats work in the backend as well. For CRTF export, I just had to strip the leading '#' and convert to lowercase, then do the reverse for import. The DS9 code just passes the hex strings frontend->file and file->frontend. The casaviewer and DS9 viewer can import CARTA-produced region files with the hex codes. |
Ok, the frontend is now using the imported region styling. I noticed that regions without a dash are turning into dashed regions when exported to CRTF. Seem to be fine with DS9 regions though. I'm wondering what the solution is in terms of sending styling information to the backend. It's not really relevant until the backend wants to export it, and I'm a little worried about sending a Edit: perhaps the simplest solution: when sending a region export, why don't we just send the regions explicitly, as a |
The backend has to route the code through the Region class for export conversions (pixel to world, apply region to different image), so resending the type, control points, and rotation with ExportRegion adds complexity as the backend will effectively SetRegion (and check for changes for updating data streams) then export. What if we revert RegionInfo to type/points/rotation and create a separate RegionStyle for name/color/linewidth/dashlist? Then use the two submessages as needed; ImportRegionAck is the only one which requires both.
Side note, in angus/region_icd_change I cannot change the pixel control points in the Region widget. |
This sounds good
Ok, I'll have a look tomorrow morning |
I updated the protobuf and backend branches with RegionStyle (note that region name was moved from RegionInfo to RegionStyle). |
Commit |
Found and fixed an existing bug, resuming a session with region id 0 sets the cursor not a region. Also fixed importing color by name. Since CRTF has no dash_list (just SOLID or DASHED), backend sets dashlist={2, 2} on import when linestyle=--. This DASH_LENGTH constant is set in InterfaceConstants.h if it should be another value. So the imported dash_list may not return the original dash_list. |
That's sensible. Do you think we're ready for a PR of frontend and backend? |
@kswang1029 can annotation regions be matched then exported, like any other region? |
@kswang1029 never mind about the matched region question, it is in the requirements document. Another question: In DS9, you can change the coordinate system for a region, e.g. for an FK5 image change a region to FK4 coordinates in the region information. If you export the regions in FK5 coordinates in the export dialog, most regions are exported as |
@pford this sounds quite inconsistent and confusing. Not sure the reason why it is implemented that way in ds9. I would suggest we make it consistent in CARTA. |
Supported in v1.4:
Requirements for v4:
https://docs.google.com/document/d/1YCB_lIVH8ftJcNS0gliE2uHmuiowGkV6DQYJlfteJUM/edit#
Must support:
The text was updated successfully, but these errors were encountered: