Manta Interactive Ray Tracer Development Mailing List

Text archives Help


[MANTA] r1290 - trunk/Image


Chronological Thread 
  • From: bigler@sci.utah.edu
  • To: manta@sci.utah.edu
  • Subject: [MANTA] r1290 - trunk/Image
  • Date: Fri, 16 Feb 2007 19:31:15 -0700 (MST)

Author: bigler
Date: Fri Feb 16 19:31:14 2007
New Revision: 1290

Modified:
   trunk/Image/NRRDFile.cc
Log:
Flip the image in Y.

Modified: trunk/Image/NRRDFile.cc
==============================================================================
--- trunk/Image/NRRDFile.cc     (original)
+++ trunk/Image/NRRDFile.cc     Fri Feb 16 19:31:14 2007
@@ -177,8 +177,17 @@
   }
   
   
/////////////////////////////////////////////////////////////////////////////
-  // Copy image data into the simple image.
-  memcpy( dest_ptr, new_nrrd->data, width*height*pixel_dimension*scalar_size 
);
+  // Copy image data into the simple image.  We need to invert the images.
+  char* nrrd_data = static_cast<char*>(new_nrrd->data);
+  size_t stripe_size = width*pixel_dimension*scalar_size;
+  // Move the pointer to the start of the last stripe
+  nrrd_data += (height-1)*stripe_size;
+  for(int i = 0; i < height; ++i) {
+    memcpy( dest_ptr, nrrd_data, stripe_size);
+    // Move the pointer down a stripe
+    nrrd_data -= stripe_size;
+    dest_ptr  += stripe_size;
+  }
   
        // Delete the data.
        nrrdNuke( new_nrrd );




  • [MANTA] r1290 - trunk/Image, bigler, 02/16/2007

Archive powered by MHonArc 2.6.16.

Top of page