Эх сурвалжийг харах

added ability to get image slices along z axis

Sven Sickert 9 жил өмнө
parent
commit
87a4bba6ab

+ 1 - 1
Makefile

@@ -1,4 +1,4 @@
-# --------------------------------
+## --------------------------------
 # - initialization in top makefile
 #
 # here all variables used later on will be defined and initialized. also the

+ 3 - 0
core/image/MultiChannelImage3DT.h

@@ -158,6 +158,9 @@ public:
 	/** return image for visualization */
   ImageT<P> getChannelT( int z, uint channel = 0 ) const;
 
+  /** return x-slice as image */
+  ImageT<P> getXSlice ( int x, uint channel = 0 ) const;
+
   /** return rgb image (reading channels 0, 1, 2) for visualization */
   ColorImage getColor(int z) const;
 

+ 14 - 0
core/image/MultiChannelImage3DT.tcc

@@ -483,6 +483,20 @@ ImageT<P> MultiChannelImage3DT<P>::getChannelT( int z, uint channel ) const
   return img;
 }
 
+template<class P>
+ImageT<P> MultiChannelImage3DT<P>::getXSlice ( int x, uint channel ) const
+{
+    assert( channel < numChannels );
+
+    NICE::ImageT<P> img(zsize, ysize);
+
+    for ( int y = 0; y < ysize; y++ )
+        for ( int z = 0; z < zsize; z++ )
+            img.setPixel( z, y, data[channel][z*xsize*ysize + y*xsize + x]);
+
+    return img;
+}
+
 /** convert to ice image */
 template<class P>
 void MultiChannelImage3DT<P>::convertToGrey( NICE::Image & img, int z, uint channel,  bool normalize ) const