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

Thchang/2366 support image coordinates #2388

Merged
merged 40 commits into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
1978fe5
support image coordinates for images with valid WCS headers
TienHao Jun 6, 2024
06d6811
merge dev branch
TienHao Jun 24, 2024
6fe30a5
set labels of pixel frames
TienHao Jun 24, 2024
c576934
disable wcs inputs when the system coordinates is IMG
TienHao Jun 24, 2024
f761d4d
minor change for AST plot speed
TienHao Jul 4, 2024
4d0bf19
fix regression of missing AST grid for no wcs info frame after swithi…
TienHao Jul 4, 2024
e46779d
fix warning of searching radius in degree for pixel coordinate frames
TienHao Jul 4, 2024
1e1ef6f
fix spatial matching for the FrameSet's current frame
TienHao Jul 5, 2024
6a414ad
solve conflicts and merge dev branch
TienHao Jul 10, 2024
c2b410b
fixed relative coordinates for pixel coordinates
TienHao Aug 1, 2024
0e21d63
fixed image coordinates for non-squre pixels images
TienHao Aug 7, 2024
0284e6d
merge dev branch
TienHao Aug 15, 2024
7ca5837
uppercased image system type and minorly refactored
TienHao Aug 21, 2024
4c781db
fixed CatalogOnlineQueryComponent and genRegionWcsProperties
TienHao Aug 21, 2024
b5d1e2d
merge dev branch
TienHao Aug 21, 2024
9476953
fixed the bug of non-wcs images with wcs system in overlay
TienHao Sep 18, 2024
aec3be7
fixed the error of switching system when relative system is activated
TienHao Sep 19, 2024
aecc3bf
changed back switching active frame behaviour
TienHao Sep 19, 2024
2c04589
merge dev branch
TienHao Sep 26, 2024
9835dda
fixed special non-square pixels images
TienHao Sep 26, 2024
a784cc8
added back the frame in Dummy FrameSet
TienHao Nov 6, 2024
2fd7f9b
merge dev branch
TienHao Nov 6, 2024
13365bb
store relative pixel AST Frame in the third frame of wcsInfoShifted A…
TienHao Nov 15, 2024
451e680
fix the plotting of relative image coordinates for secondary images i…
TienHao Nov 21, 2024
017d000
minor fix
TienHao Nov 21, 2024
17afb2f
fix the catalog online query button
TienHao Nov 26, 2024
e9c4455
changelog updated
TienHao Nov 26, 2024
b6892db
modified labels of image coordinates with and without offsets
TienHao Nov 28, 2024
7853cee
fixed spatial matching on append when the image coordinates are selected
TienHao Dec 5, 2024
3454aee
disabled spatial matching in image coordinates if images cannot be ma…
TienHao Dec 6, 2024
cc166ea
merge dev branch
TienHao Dec 10, 2024
b5bda44
added back fix of spatial matching on append
TienHao Dec 12, 2024
d1582f3
disabling spatial matching when switching system between world and im…
TienHao Dec 12, 2024
91e2807
removed the spatial matching restriction of wcs images cannot be matc…
TienHao Dec 12, 2024
554b08c
merge dev branch
TienHao Dec 12, 2024
6032392
modified alert context
TienHao Dec 12, 2024
bacb635
fixed catalog plotting in pixel coordinates
TienHao Dec 17, 2024
e84c014
minor change
TienHao Dec 17, 2024
32d4d18
minor adjustments
TienHao Dec 18, 2024
7bf309e
removed logs
TienHao Dec 18, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,7 @@ export class CatalogQueryComponent extends React.Component {
</FormGroup>
<FormGroup inline={false} label="Center coordinates" disabled={disable}>
<Select
items={Object.keys(SystemType)
.map(key => SystemType[key])
.filter(sys => sys !== SystemType.Image)}
items={Object.values(SystemType).filter(sys => sys !== SystemType.Image)}
activeItem={null}
onItemSelect={type => appStore.overlayStore.global.setSystem(type)}
itemRenderer={this.renderSysTypePopOver}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import moment from "moment/moment";

import {DraggableDialogComponent} from "components/Dialogs";
import {WorkspaceListItem} from "models";
import {AppStore, DialogId, HelpType} from "stores";
import {AlertStore, AppStore, DialogId, HelpType} from "stores";

import {AppToaster, ErrorToast, SuccessToast} from "../../Shared";

Expand Down Expand Up @@ -67,6 +67,12 @@ export const WorkspaceDialogComponent = observer(() => {
return;
}

// TODO: to be removed after storing SystemType in workspace
if (appStore.overlayStore.isImgCoordinates && appStore.frames.map(frame => frame.spatialReference !== null).includes(true)) {
AlertStore.Instance.showAlert("Not supporting save workspace with spatial matching in image cooordinates");
YuHsuan-Hwang marked this conversation as resolved.
Show resolved Hide resolved
return;
}

setIsFetching(true);
try {
const res = await appStore.saveWorkspace(name);
Expand Down
3 changes: 3 additions & 0 deletions src/stores/AppStore/AppStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,9 @@ export class AppStore {
this.setSpectralMatchingEnabled(newFrame, true);
}
if (this.preferenceStore.autoWCSMatching & WCSMatchingType.SPATIAL && this.spatialReference !== newFrame) {
if (this.overlayStore.isImgCoordinates) {
AST.setI(newFrame.wcsInfo, "Current", 1);
YuHsuan-Hwang marked this conversation as resolved.
Show resolved Hide resolved
}
this.setSpatialMatchingEnabled(newFrame, true);
}
if (this.preferenceStore.autoWCSMatching & WCSMatchingType.RASTER && this.rasterScalingReference !== newFrame) {
Expand Down
3 changes: 3 additions & 0 deletions src/stores/Catalog/CatalogStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ export class CatalogStore {
let yFraction = CatalogStore.GetFractionFromUnit(yUnit.toLocaleLowerCase());

let wcsCopy = AST.copy(wcsInfo);
if (wcsCopy !== 0 && AppStore.Instance.overlayStore.isImgCoordinates) {
AST.setI(wcsCopy, "Current", 2);
}
let system = "System=" + catalogFrame;
AST.set(wcsCopy, system);
if (catalogFrame === CatalogSystemType.FK4) {
Expand Down
15 changes: 12 additions & 3 deletions src/stores/OverlayStore/OverlayStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as AST from "ast_wrapper";
import {action, autorun, computed, makeObservable, observable} from "mobx";

import {WCSType} from "models";
import {AppStore, PreferenceStore} from "stores";
import {AlertStore, AppStore, PreferenceStore} from "stores";
import {FrameStore, OverlayBeamStore, WCS_PRECISION} from "stores/Frame";
import {clamp, getColorForTheme, toFixed} from "utilities";

Expand Down Expand Up @@ -153,8 +153,17 @@ export class OverlayGlobalSettings {
this.labelType = labelType;
}

@action setSystem(system: SystemType) {
this.system = system;
@action async setSystem(system: SystemType) {
const frames = AppStore.Instance.frames;
if ((this.system === SystemType.Image) !== (system === SystemType.Image) && frames.map(f => f.spatialReference !== null).includes(true)) {
const confirm = await AlertStore.Instance.showInteractiveAlert("Switching system between world and image coordinates will disable spatial matching.");
if (confirm) {
frames.forEach(f => f.clearSpatialReference());
this.system = system;
}
} else {
this.system = system;
}
}

@action setDefaultSystem(system: SystemType) {
Expand Down
8 changes: 4 additions & 4 deletions wasm_src/ast_wrapper/ast_wrapper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ EMSCRIPTEN_KEEPALIVE AstFrameSet* getFrameFromFitsChan(AstFitsChan* fitschan, bo
}

AstFrame* pixFrame = static_cast<AstFrame*> astGetFrame(frameSet, 1);
astSet(pixFrame, "Label(1)=X Coordinate,Label(2)=Y Coordinate");
astSet(pixFrame, "Label(1)=X coordinate (pixel),Label(2)=Y coordinate (pixel)");

// work around for missing CTYPE1 & CTYPE2
if (checkSkyDomain) {
Expand Down Expand Up @@ -107,7 +107,7 @@ EMSCRIPTEN_KEEPALIVE AstFrameSet* getSkyFrameSet(AstFrameSet* frameSet)
}

// Create 2D base frame
AstFrame *baseframe = astFrame(2, "Title=Pixel Coordinates,Domain=GRID,Label(1)=X Coordinate,Label(2)=Y Coordinate");
AstFrame *baseframe = astFrame(2, "Title=Pixel Coordinates,Domain=GRID,Label(1)=X coordinate (pixel),Label(2)=Y coordinate (pixel)");
if (!baseframe)
{
cout << "Create 2D base frame failed." << endl;
Expand Down Expand Up @@ -222,7 +222,7 @@ EMSCRIPTEN_KEEPALIVE AstFrameSet* createShiftmapFrameset(AstFrameSet* wcsinfo, d
// 2D pixel shifts
double pixelOffset[] = {-pixelOffsetX, -pixelOffsetY};
AstShiftMap* pixelShiftMap = astShiftMap(2, pixelOffset, "");
astAddFrame(wcsinfoShifted, AST__BASE, pixelShiftMap, astFrame(2, "Label(1)=X Coordinate,Label(2)=Y Coordinate,Domain=GRID"));
astAddFrame(wcsinfoShifted, AST__BASE, pixelShiftMap, astFrame(2, "Label(1)=X offset coordinate (pixel),Label(2)=Y offset coordinate (pixel),Domain=GRID"));

return wcsinfoShifted;
}
Expand All @@ -231,7 +231,7 @@ EMSCRIPTEN_KEEPALIVE AstFrameSet* initDummyFrame()
{
double offsets[] = {0, 0};
AstFrameSet* frameSet = astFrameSet(astFrame(2, ""), "");
astAddFrame(frameSet, 1, astShiftMap(2, offsets, ""), astFrame(2, "Label(1)=X Coordinate,Label(2)=Y Coordinate,Domain=PIXEL"));
astAddFrame(frameSet, 1, astShiftMap(2, offsets, ""), astFrame(2, "Label(1)=X coordinate (pixel),Label(2)=Y coordinate (pixel),Domain=PIXEL"));
return frameSet;
}

Expand Down
Loading