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

Support for wider channel size in f3d::image #858

Merged
merged 24 commits into from
Jul 10, 2023
Prev Previous commit
Next Next commit
python
  • Loading branch information
Meakk committed Jul 10, 2023
commit 6e79864889d235dc36d25320f03ecf3d5e8b2f90
2 changes: 1 addition & 1 deletion library/public/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class F3D_EXPORT image
/**
* Get image channel type size in bytes.
*/
unsigned int getTypeSize() const;
unsigned int getChannelTypeSize() const;

///@{ @name Buffer Data
/**
Expand Down
2 changes: 1 addition & 1 deletion library/src/image.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ image::ChannelType image::getChannelType() const
}

//----------------------------------------------------------------------------
unsigned int image::getTypeSize() const
unsigned int image::getChannelTypeSize() const
{
return this->Internals->Image->GetScalarSize();
}
Expand Down
4 changes: 2 additions & 2 deletions library/testing/TestSDKImage.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int TestSDKImage(int argc, char* argv[])
return EXIT_FAILURE;
}

if (shortImg.getTypeSize() != 2)
if (shortImg.getChannelTypeSize() != 2)
{
std::cerr << "Cannot read a 16-bits image type size" << std::endl;
return EXIT_FAILURE;
Expand All @@ -79,7 +79,7 @@ int TestSDKImage(int argc, char* argv[])
return EXIT_FAILURE;
}

if (shortImg.getTypeSize() != 4)
if (shortImg.getChannelTypeSize() != 4)
{
std::cerr << "Cannot read a HDR 32-bits image type size" << std::endl;
return EXIT_FAILURE;
Expand Down
1 change: 1 addition & 0 deletions python/F3DPythonBindings.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ PYBIND11_MODULE(f3d, module)
.def("getHeight", &f3d::image::getHeight)
.def("getChannelCount", &f3d::image::getChannelCount)
.def("getChannelType", &f3d::image::getChannelType)
.def("getChannelTypeSize", &f3d::image::getChannelTypeSize)
.def("setData",
[](f3d::image& img, const py::bytes& data)
{
Expand Down
1 change: 1 addition & 0 deletions python/testing/TestPythonImageData.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
'''check channel type and save image'''

assert img.getChannelType() == f3d.image.ChannelType.BYTE
assert img.getChannelTypeSize() == 1

img.save(sys.argv[3] + "/Testing/Temporary/TestPythonSaveFile.bmp", f3d.image.SaveFormat.BMP)
assert os.path.isfile(sys.argv[3] + "/Testing/Temporary/TestPythonSaveFile.bmp")
Expand Down