Revision: 70126
http://sourceforge.net/p/brlcad/code/70126
Author: starseeker
Date: 2017-08-24 21:13:53 +0000 (Thu, 24 Aug 2017)
Log Message:
-----------
need to do some testing with pre-transform I/O... probably multiple errors in
here...
Modified Paths:
--------------
brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp
Modified: brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp
===================================================================
--- brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp 2017-08-24 19:36:23 UTC
(rev 70125)
+++ brlcad/trunk/src/libgcv/plugins/gdal/gdal.cpp 2017-08-24 21:13:53 UTC
(rev 70126)
@@ -306,20 +306,20 @@
(void)get_dataset_info(pjdata);
/* Read the data into something a DSP can process */
- unsigned int xsize = GDALGetRasterXSize(pjdata);
- unsigned int ysize = GDALGetRasterYSize(pjdata);
+ //GDALDatasetH indata = pjdata;
+ GDALDatasetH indata = state->hDataset;
+ unsigned int xsize = GDALGetRasterXSize(indata);
+ unsigned int ysize = GDALGetRasterYSize(indata);
unsigned short *uint16_array = (unsigned short *)bu_calloc(xsize*ysize,
sizeof(unsigned short), "unsigned short array");
- GDALRasterBandH band = GDALGetRasterBand(pjdata, 1);
+ GDALRasterBandH band = GDALGetRasterBand(indata, 1);
- /*
- int bmin, bmax;
- double adfMinMax[2];
- adfMinMax[0] = GDALGetRasterMinimum(band, &bmin);
- adfMinMax[1] = GDALGetRasterMaximum(band, &bmax);
- if (!(bmin && bmax)) GDALComputeRasterMinMax(band, TRUE, adfMinMax);
- bu_log("Min/Max: %f, %f\n", adfMinMax[0], adfMinMax[1]);
- */
+ int bmin, bmax;
+ double adfMinMax[2];
+ adfMinMax[0] = GDALGetRasterMinimum(band, &bmin);
+ adfMinMax[1] = GDALGetRasterMaximum(band, &bmax);
+ if (!(bmin && bmax)) GDALComputeRasterMinMax(band, TRUE, adfMinMax);
+ bu_log("Min/Max: %f, %f\n", adfMinMax[0], adfMinMax[1]);
/* If we're going to DSP we need the unsigned short read. */
uint16_t *scanline = (uint16_t
*)CPLMalloc(sizeof(uint16_t)*GDALGetRasterBandXSize(band));
@@ -328,7 +328,7 @@
for (int j = 0; j < GDALGetRasterBandXSize(band); ++j) {
/* This is the critical assignment point - if we get this
* indexing wrong, data will not look right in dsp */
- uint16_array[i*ysize+j] = scanline[j];
+ uint16_array[(ysize-i-1)*ysize+j] = scanline[j];
//bu_log("%d, %d: %d\n", i, j, scanline[j]);
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits