asafm
Topic Author
Posts: 4
Joined: 10 Mar 2022, 09:43

displaying 16 bit grayscale images at runtime

18 Apr 2022, 09:33

Hi
how can i display 16 bit grayscale images that are chosen from a directory at run time in a Noesis application .
 
User avatar
jsantos
Site Admin
Posts: 3419
Joined: 20 Jan 2012, 17:18
Contact:

Re: displaying 16 bit grayscale images at runtime

18 Apr 2022, 13:00

Please let us know what SDK you are using,
 
asafm
Topic Author
Posts: 4
Joined: 10 Mar 2022, 09:43

Re: displaying 16 bit grayscale images at runtime

18 Apr 2022, 15:09

Hi

I am using the C++ SDK
 
asafm
Topic Author
Posts: 4
Joined: 10 Mar 2022, 09:43

Re: displaying 16 bit grayscale images at runtime

18 Apr 2022, 15:36

The images are read from files, processed with our image processing library and then need to be displayed (preferably in a Noesis Image container)
 
User avatar
jsantos
Site Admin
Posts: 3419
Joined: 20 Jan 2012, 17:18
Contact:

Re: displaying 16 bit grayscale images at runtime

20 Apr 2022, 17:28

The easiest way is using BitmapSource::Create
class BitmapSource: public ImageSource
{
public:
    enum Format
    {
        Format_BGRA8,
        Format_BGR8,
        Format_RGBA8,
        Format_RGB8
    };

    /// Creates a new BitmapSource from an array of pixels that are stored in memory
    static Ptr<BitmapSource> Create(int32_t pixelWidth, int32_t pixelHeight, float dpiX,
        float dpiY, const uint8_t* buffer, int32_t stride, Format format);
 
asafm
Topic Author
Posts: 4
Joined: 10 Mar 2022, 09:43

Re: displaying 16 bit grayscale images at runtime

24 Apr 2022, 10:19

thanks for the reply.

we have 10bit medical monitors. i am trying to display 16bit grayscale images without converting to rgb8 and as 10bit.
is there a way to display the image as a single channel grayscale 10bit?
 
User avatar
jsantos
Site Admin
Posts: 3419
Joined: 20 Jan 2012, 17:18
Contact:

Re: displaying 16 bit grayscale images at runtime

25 Apr 2022, 19:14

The alternative is creating the native texture yourself. For example, for D3D11 you need to create a ID3D11Texture2D and then wrap it into a Noesis::Texture using WrapTexture:
struct NS_RENDER_D3D11RENDERDEVICE_API D3D11Factory
{
    static Noesis::Ptr<Noesis::Texture> WrapTexture(ID3D11Texture2D* texture, uint32_t width,
        uint32_t height, uint32_t levels, bool isInverted, bool hasAlpha);
}
Then you can create a TextureSource that can be used as a normal ImageSource.

Not sure if this is worth the effort though.

Who is online

Users browsing this forum: Link and 1 guest