Skip to content

Commit

Permalink
removed seldom-used render axes property, to avoid having to sync it …
Browse files Browse the repository at this point in the history
…with x and y
  • Loading branch information
confluence committed Nov 7, 2024
1 parent 53ae5dc commit 00749c5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
5 changes: 3 additions & 2 deletions src/FileList/FileExtInfoLoader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -210,11 +210,12 @@ bool FileExtInfoLoader::FillFileInfoFromImage(CARTA::FileInfoExtended& extended_

casacore::Vector<casacore::String> axes_names;

AddShapeEntries(extended_info, image_shape, axes.spatial, axes.spectral, axes.stokes, axes.render, axes.z, axes_names);
AddShapeEntries(
extended_info, image_shape, axes.spatial, axes.spectral, axes.stokes, {axes.x, axes.y}, axes.z, axes_names);

// Computed entries for rendered image axes, depth axis (may not be spectral), stokes axis
AddComputedEntries(
extended_info, image.get(), axes.render, axes.spectral, axes.stokes, use_image_for_entries, is_history_beam);
extended_info, image.get(), {axes.x, axes.y}, axes.spectral, axes.stokes, use_image_for_entries, is_history_beam);
info_ok = true;
}
} else { // image failed
Expand Down
19 changes: 10 additions & 9 deletions src/ImageData/FileLoader.cc
Original file line number Diff line number Diff line change
Expand Up @@ -224,17 +224,17 @@ bool FileLoader::FindCoordinateAxes(std::string& message) {
_axes.stokes = _coord_sys->polarizationAxisNumber();

// Set render axes are the first two axes that are not stokes
_axes.render.resize(0);
for (int i = 0; i < _num_dims && _axes.render.size() < 2; ++i) {
std::vector<int> render_axes;
for (int i = 0; i < _num_dims && render_axes.size() < 2; ++i) {
if (i != _axes.stokes) {
_axes.render.push_back(i);
render_axes.push_back(i);
}
}

_axes.x = _axes.render[0];
_axes.y = _axes.render[1];
_dims.width = _image_shape(_axes.render[0]);
_dims.height = _image_shape(_axes.render[1]);
_axes.x = render_axes[0];
_axes.y = render_axes[1];
_dims.width = _image_shape(_axes.x);
_dims.height = _image_shape(_axes.y);

// Find spatial axes
if (_coord_sys->hasDirectionCoordinate()) {
Expand Down Expand Up @@ -287,14 +287,15 @@ bool FileLoader::FindCoordinateAxes(std::string& message) {

// Z axis is non-render axis that is not stokes (if any)
for (size_t i = 0; i < _num_dims; ++i) {
if ((i != _axes.render[0]) && (i != _axes.render[1]) && (i != _axes.stokes)) {
if ((i != _axes.x) && (i != _axes.y) && (i != _axes.stokes)) {
_axes.z = i;
break;
}
}

// Save depth and num_stokes values
// Save depth, num_channels and num_stokes values
_dims.depth = (_axes.z >= 0 ? _image_shape(_axes.z) : 1);
_dims.num_channels = (_axes.spectral >= 0 ? _image_shape(_axes.spectral) : 1);
_dims.num_stokes = (_axes.stokes >= 0 ? _image_shape(_axes.stokes) : 1);

// save stokes types with respect to the stokes index
Expand Down
8 changes: 4 additions & 4 deletions src/Util/Image.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@ struct PointXy {

struct AxesInfo {
int x, y, z, spectral, stokes;
std::vector<int> render, spatial;
AxesInfo() : x(-1), y(-1), z(-1), spectral(-1), stokes(-1), render({-1, -1}), spatial({-1, -1}) {}
std::vector<int> spatial;
AxesInfo() : x(-1), y(-1), z(-1), spectral(-1), stokes(-1), spatial({-1, -1}) {}
};

struct DimsInfo {
size_t width, height, depth, num_stokes;
DimsInfo() : width(1), height(1), depth(1), num_stokes(1) {}
size_t width, height, depth, num_channels, num_stokes;
DimsInfo() : width(1), height(1), depth(1), num_channels(1), num_stokes(1) {}
};

#endif // CARTA_SRC_UTIL_IMAGE_H_

0 comments on commit 00749c5

Please sign in to comment.