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

Support complex image types #520

Closed
7 tasks
pford opened this issue May 6, 2020 · 15 comments · Fixed by #1079
Closed
7 tasks

Support complex image types #520

pford opened this issue May 6, 2020 · 15 comments · Fixed by #1079
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@pford
Copy link
Collaborator

pford commented May 6, 2020

Currently, all images are opened with float data type. Carta should support:

  • Complex image
  • Integer image
  • Boolean Image

See #868

This issue separated to prioritise complex image types.

Issue separated from #388 , see also #77

For a complex-valued image, we need to support the following raster data requested from the frontend:

  • real part of the complex value
  • imaginary part of the complex value
  • amplitude of the complex value (ie the Euler form)
  • phase of the complex value (ie the Euler form)
@pford
Copy link
Collaborator Author

pford commented May 6, 2020

Copying comment from #388:
We should probably investigate alternative data delivery mechanisms for integer and boolean images. For integers, the byte-shuffling and Zstd compression approach taken with contours would probably work nicely. For booleans, sending them as bit arrays rather than byte arrays, and using Zstd (or even just the gzip compression built into WebSocket transmission) should be sufficient.

Converting to floating point and doing lossy compression with ZFP on quantized data would be counter-productive.

@jott3077
Copy link

jott3077 commented May 8, 2020

Sanjay would like to see the complex images as a high priority as it is essential for ARDG. Is there a chance that can be addressed first?

@sanbw
Copy link

sanbw commented May 8, 2020

Yes please. Support for complex-valued images with options to display them as real, imaginary, amplitude or phase is what we (ARDG) needs. Basically the kind of support that exists in the current casa viewer.

@sanbw
Copy link

sanbw commented May 8, 2020

An example complex image can be picked up from /home/dhruva2/disk4/sanjay/CFCaches/CFS_0_0_CF_5_30_1.im. The header of this image looks like the following:

INFO Image data type : Complex
INFO + Image name : CFS_0_0_CF_5_30_1.im
INFO + Object name :
INFO + Image type : PagedImage
INFO + Image quantity : Intensity
INFO + Pixel mask(s) : None
INFO + Region(s) : None
INFO
INFO + Spectral reference : LSRK
INFO + Velocity type : RADIO
INFO + Rest frequency : 2.98513e+09 Hz
INFO + Telescope : UNKNOWN
INFO + Observer : UNKNOWN
INFO + Date observation : UNKNOWN
INFO +
INFO + Axis Coord Type Name Proj Shape Tile Coord value at pixel Coord incr Units
INFO + --------------------------------------------------------------------------------------------
INFO + 0 0 Linear UU 1361 195 0 1536.00 -2.062648e+00 lambda
INFO + 1 0 Linear VV 1361 171 0 1536.00 2.062648e+00 lambda
INFO + 2 1 Stokes Stokes 1 1 RR
INFO + 3 2 Spectral Frequency 1 1 2.669e+09 0.00 1.930088460380e+09 Hz
INFO + Velocity 31748.8 0.00 -1.938359e+05 km/s
INFO
INFO + Attached miscellaneous Information :
INFO + MiscInfo : Xsupport: Int 32
INFO + MiscInfo : Ysupport: Int 32
INFO + MiscInfo : Sampling: Float 20
INFO + MiscInfo : ParallacticAngle: Double -99.1609
INFO + MiscInfo : MuellerElement: Int 15
INFO + MiscInfo : WValue: Double 120733
INFO + MiscInfo : WIncr: Double 0.0074545
INFO + MiscInfo : Name: String "CFS_0_0_CF_5_30_1.im"
INFO + MiscInfo : ConjFreq: Double 3.309e+09
INFO + MiscInfo : ConjPoln: Int 8
INFO + MiscInfo : TelescopeName: String "EVLA"
INFO + MiscInfo : BandName: String "EVLA_S"
INFO + MiscInfo : Diameter: Float 25
INFO + MiscInfo : OpCode: Bool 0

@veggiesaurus
Copy link
Collaborator

@jott3077 Could we effectively treat the different representations of these complex numbers (real, imag, amplitude, phase) in a similar manner to the different Stokes parameters? The real and imaginary parts would be directly stored in the data, right? And the amplitude and phase would b calculated from the stored values. I know @arusstaylor has requested something similar for Stokes cubes (#433), so it might make sense to implement these two requests simultaneously.

@jott3077
Copy link

jott3077 commented May 12, 2020 via email

@jott3077
Copy link

jott3077 commented May 12, 2020 via email

@sanbw
Copy link

sanbw commented May 17, 2020 via email

@kswang1029 kswang1029 changed the title Support images with various data types Support images with various data types: integer, complex, boolean Nov 23, 2020
@kswang1029 kswang1029 changed the title Support images with various data types: integer, complex, boolean Support integer, complex and boolean image types Nov 23, 2020
@kswang1029 kswang1029 assigned jolopezl and unassigned pford Jun 9, 2021
@Kechil Kechil added this to the v3.0b-1 milestone Jun 23, 2021
@Kechil Kechil changed the title Support integer, complex and boolean image types Support complex image types Jul 14, 2021
@Kechil
Copy link

Kechil commented Jul 14, 2021

Note that this was originally support integer, complex and boolean image types but has been split to isolate complex types in order to male the v3-b1 release.

@pford
Copy link
Collaborator Author

pford commented Jul 14, 2021

Once the backend image-handling code is templatized instead of ImageInterface<float>, it should be able to handle any datatype. I do not know that splitting off two data types is saving any work. The interface needs to be changed for handling complex data, so at the same time the raster data message could indicate to the frontend that the returned data is amp/phase/real/imag/bool/int. But it is up to @jolopezl whether splitting this issue would be easier and faster.

@veggiesaurus
Copy link
Collaborator

I think it still makes sense to split then up because complex images are a special case. It's not just a matter of reading a different data type, you also need to treat the complex cube like a number of separate cubes (similar to a Stokes hypercube), so that the user can visualise amp/real/imag/phase similar to IQUV

@veggiesaurus veggiesaurus modified the milestones: v3.0b-1, v3.0b-2 Aug 5, 2021
@pford
Copy link
Collaborator Author

pford commented Aug 19, 2021

Here's the doc from the original issue, with a link to sample images:
https://docs.google.com/document/d/1qH118KxBtxX4xtLNrV18meScxciFCVyIc9kelZ0JCvo/edit

@kswang1029 kswang1029 modified the milestones: v3.0b-2, v3.0b-3 Jan 5, 2022
@kswang1029
Copy link
Contributor

Based on the recent slack discussion, shall we try to re-use LEL to support loading either real or imaginary or amp or phase of a complex image via the file browser?

@kswang1029
Copy link
Contributor

kswang1029 commented Mar 30, 2022

@jolopezl @Kechil @sanbw @veggiesaurus with the current dev backend and frontend, we can load a complex image via LEL. For example, with
AMPLITUDE("complex.image"),
PHASE("complex.image"),
REAL("complex.image"), and
IMAG("complex.image"),
we can load the amplitude or phase or real part or imaginary part of the complex image, respectively.

The current remaining issue is that the backend cannot generate file info and header to be displayed at the frontend. Once the file info is available, the frontend can have a new dropdown similar to what we do for a FITS image with multiple HDUs to include the four components as amplitude, phase, real, and imaginary. Then based on user selection at the frontend, the frontend makes a mock up LEL expression to load the selected component internally.

Do you think the proposed approach fits the requirements?

@jolopezl
Copy link
Contributor

@jolopezl @Kechil @sanbw @veggiesaurus with the current dev backend and frontend, we can load a complex image via LEL. For example, with AMPLITUDE("complex.image"), PHASE("complex.image"), REAL("complex.image"), and IMAG("complex.image"), we can load the amplitude or phase or real part or imaginary part of the complex image, respectively.

Thanks for the suggestion of using LEL. I think it will help get the complex image support now with less code refactoring.

The current remaining issue is that the backend cannot generate file info and header to be displayed at the frontend. Once the file info is available, the frontend can have a new dropdown similar to what we do for a FITS image with multiple HDUs to include the four components as amplitude, phase, real, and imaginary. Then based on user selection at the frontend, the frontend makes a mock up LEL expression to load the selected component internally.

Do you think the proposed approach fits the requirements?

I think so. That provides complex image support, but we will need to reevaluate with some user testing.

This should be ready quickly, some changes add needed to get the FileInfo of complex images too.

@jolopezl jolopezl linked a pull request Apr 11, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
7 participants