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

Mark/support loading swapped axes images #2011

Merged
merged 92 commits into from
Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
92 commits
Select commit Hold shift + click to select a range
c996833
Add new functions to plot a swapped image coordinate
markccchiang Sep 11, 2022
9fdf9e5
Minor code changes
markccchiang Sep 12, 2022
77a7f25
Minor code changes
markccchiang Sep 12, 2022
9006d94
Fix the problem of showing PV image coordinates for swapped axes cubes
markccchiang Sep 12, 2022
5fba39a
Modify the protobuf message AxesNumbers
markccchiang Sep 13, 2022
2d65566
Identify key words GLON or GLAT when parsing the coordinate name
markccchiang Sep 13, 2022
f64de46
Properly convert the spectral axis unit for swapped axes images
markccchiang Sep 14, 2022
05b2bab
Get the spectral axis number when setting its unit conversion
markccchiang Sep 22, 2022
7a87013
Add an AST utility function to render direction vs. spectral coordinates
markccchiang Sep 28, 2022
a81f8f1
Recalculate the wcsinfo for swapped cube image when its channel is ch…
markccchiang Sep 29, 2022
98554b2
Remove unused codes
markccchiang Sep 29, 2022
b5d758b
Consider the coordinate rendering for swapped x-y axes
markccchiang Sep 29, 2022
6e68dd6
Change axis indices from 0-based to 1-based in the axes_numbers message
markccchiang Oct 3, 2022
90983ee
Rename functions for the swapped-axes frame
markccchiang Oct 3, 2022
5f9fe5e
Correct the code style of new AST function in the wrapper
markccchiang Oct 3, 2022
afed02f
Modify the logic of identifying PV or Spectral vs. direction image fr…
markccchiang Oct 3, 2022
d162906
Remove unused functions
markccchiang Oct 3, 2022
4151b62
Rename a function
markccchiang Oct 3, 2022
d2022d0
Merge branch 'dev' of https://github.com/CARTAvis/carta-frontend into…
markccchiang Oct 3, 2022
3f82a73
Modify the changelog
markccchiang Oct 3, 2022
830c71b
Set the depth axis number is 3 in AST fitsChan
markccchiang Oct 3, 2022
b24b3e4
Minor code changes
markccchiang Oct 5, 2022
d76ba11
Solve a merge conflict in the changelog
markccchiang Nov 14, 2022
65c395e
Merge branch 'dev' of https://github.com/CARTAvis/carta-frontend into…
markccchiang Nov 17, 2022
8dba10a
Revert AST settings for the PV image
markccchiang Nov 18, 2022
6a3c72d
Add AST plot settings for the direction vs. spectral-axis image
markccchiang Nov 18, 2022
a614b0c
Fix the problem of Equinox setting, use the default system
markccchiang Nov 19, 2022
3c1547d
Fix the depth axis unit in animator slider for spectral vs. direction…
markccchiang Nov 19, 2022
4d43b9f
Merge branch 'dev' of https://github.com/CARTAvis/carta-frontend into…
markccchiang Nov 19, 2022
11be4c6
Modify the animation slider info for spectral vs. direction images
markccchiang Nov 20, 2022
685325b
Rename the AST function for making a swapped axes frame set
markccchiang Nov 21, 2022
6b0e3ba
Update the protobuf submodule
markccchiang Nov 21, 2022
01710cf
Solve a merge conflict in changelog
markccchiang Nov 21, 2022
ccba3e8
Set the precision of direction axis as auto for spectral vs. directio…
markccchiang Nov 22, 2022
3c54fca
Minor code changes for an AST function
markccchiang Nov 22, 2022
d1fdab0
Add WCS info in the animator slider for swapped images
markccchiang Nov 23, 2022
85bab30
Modify the animator slider info
markccchiang Nov 23, 2022
675b3bc
Set the unit of GLON or GLAT axes as degrees for swapped cube images
markccchiang Nov 23, 2022
05bff72
Remove the unit text from the direction axis label
markccchiang Nov 24, 2022
87070da
Modify the channel axis info in the animator slider for swapped images
markccchiang Nov 24, 2022
f6ff706
Show positive WCS value on the animator slider
markccchiang Nov 28, 2022
d2537d0
Merge branch 'dev' of https://github.com/CARTAvis/carta-frontend into…
markccchiang Nov 28, 2022
306ed9f
Slightly refactor the codes
markccchiang Nov 29, 2022
0ef2197
Update the protobuf with the new dev branch
markccchiang Dec 2, 2022
0696492
Merge branch 'dev' of https://github.com/CARTAvis/carta-frontend into…
markccchiang Dec 2, 2022
96656a0
Solve a merge conflict
markccchiang Dec 7, 2022
382b1c6
Swap the order of AST mapping for swapped image cubes
markccchiang Dec 9, 2022
55d9468
Rename the AST frame wcsInfoSpectralVsDirection as wcsInfo3DSwappedZ
markccchiang Dec 26, 2022
ed2a38f
Remove computed decorator from functions without observable variables
markccchiang Dec 26, 2022
4e69a61
Simplify the syntax of ternary operator
markccchiang Dec 26, 2022
5ac6960
Simplify the syntax of ternary operator
markccchiang Dec 26, 2022
40b624f
Simplify the syntax of ternary operator
markccchiang Dec 26, 2022
e71186e
Change to 0-based pixel coordinate for AST coordinate transformation
markccchiang Dec 26, 2022
07d54ae
Assign swapped axes variables once in the FrameStore constructor
markccchiang Dec 26, 2022
e8c1621
Merge branch 'dev' of https://github.com/CARTAvis/carta-frontend into…
markccchiang Dec 26, 2022
037dc69
Fix error messages from the astSet function
markccchiang Dec 26, 2022
2dc92de
Set a proper angular range for depth axis as RA/longitude or DEC/lati…
markccchiang Jan 4, 2023
0ca429c
Solve a merge conflict
markccchiang Jan 4, 2023
936d858
Combine the use of AST frame wcsInfo3D and wcsInfo3DSwappedZ and refa…
markccchiang Jan 5, 2023
553efba
Update the protobuf submodule with the new dev branch
markccchiang Jan 10, 2023
05a5ee8
Merge branch 'dev' of https://github.com/CARTAvis/carta-frontend into…
markccchiang Jan 10, 2023
bb6ddc6
Update the protobuf and modify the changelog and the index
markccchiang Jan 10, 2023
4c396dc
Merge branch 'dev' of https://github.com/CARTAvis/carta-frontend into…
markccchiang Jan 10, 2023
d964271
Fix the problem AST rendering for multiple images in a panel
markccchiang Jan 11, 2023
fa3ef3c
Fix the problem AST rendering for multiple images on a canvas
markccchiang Jan 12, 2023
3cd709c
Fix the problem AST rendering for multiple images on a canvas
markccchiang Jan 12, 2023
7515beb
Merge branch 'dev' of https://github.com/CARTAvis/carta-frontend into…
markccchiang Feb 2, 2023
fe989c6
Skip the stokes axis when rendering an image
markccchiang Feb 22, 2023
cee9267
Solve a merge conflict in changelog
markccchiang Feb 22, 2023
8e04187
Fix the animator slider label for swapped-axes cubes
markccchiang Feb 23, 2023
3c1656c
Set the maximum number of samples to be calculated for the swapped-ax…
markccchiang Feb 23, 2023
7820dd4
Revert "Set the maximum number of samples to be calculated for the sw…
markccchiang Feb 23, 2023
d923160
Correct the rendered pixel shape and unify the spectral axis unit as GHz
markccchiang Feb 26, 2023
e49334d
Correct the AST frame set for PV images
markccchiang Feb 26, 2023
328ba75
Modify the direction axis labels in the AST plot settings
markccchiang Feb 28, 2023
7a363e4
Merge branch 'dev' of https://github.com/CARTAvis/carta-frontend into…
markccchiang Mar 1, 2023
6c28207
Fix the labels for reversed PV images
markccchiang Mar 1, 2023
5de798a
Fix the cursor info for swapped cube images
markccchiang Mar 3, 2023
c39f293
Slightly refactor the code
markccchiang Mar 7, 2023
b266267
Show WCS values in the cursor info for swapped cubes
markccchiang Mar 7, 2023
499f945
Fix the code style of AST wrapper functions
markccchiang Mar 9, 2023
23b0c28
Minor code changes
markccchiang Mar 9, 2023
655f897
Slightly refactor the codes
markccchiang Mar 9, 2023
1499990
Remove duplicate declarations of variables
markccchiang Mar 10, 2023
9e9a61e
Rename a FrameStore function and change it as an arrow function
markccchiang Mar 10, 2023
8a5cd99
Update the protobuf messages for spatial axes
markccchiang Mar 14, 2023
6b7d026
merge dev
kswang1029 Mar 14, 2023
284034b
Fix the problem of regional coordinate info for 2D images
markccchiang Mar 14, 2023
d529715
Merge branch 'dev' of https://github.com/CARTAvis/carta-frontend into…
markccchiang Mar 16, 2023
7e6420d
Fix the problem of showing swapped-axes cube coordinate with the new …
markccchiang Mar 16, 2023
d6f3922
Solve a merge conflict in changelog
markccchiang Mar 17, 2023
dd4f4c3
update protobuf
YuHsuan-Hwang Mar 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Added a toggle button to let users decide whether or not to keep the previously generated moment images ([#2054](https://github.com/CARTAvis/carta-frontend/issues/2054)).
* Added settings in the image view settings widget for panning and zooming the images ([#1176](https://github.com/CARTAvis/carta-frontend/issues/1176)).
* Added layout renaming dialog ([#458](https://github.com/CARTAvis/carta-frontend/issues/458)).
* Added supports for swapped-axes image cubes ([#1953](https://github.com/CARTAvis/carta-frontend/issues/1953)).
### Fixed
* Fixed the issues of copying the Session URL in the macOS Electron and Linux AppImage versions ([#2102](https://github.com/CARTAvis/carta-frontend/issues/2102), [#2108](https://github.com/CARTAvis/carta-frontend/issues/2108)).
* Fixed the issue of contour levels not deleted as intended ([#2091](https://github.com/CARTAvis/carta-frontend/issues/2091)).
Expand Down
2 changes: 1 addition & 1 deletion protobuf
10 changes: 8 additions & 2 deletions src/components/Animator/AnimatorComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,13 @@ export class AnimatorComponent extends React.Component<WidgetProps> {
const channelTick = numChannels > 10 ? channelTickPre : Array.from(Array(numChannels).keys());
channelSlider = (
<div className="animator-slider">
<Radio value={AnimationMode.CHANNEL} disabled={appStore.animatorStore.animationActive} checked={appStore.animatorStore.animationMode === AnimationMode.CHANNEL} onChange={this.onAnimationModeChanged} label="Channel" />
<Radio
value={AnimationMode.CHANNEL}
disabled={appStore.animatorStore.animationActive}
checked={appStore.animatorStore.animationMode === AnimationMode.CHANNEL}
onChange={this.onAnimationModeChanged}
label={activeFrame.channelType}
/>
{hideSliders && <SafeNumericInput value={activeFrame.requiredChannel} min={-1} max={numChannels} stepSize={1} onValueChange={this.onChannelChanged} fill={true} disabled={appStore.animatorStore.animationActive} />}
{!hideSliders && (
<React.Fragment>
Expand All @@ -260,7 +266,7 @@ export class AnimatorComponent extends React.Component<WidgetProps> {
disabled={appStore.animatorStore.animationActive}
/>
<div className="slider-info">
<pre>{activeFrame.simpleSpectralInfo}</pre>
<pre>{activeFrame.depthAxisInfo}</pre>
</div>
</React.Fragment>
)}
Expand Down
30 changes: 22 additions & 8 deletions src/components/ImageView/Overlay/OverlayComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,18 +166,32 @@ export class OverlayComponent extends React.Component<OverlayComponentProps> {
const distanceMeasuringLineWidth = frame.distanceMeasuring.lineWidth;
const title = frame.titleCustomText;
const ratio = AppStore.Instance.imageRatio;
if (frame.isSwappedZ) {
const requiredChannel = frame.requiredChannel;
}
/* eslint-enable no-unused-vars, @typescript-eslint/no-unused-vars */

// Trigger switching AST overlay axis for PV image
const spectralAxisSetting =
`${frame.spectralType ? `System(${frame.spectral})=${frame.spectralType},` : ""}` +
`${frame.spectralUnit ? `Unit(${frame.spectral})=${frame.spectralUnit},` : ""}` +
`${frame.spectralSystem ? `StdOfRest=${frame.spectralSystem},` : ""}` +
`${frame.restFreqStore.restFreqInHz ? `RestFreq=${frame.restFreqStore.restFreqInHz} Hz,` : ""}` +
`${frame.spectralType && frame.spectralSystem ? `Label(${frame.spectral})=[${frame.spectralSystem}] ${SPECTRAL_TYPE_STRING.get(frame.spectralType)},` : ""}`;

const dirAxesSetting = `${frame.dirX > 2 || frame.dirXLabel === "" ? "" : `Label(${frame.dirX})=${frame.dirXLabel},`} ${frame.dirY > 2 || frame.dirYLabel === "" ? "" : `Label(${frame.dirY})=${frame.dirYLabel},`}`;

if (frame.isPVImage && frame.spectralAxis?.valid) {
AST.set(
frame.wcsInfo,
`${frame.spectralType ? `System(${frame.isReversedPVImage ? 1 : 2})=${frame.spectralType},` : ""}` +
`${frame.spectralUnit ? `Unit(${frame.isReversedPVImage ? 1 : 2})=${frame.spectralUnit},` : ""}` +
`${frame.spectralSystem ? `StdOfRest=${frame.spectralSystem},` : ""}` +
`${frame.restFreqStore.restFreqInHz ? `RestFreq=${frame.restFreqStore.restFreqInHz} Hz,` : ""}` +
`${frame.spectralType && frame.spectralSystem ? `Label(${frame.isReversedPVImage ? 1 : 2})=[${frame.spectralSystem}] ${SPECTRAL_TYPE_STRING.get(frame.spectralType)},` : ""}`
);
AST.set(frame.wcsInfo, spectralAxisSetting);
} else if (frame.isSwappedZ && frame.spectralAxis?.valid) {
AST.set(frame.wcsInfo, spectralAxisSetting + dirAxesSetting);
} else {
const formatStringX = this.props.overlaySettings.numbers.formatStringX;
const formatStyingY = this.props.overlaySettings.numbers.formatStringY;
const explicitSystem = this.props.overlaySettings.global.explicitSystem;
if (formatStringX !== undefined && formatStyingY !== undefined && explicitSystem !== undefined) {
AST.set(frame.wcsInfo, `Format(${frame.dirX})=${formatStringX}, Format(${frame.dirY})=${formatStyingY}, System=${explicitSystem},` + dirAxesSetting);
}
}

const className = classNames("overlay-canvas", {docked: this.props.docked});
Expand Down
16 changes: 10 additions & 6 deletions src/stores/CatalogOnlineQuery/CatalogOnlineQueryConfigStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -318,9 +318,11 @@ export class CatalogOnlineQueryConfigStore {
const wcsCopy = AST.copy(frame.wcsInfo);
let astString = new ASTSettingsString();
const sys = system ? system : overlay.global.explicitSystem ? overlay.global.explicitSystem : SystemType.ICRS;
AST.set(wcsCopy, `System=${sys}`);
astString.add("Format(1)", format);
astString.add("Format(2)", format);
if (frame.isXY || frame.isYX) {
AST.set(wcsCopy, `System=${sys}`);
astString.add(`Format(${frame.dirX})`, format);
astString.add(`Format(${frame.dirY})`, format);
}
const pointWCS = transformPoint(wcsCopy, pixelCoords);
const normVals = AST.normalizeCoordinates(wcsCopy, pointWCS.x, pointWCS.y);
p = AST.getFormattedCoordinates(wcsCopy, normVals.x, normVals.y, astString.toString(), true);
Expand All @@ -337,9 +339,11 @@ export class CatalogOnlineQueryConfigStore {
const precision = overlay.numbers.customPrecision ? overlay.numbers.precision : "*";
const format = `${NumberFormatType.Degrees}.${precision}`;
const wcsCopy = AST.copy(frame.wcsInfo);
AST.set(wcsCopy, `System=${SystemType.ICRS}`);
AST.set(wcsCopy, `Format(1)=${format}`);
AST.set(wcsCopy, `Format(2)=${format}`);
if (frame.isXY || frame.isYX) {
AST.set(wcsCopy, `System=${SystemType.ICRS}`);
AST.set(wcsCopy, `Format(${frame.dirX})=${format}`);
AST.set(wcsCopy, `Format(${frame.dirY})=${format}`);
}
p = getPixelValueFromWCS(wcsCopy, {x: coords.x.toString(), y: coords.y.toString()});
AST.deleteObject(wcsCopy);
}
Expand Down
2 changes: 1 addition & 1 deletion src/stores/FileBrowserStore/FileBrowserStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ export class FileBrowserStore {
/// Update the spectral range for save image file
@action initialSaveSpectralRange = () => {
const activeFrame = AppStore.Instance.activeFrame;
if (activeFrame && activeFrame.numChannels > 1) {
if (activeFrame && activeFrame.numChannels > 1 && activeFrame.isSpectralChannel) {
const min = Math.min(activeFrame.channelValueBounds.max, activeFrame.channelValueBounds.min);
const max = Math.max(activeFrame.channelValueBounds.max, activeFrame.channelValueBounds.min);
const delta = (max - min) / (activeFrame.numChannels - 1);
Expand Down
Loading