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

Refactor Region code to RegionState and RegionConverter #1352

Merged
merged 34 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5459b63
Rename spatial profiles test, for cursor only
pford Dec 7, 2023
8f2add5
Rename region (line and point) spatial profile test
pford Dec 7, 2023
f9d47cf
Remove unused methods, update test CMakeLists
pford Dec 7, 2023
e3f5966
Add region histogram and stats tests
pford Dec 8, 2023
760e940
Tweak tests and rename test suite
pford Dec 8, 2023
9de1192
Add tests for Region in reference image
pford Dec 9, 2023
213fd7b
Add tests for matched regions and rotbox
pford Dec 9, 2023
6dee2a7
Convert test utils CmpValues and CmpVectors to template
pford Jan 2, 2024
c000246
Add region spectral profile test
pford Jan 2, 2024
4a1fb69
Remove float versions of test utils CmpValues and CmpVectors
pford Jan 2, 2024
abaf732
Fix formatting
pford Jan 2, 2024
e21ff82
Merge branch 'dev' into pam/1347_region_converter
pford Jan 2, 2024
8180a13
Fix includes after removing Message.h from Region.cc
pford Jan 8, 2024
bed62df
Use FileFinder for image path in tests
pford Jan 8, 2024
e7c0044
Move rotbox tests into region and matched region tests
pford Jan 8, 2024
8452b43
Refactor Region into RegionConverter and add tests
pford Jan 17, 2024
cb91489
Remove debug output
pford Jan 17, 2024
d49bed0
Add performance time for line spatial profile
pford Jan 17, 2024
bbf1700
Merge branch 'dev' into pam/1347_region_converter
pford Jan 18, 2024
58a3fa8
Remove tab from CMakeLists
pford Jan 18, 2024
f7a525a
Add spatial profile test for point outside image
pford Jan 19, 2024
5c7955f
Add region import/export test and bug fixes from refactoring
pford Jan 22, 2024
ea65135
Fix formatting
pford Jan 23, 2024
4b9e148
Merge branch 'dev' into pam/1347_region_converter
pford Jan 23, 2024
9462ebd
Add changelog entry
pford Jan 23, 2024
b4f9be4
Fix PvPreviewCut profile using nchan in preview image
pford Jan 31, 2024
6a25678
Fix ellipse record from control points for export
pford Jan 31, 2024
224f9e0
Fix point region spectral profile and add test
pford Feb 1, 2024
ef64598
Fix format
pford Feb 1, 2024
6a3b0f2
Merge branch 'dev' into pam/1347_region_converter
pford Feb 1, 2024
1476e9e
Update protobuf
pford Feb 1, 2024
5697d51
Use double for ellipse angle in record for accurate unit conversion
pford Mar 7, 2024
0b965b4
Merge branch 'dev' into pam/1347_region_converter
pford Mar 20, 2024
a62fda6
Merge branch 'dev' into pam/1347_region_converter
confluence Apr 9, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Improve the code style in HTTP server ([#1260](https://github.com/CARTAvis/carta-backend/issues/1260)).
* Remove program settings equality operators ([#1001](https://github.com/CARTAvis/carta-backend/issues/1001)).
* Normalize the style of guard names in header files ([#1023](https://github.com/CARTAvis/carta-backend/issues/1023)).
* Move Region code to RegionConverter for maintenance and performance ([#1347](https://github.com/CARTAvis/carta-backend/issues/1347)).

## [4.1.0]

Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ set(SOURCE_FILES
src/Region/Ds9ImportExport.cc
src/Region/LineBoxRegions.cc
src/Region/Region.cc
src/Region/RegionConverter.cc
src/Region/RegionHandler.cc
src/Region/RegionImportExport.cc
src/Session/CursorSettings.cc
Expand Down
1 change: 1 addition & 0 deletions src/ImageGenerators/PvPreviewCube.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <casacore/images/Images/RebinImage.h>

#include "DataStream/Smoothing.h"
#include "Logger/Logger.h"
#include "Timer/Timer.h"

#define LOAD_DATA_PROGRESS_INTERVAL 1000
Expand Down
4 changes: 2 additions & 2 deletions src/ImageGenerators/PvPreviewCube.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
#ifndef CARTA_SRC_IMAGEGENERATORS_PVPREVIEWCUBE_H_
#define CARTA_SRC_IMAGEGENERATORS_PVPREVIEWCUBE_H_

#include <casacore/images/Images/SubImage.h>

#include "ImageGenerators/ImageGenerator.h"
#include "Region/Region.h"
#include "Util/File.h"
#include "Util/Image.h"

#include <casacore/images/Images/SubImage.h>

namespace carta {

struct PreviewCubeParameters {
Expand Down
2 changes: 2 additions & 0 deletions src/ImageGenerators/PvPreviewCut.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#ifndef CARTA_SRC_IMAGEGENERATORS_PVPREVIEWCUT_H_
#define CARTA_SRC_IMAGEGENERATORS_PVPREVIEWCUT_H_

#include <carta-protobuf/pv_preview.pb.h>

#include "Region/Region.h"
#include "Util/File.h"

Expand Down
9 changes: 7 additions & 2 deletions src/Region/CrtfImportExport.cc
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ void CrtfImportExport::ProcessFileLines(std::vector<std::string>& lines) {
std::vector<std::string> parameters;
std::unordered_map<std::string, std::string> properties;
ParseRegionParameters(line, parameters, properties);

// Coordinate frame for world coordinates conversion
RegionState region_state;
CARTA::RegionStyle region_style;
Expand Down Expand Up @@ -499,7 +498,13 @@ void CrtfImportExport::ProcessFileLines(std::vector<std::string>& lines) {
if (region == "text") {
// Set text label for text region
if (parameters.size() == 4) { // text, x, y, "text"
region_style.mutable_annotation_style()->set_text_label0(parameters[3]);
std::string label(parameters[3]);
if (!label.empty() &&
((label.front() == '"' && label.back() == '"') || (label.front() == '\'' && label.back() == '\''))) {
label.pop_back();
label = label.substr(1);
}
region_style.mutable_annotation_style()->set_text_label0(label);
}
} else {
// Set text position for textbox region
Expand Down
1 change: 1 addition & 0 deletions src/Region/LineBoxRegions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <casacore/coordinates/Coordinates/DirectionCoordinate.h>

#include "Logger/Logger.h"
#include "Util/Message.h"

namespace carta {

Expand Down
Loading
Loading