-
+
{widgetStore.effectiveFrame?.hasStokes && (
widgetStore.setSelectedStokes(ev.currentTarget.value)} />
diff --git a/src/components/SpatialProfiler/SpatialProfilerSettingsPanelComponent/SpatialProfilerSettingsPanelComponent.scss b/src/components/SpatialProfiler/SpatialProfilerSettingsPanelComponent/SpatialProfilerSettingsPanelComponent.scss
index 64681558d0..d4cb25ef00 100644
--- a/src/components/SpatialProfiler/SpatialProfilerSettingsPanelComponent/SpatialProfilerSettingsPanelComponent.scss
+++ b/src/components/SpatialProfiler/SpatialProfilerSettingsPanelComponent/SpatialProfilerSettingsPanelComponent.scss
@@ -5,6 +5,9 @@
&:first-of-type {
margin-left: 0px;
}
+ .bp3-input {
+ width: 88px;
+ }
}
.bp3-form-group .bp3-label {
diff --git a/src/components/SpatialProfiler/SpatialProfilerSettingsPanelComponent/SpatialProfilerSettingsPanelComponent.tsx b/src/components/SpatialProfiler/SpatialProfilerSettingsPanelComponent/SpatialProfilerSettingsPanelComponent.tsx
index a34263a6bf..c96340edee 100644
--- a/src/components/SpatialProfiler/SpatialProfilerSettingsPanelComponent/SpatialProfilerSettingsPanelComponent.tsx
+++ b/src/components/SpatialProfiler/SpatialProfilerSettingsPanelComponent/SpatialProfilerSettingsPanelComponent.tsx
@@ -1,8 +1,8 @@
import * as React from "react";
import {computed, autorun} from "mobx";
import {observer} from "mobx-react";
-import {Tabs, Tab} from "@blueprintjs/core";
-import {LinePlotSettingsPanelComponentProps, LinePlotSettingsPanelComponent, SmoothingSettingsComponent} from "components/Shared";
+import {Tabs, Tab, FormGroup} from "@blueprintjs/core";
+import {LinePlotSettingsPanelComponentProps, LinePlotSettingsPanelComponent, SmoothingSettingsComponent, SafeNumericInput} from "components/Shared";
import {RegionId, SpatialProfileWidgetStore} from "stores/widgets";
import {WidgetProps, DefaultWidgetConfig, HelpType, WidgetsStore, AppStore} from "stores";
import {parseNumber} from "utilities";
@@ -13,7 +13,8 @@ const KEYCODE_ENTER = 13;
export enum SpatialProfilerSettingsTabs {
STYLING,
- SMOOTHING
+ SMOOTHING,
+ COMPUTATION
}
@observer
@@ -30,7 +31,7 @@ export class SpatialProfilerSettingsPanelComponent extends React.Component
} />
} />
+
+ this.widgetStore.setLineRegionSampleWidth(value)} />
+
+ }
+ />
);
diff --git a/src/stores/Frame/FrameStore.ts b/src/stores/Frame/FrameStore.ts
index 487ce93697..ed2ae06b2d 100644
--- a/src/stores/Frame/FrameStore.ts
+++ b/src/stores/Frame/FrameStore.ts
@@ -1589,6 +1589,10 @@ export class FrameStore {
switch (region.regionType) {
case CARTA.RegionType.POINT:
return `Point (wcs:${systemType}) [${center}]`;
+ case CARTA.RegionType.LINE:
+ const wcsStartPoint = getFormattedWCSPoint(this.wcsInfoForTransformation, region.controlPoints[0]);
+ const wcsEndPoint = getFormattedWCSPoint(this.wcsInfoForTransformation, region.controlPoints[1]);
+ return `Line (wcs:${systemType}) [[${wcsStartPoint.x}, ${wcsStartPoint.y}], [${wcsEndPoint.x}, ${wcsEndPoint.y}]]`;
case CARTA.RegionType.RECTANGLE:
return `rotbox(wcs:${systemType})[[${center}], [${size.x ?? ""}, ${size.y ?? ""}], ${toFixed(region.rotation, 6)}deg]`;
case CARTA.RegionType.ELLIPSE:
@@ -1601,6 +1605,14 @@ export class FrameStore {
polygonWcsProperties += index !== region.controlPoints.length - 1 ? ", " : "]";
});
return polygonWcsProperties;
+ case CARTA.RegionType.POLYLINE:
+ let polylineWcsProperties = `Polyline (wcs:${systemType})[`;
+ region.controlPoints.forEach((point, index) => {
+ const wcsPoint = isFinite(point.x) && isFinite(point.y) ? getFormattedWCSPoint(this.wcsInfoForTransformation, point) : null;
+ polylineWcsProperties += wcsPoint ? `[${wcsPoint.x}, ${wcsPoint.y}]` : "[Invalid]";
+ polylineWcsProperties += index !== region.controlPoints.length - 1 ? ", " : "]";
+ });
+ return polylineWcsProperties;
default:
return "Not Implemented";
}
diff --git a/src/stores/Frame/RegionStore.ts b/src/stores/Frame/RegionStore.ts
index 075e4f3d60..9f40e286dc 100644
--- a/src/stores/Frame/RegionStore.ts
+++ b/src/stores/Frame/RegionStore.ts
@@ -239,6 +239,13 @@ export class RegionStore {
switch (this.regionType) {
case CARTA.RegionType.POINT:
return `Point (pixel) [${center}]`;
+ case CARTA.RegionType.LINE:
+ let lineProperties = "Line (pixel) [";
+ this.controlPoints.forEach((point, index) => {
+ lineProperties += isFinite(point.x) && isFinite(point.y) ? `[${toFixed(point.x, 6)}pix, ${toFixed(point.y, 6)}pix]` : "[Invalid]";
+ lineProperties += index !== this.controlPoints.length - 1 ? ", " : "]";
+ });
+ return lineProperties;
case CARTA.RegionType.RECTANGLE:
return `rotbox[[${center}], [${toFixed(this.size.x, 6)}pix, ${toFixed(this.size.y, 6)}pix], ${toFixed(this.rotation, 6)}deg]`;
case CARTA.RegionType.ELLIPSE:
@@ -250,6 +257,13 @@ export class RegionStore {
polygonProperties += index !== this.controlPoints.length - 1 ? ", " : "]";
});
return polygonProperties;
+ case CARTA.RegionType.POLYLINE:
+ let polylineProperties = "Polyline (pixel) [";
+ this.controlPoints.forEach((point, index) => {
+ polylineProperties += isFinite(point.x) && isFinite(point.y) ? `[${toFixed(point.x, 6)}pix, ${toFixed(point.y, 6)}pix]` : "[Invalid]";
+ polylineProperties += index !== this.controlPoints.length - 1 ? ", " : "]";
+ });
+ return polylineProperties;
default:
return "Not Implemented";
}
diff --git a/src/stores/HelpStore.ts b/src/stores/HelpStore.ts
index c6739b27cb..e31966ff74 100644
--- a/src/stores/HelpStore.ts
+++ b/src/stores/HelpStore.ts
@@ -29,6 +29,7 @@ export enum HelpType {
SPATIAL_PROFILER = "Spatial Profiler",
SPATIAL_PROFILER_SETTINGS_STYLING = "Spatial Profiler Style Settings",
SPATIAL_PROFILER_SETTINGS_SMOOTHING = "Spatial Profiler Smoothing Settings",
+ SPATIAL_PROFILER_SETTINGS_COMPUTATION = "Spatial Profiler Computation Settings",
SPECTRAL_PROFILER = "Spectral Profiler",
SPECTRAL_PROFILER_SETTINGS_CONVERSION = "Spectral Profiler Conversion Settings",
SPECTRAL_PROFILER_SETTINGS_STYLING = "Spectral Profiler Style Settings",
diff --git a/src/stores/widgets/RegionWidgetStore.ts b/src/stores/widgets/RegionWidgetStore.ts
index 24b5dcf6bd..b58f013c9d 100644
--- a/src/stores/widgets/RegionWidgetStore.ts
+++ b/src/stores/widgets/RegionWidgetStore.ts
@@ -15,6 +15,7 @@ export enum RegionId {
export enum RegionsType {
CLOSED,
CLOSED_AND_POINT,
+ POINT_AND_LINES,
LINE
}
@@ -71,6 +72,7 @@ export class RegionWidgetStore {
case RegionsType.CLOSED:
return selectedRegion.isClosedRegion ? selectedRegion.regionId : this.defaultRegionId();
case RegionsType.CLOSED_AND_POINT:
+ case RegionsType.POINT_AND_LINES:
return selectedRegion.regionId;
case RegionsType.LINE:
default:
@@ -88,6 +90,7 @@ export class RegionWidgetStore {
case RegionsType.CLOSED:
return RegionId.IMAGE;
case RegionsType.CLOSED_AND_POINT:
+ case RegionsType.POINT_AND_LINES:
return RegionId.CURSOR;
case RegionsType.LINE:
default:
diff --git a/src/stores/widgets/SpatialProfileWidgetStore.ts b/src/stores/widgets/SpatialProfileWidgetStore.ts
index a20c2c33dc..d551436ef8 100644
--- a/src/stores/widgets/SpatialProfileWidgetStore.ts
+++ b/src/stores/widgets/SpatialProfileWidgetStore.ts
@@ -4,7 +4,7 @@ import * as _ from "lodash";
import {RegionWidgetStore, RegionId, RegionsType} from "./RegionWidgetStore";
import {CARTA} from "carta-protobuf";
import {AppStore, ProfileSmoothingStore} from "stores";
-import {FrameStore} from "stores/Frame";
+import {FrameStore, RegionStore} from "stores/Frame";
import {PlotType, LineSettings} from "components/Shared";
import {SpatialProfilerSettingsTabs} from "components";
import {clamp, isAutoColor} from "utilities";
@@ -33,6 +33,7 @@ export class SpatialProfileWidgetStore extends RegionWidgetStore {
@observable linePlotInitXYBoundaries: {minXVal: number; maxXVal: number; minYVal: number; maxYVal: number};
readonly smoothingStore: ProfileSmoothingStore;
@observable settingsTabId: SpatialProfilerSettingsTabs;
+ @observable lineRegionSampleWidth: number;
@override setRegionId = (fileId: number, regionId: number) => {
this.regionIdMap.set(fileId, regionId);
@@ -109,10 +110,15 @@ export class SpatialProfileWidgetStore extends RegionWidgetStore {
this.settingsTabId = val;
};
+ @action setLineRegionSampleWidth = (val: number) => {
+ this.lineRegionSampleWidth = val;
+ };
+
constructor(coordinate: string = "x") {
- super(RegionsType.CLOSED_AND_POINT);
+ super(RegionsType.POINT_AND_LINES);
makeObservable(this);
// Describes which data is being visualised
+ this.lineRegionSampleWidth = 3;
this.coordinate = coordinate;
this.selectedStokes = DEFAULT_STOKES;
@@ -162,7 +168,11 @@ export class SpatialProfileWidgetStore extends RegionWidgetStore {
if (frame?.hasStokes) {
stokes = this.selectedStokes === DEFAULT_STOKES ? frame.requiredPolarizationInfo : this.selectedStokes;
}
- return `${stokes?.replace("Stokes ", "") ?? ""}${this.coordinate}`;
+ return `${stokes?.replace("Stokes ", "") ?? ""}${this.isLineOrPolyline ? "" : this.coordinate}`;
+ }
+
+ @computed get isLineOrPolyline(): boolean {
+ return this.effectiveRegion?.regionType === CARTA.RegionType.LINE || this.effectiveRegion?.regionType === CARTA.RegionType.POLYLINE;
}
@computed get effectivePolarization(): POLARIZATIONS {
@@ -173,8 +183,8 @@ export class SpatialProfileWidgetStore extends RegionWidgetStore {
}
}
- private static GetSpatialConfig(frame: FrameStore, coordinate: string, isCursor: boolean): CARTA.SetSpatialRequirements.ISpatialConfig {
- if (frame.cursorMoving && !AppStore.Instance.cursorFrozen && isCursor) {
+ private static GetSpatialConfig(frame: FrameStore, coordinate: string, region: RegionStore, lineRegionSampleWidth: number): CARTA.SetSpatialRequirements.ISpatialConfig {
+ if (frame.cursorMoving && !AppStore.Instance.cursorFrozen && region?.regionId === RegionId.CURSOR) {
if (coordinate.includes("x")) {
return {
coordinate,
@@ -193,7 +203,8 @@ export class SpatialProfileWidgetStore extends RegionWidgetStore {
} else {
return {
coordinate,
- mip: 1
+ mip: 1,
+ width: region?.regionType === CARTA.RegionType.LINE || region?.regionType === CARTA.RegionType.POLYLINE ? lineRegionSampleWidth : undefined
};
}
}
@@ -231,7 +242,7 @@ export class SpatialProfileWidgetStore extends RegionWidgetStore {
if (existingConfig) {
// TODO: Merge existing configs, rather than only allowing a single one
} else {
- regionRequirements.spatialProfiles.push(SpatialProfileWidgetStore.GetSpatialConfig(frame, widgetStore.fullCoordinate, regionId === RegionId.CURSOR));
+ regionRequirements.spatialProfiles.push(SpatialProfileWidgetStore.GetSpatialConfig(frame, widgetStore.fullCoordinate, region, widgetStore.lineRegionSampleWidth));
}
}
});
diff --git a/src/utilities/Processed.ts b/src/utilities/Processed.ts
index e73ac82f0a..8000d69e4f 100644
--- a/src/utilities/Processed.ts
+++ b/src/utilities/Processed.ts
@@ -41,7 +41,8 @@ export class ProtobufProcessing {
start: profile.start,
end: profile.end,
mip: profile.mip,
- values: new Float32Array(profile.rawValuesFp32.slice().buffer)
+ values: new Float32Array(profile.rawValuesFp32.slice().buffer),
+ lineAxis: profile.lineAxis
};
}
@@ -50,7 +51,8 @@ export class ProtobufProcessing {
start: profile.start,
end: profile.end,
mip: profile.mip,
- values: null
+ values: null,
+ lineAxis: profile.lineAxis
};
}