I am using tifflib library in my QT code. I have linked the library into my project file and am able to call up methods from the library. However, the tifflib library defines a typedef void* tdata_t
to promote portability. When I read a line from the tiff file it creates a buffer of tdata_t data. This corresponds to the actual pixel data that I want to retrieve from the image. The problem I am having is that I have been unable to cast this data as uint16 (the picture is a 16bit image).
Right now I am trying to hardcode a specific image file to get it to work

Qt Code:
  1. void Form1::loadImageFiles()
  2. {
  3. TIFF * tif = TIFFOpen("myimagefile", "r");
  4.  
  5. if(tif)
  6. {
  7. uint32 imagelength;
  8. tdata_t buf;
  9. uint32 row;
  10.  
  11. TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &imagelength);
  12. buf = _TIFFmalloc(TIFFScanlineSize(tif));
  13. row = 0;
  14. TIFFReadScanline(tif, buf, row);
  15. }
To copy to clipboard, switch view to plain text mode 

now here is where I have tried a couple of approaches.

1)I have tried casting as a QVariant and then converting to a Uint

2) created a pointer to the address of the buffer and then tried to casting to Uint, then I created a QVariant of the address and tried casting to uint16

3)Tried to create a QPTRList <tdata_t> that contained uint16

without success. I wanted to ask how you guys would handle this?

Thank you for your help,