Repository navigation
Add SPICE image rendering with full PC WCS support - #513
SalimHachemaoui wants to merge 13 commits into
Conversation
|
Hi @mudhoney , |
|
Thank you for following up and effort to fix the problem. I am able to generate the same problem in interactive frontend too also for the screenshots, You can follow this link https://necdet.helioviewer.org/load/d7c388a9aa8efc0812142f2bf7418cf3396501c8ddcb97d663c69f31595ea4e5 to see the problem. |
|
Hi @mudhoney , |
|
Thank you Salim,
Our environment often requires changes made to the back end and front end simultaneously. It is a pain point, honestly.
We appreciate these PRs, it will be great to have this data supported in the web client.
…On August 18, 2026 11:38:59 AM EDT, salim HACHEMAOUI ***@***.***> wrote:
SalimHachemaoui left a comment (Helioviewer-Project/api#513)
Hi @mudhoney ,
Thank you for the link. I understand now that the issue is reproducible in both the interactive frontend and the server-generated screenshots on your deployment.
My local interactive test was using a locally modified version of the frontend and @helioviewer/sun, which explains why SPICE appeared correctly there. Those frontend changes are not included in the current API PR.
I am now checking both rendering paths separately:
the client-side WCS transformation used by the interactive frontend;
the server-side composite renderer used for screenshots and movies.
I will avoid pushing the current experimental screenshot fix until both paths use the same SPICE WCS conventions and produce consistent results. Thank you for providing the reproducible state.
<img width="1916" height="972" alt="image" src="https://github.com/user-attachments/assets/cd996903-6af9-44ae-afe6-da1355fad70d" />
--
Reply to this email directly or view it on GitHub:
#513 (comment)
You are receiving this because you are subscribed to this thread.
Message ID: ***@***.***>
|
|
@SalimHachemaoui is this still a work in progress? |
Hello @dgarciabriseno Yes, this is still a work in progress. |
|
Update: I pushed commit 616fac1 to this PR. Screenshots and movie frames now apply the full native SPICE WCS geometry, including separate X/Y scales, the PC/CD matrix, reference pixel offsets, the raster Y axis, and 1 AU normalization. This corrects the stretched SPICE strip in generated images. SPICE also uses additive blending over visible background layers.
|
|
@SalimHachemaoui this is looking good from your screenshot. I will pull and check it out. @mudhoney just refactored how movies are made to massively improve the speed that movies are created, I'm worried those changes may conflict with your changes. @mudhoney can you also check on that part of this PR? |
|
@SalimHachemaoui do you also have a pull request for https://github.com/Helioviewer-Project/helioviewer.org that goes with this? |
|
|
Thank you Salim, I'll check these out tomorrow. |
|
I am getting this error when trying to make a movie. It needs to be added to the grayscale list in FastMovie.php and the WCS logic also needs to be migrated. src/Movie/FastMovie.php:1016-1019 — add SPICE alongside HMI/MDI/GONG for "no color table" |
|
@dgarciabriseno @SalimHachemaoui |
Port of the SPICE screenshot rendering to the movie engine: layerRecipe() gets a SPICE case, and decodeWcsLayer() places the raster with the same CD-matrix affine as Image_ImageType_SPICEImage, added onto the layers below. Movie frames now match screenshots of the same request.
The composite constructors require an EventContext since the events work on main, so the fixture's null made every test error after the rebase.
616fac1 to
50c6a32
Compare
|
Hi @dgarciabriseno @SalimHachemaoui ^ this should make your branch sync with the code in PR , if you have local edits/commits do |
| require_once HV_ROOT_DIR.'/../src/Image/JPEG2000/JP2ImageXMLBox.php'; | ||
| $header = new Image_JPEG2000_JP2ImageXMLBox($jp2->getFilePath()); | ||
| $cd = $header->getCDMatrix(); | ||
| $sun = $header->getRefPixelCoords(); // CRPIX - inverse(CD) * CRVAL | ||
|
|
||
| // Use the same 1 AU normalization as the tile metadata. The stored | ||
| // scalar scale is |CDELT1| * DSUN/AU, not a second WCS transform. | ||
| $factor = $jp2->getScale() / $header->getImagePlateScale() / $roi->imageScale(); | ||
| $a = $cd[0][0] * $factor; | ||
| $b = -$cd[1][0] * $factor; | ||
| $c = -$cd[0][1] * $factor; | ||
| $d = $cd[1][1] * $factor; | ||
| $shift = $options['wcsViewportOffset'] ?? array(0, 0); | ||
|
|
||
| // The canonical tile grid uses refPixelX and height-refPixelY. | ||
| // Conjugating CD by the Y flip converts FITS Y-up to raster Y-down. | ||
| // Keep this origin convention identical to the interactive tile grid; | ||
| // neither CROTA nor another rotation is applied after this affine. | ||
| $tx = -$a * $sun[0] - $c * ($jp2->getHeight() - $sun[1]) | ||
| - $roi->left() / $roi->imageScale() - $shift[0]; | ||
| $ty = -$b * $sun[0] - $d * ($jp2->getHeight() - $sun[1]) | ||
| - $roi->top() / $roi->imageScale() - $shift[1]; |
There was a problem hiding this comment.
We really need this logic applied generally. Solar Orbiter EUI images currently have rotation that is not handled correctly in the 2D viewport, as well as some other sources that we don't display on the web client due to the same alignment issues.
There was a problem hiding this comment.
@SalimHachemaoui I will work on generalizing this to other sources.
This logic is used when the code sees that the PC/CD matrix exists in the header
|
We need to use DATE_AVG for SPICE images, not the date from the file name, or the DATE field in the metadata. |
|
We should also compare SDO with Solar Orbiter at a time that SOLO is near the sun/earth pov. |
Thanks, @dgarciabriseno ! I pushed |
This makes the images appear closer to the previous image generation flow, but overally the error is not very noticeable



No description provided.