[opengtl-commits] [269] move AbstractImage/BufferImage/Image in GTLCore

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 269
Author:   cyrille
Date:     2008-06-30 21:58:13 +0200 (Mon, 30 Jun 2008)

Log Message:
-----------
move AbstractImage/BufferImage/Image in GTLCore

Modified Paths:
--------------
    trunk/OpenGTL/OpenGTL/GTLCore/CMakeLists.txt
    trunk/OpenGTL/OpenShiva/OpenShiva/CMakeLists.txt
    trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.h
    trunk/OpenGTL/OpenShiva/OpenShiva/Wrapper_p.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/Wrapper_p.h
    trunk/OpenGTL/OpenShiva/OpenShiva/wrappers/ImageWrap_p.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/wrappers/ImageWrap_p.h
    trunk/OpenGTL/OpenShiva/tools/interpreter/Shiva.cpp

Added Paths:
-----------
    trunk/OpenGTL/OpenGTL/GTLCore/AbstractImage.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/AbstractImage.h
    trunk/OpenGTL/OpenGTL/GTLCore/BufferImage.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/BufferImage.h
    trunk/OpenGTL/OpenGTL/GTLCore/Image.cpp
    trunk/OpenGTL/OpenGTL/GTLCore/Image.h

Removed Paths:
-------------
    trunk/OpenGTL/OpenShiva/OpenShiva/AbstractImage.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/AbstractImage.h
    trunk/OpenGTL/OpenShiva/OpenShiva/BufferImage.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/BufferImage.h
    trunk/OpenGTL/OpenShiva/OpenShiva/Image.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/Image.h


Copied: trunk/OpenGTL/OpenGTL/GTLCore/AbstractImage.cpp (from rev 228, trunk/OpenGTL/OpenShiva/OpenShiva/AbstractImage.cpp)
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/AbstractImage.cpp	                        (rev 0)
+++ trunk/OpenGTL/OpenGTL/GTLCore/AbstractImage.cpp	2008-06-30 19:58:13 UTC (rev 269)
@@ -0,0 +1,55 @@
+/*
+ *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "AbstractImage.h"
+
+#include <GTLCore/PixelDescription.h>
+
+#include "Debug.h"
+
+using namespace GTLCore;
+
+struct AbstractImage::Private {
+  Private( const GTLCore::PixelDescription& _pixelDescription) : pixelDescription(_pixelDescription)
+  {
+  }
+  GTLCore::PixelDescription pixelDescription;
+  int pixelSize;
+};
+
+AbstractImage::AbstractImage( const GTLCore::PixelDescription& _pixelDescription ) : d(new Private(_pixelDescription))
+{
+  GTL_ASSERT(d->pixelDescription.bitsSize() % 8 == 0);
+  d->pixelSize = d->pixelDescription.bitsSize() / 8;
+}
+
+AbstractImage::~AbstractImage()
+{
+  delete d;
+}
+
+const GTLCore::PixelDescription& AbstractImage::pixelDescription() const
+{
+  return d->pixelDescription;
+}
+
+int AbstractImage::pixelSize() const
+{
+  return d->pixelSize;
+}

Copied: trunk/OpenGTL/OpenGTL/GTLCore/AbstractImage.h (from rev 231, trunk/OpenGTL/OpenShiva/OpenShiva/AbstractImage.h)
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/AbstractImage.h	                        (rev 0)
+++ trunk/OpenGTL/OpenGTL/GTLCore/AbstractImage.h	2008-06-30 19:58:13 UTC (rev 269)
@@ -0,0 +1,64 @@
+/*
+ *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GTLCORE_ABSTRACT_IMAGE_H_
+#define _GTLCORE_ABSTRACT_IMAGE_H_
+
+namespace GTLCore {
+  class PixelDescription;
+  /**
+   * Base class of Images. Reimplement the virtual functions to give access to
+   * your own image data.
+   * 
+   * Alternatively you can use \ref BufferImage (with any \ref GTLCore::Buffer ) or
+   * \ref Image .
+   * 
+   * @ingroup GTLCore
+   */
+  class AbstractImage {
+    public:
+      enum SamplingMode {
+        Nearest,
+        Linear
+      };
+    public:
+      AbstractImage( const GTLCore::PixelDescription& _pixelDescription );
+      virtual ~AbstractImage();
+    public:
+      /**
+       * @param _x
+       * @param _y
+       * @return a pointer to the pixel at coordinates (_x,_y)
+       * 
+       * If coordinates (_x,_y) are outside the image, it is still
+       * expected for the \ref AbstractImage to return a valid pointer
+       * to some default pixel value.
+       */
+      virtual char* data( int _x, int _y ) = 0;
+      const GTLCore::PixelDescription& pixelDescription() const;
+    protected:
+      int pixelSize() const;
+    private:
+      struct Private;
+      Private* const d;
+  };
+};
+
+
+#endif

Copied: trunk/OpenGTL/OpenGTL/GTLCore/BufferImage.cpp (from rev 267, trunk/OpenGTL/OpenShiva/OpenShiva/BufferImage.cpp)
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/BufferImage.cpp	                        (rev 0)
+++ trunk/OpenGTL/OpenGTL/GTLCore/BufferImage.cpp	2008-06-30 19:58:13 UTC (rev 269)
@@ -0,0 +1,84 @@
+/*
+ *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "BufferImage.h"
+
+#include <GTLCore/Buffer.h>
+
+#include "Debug.h"
+
+using namespace GTLCore;
+
+struct BufferImage::Private
+{
+  GTLCore::Buffer* buffer;
+  int lineWidth;
+  int width;
+  int height;
+  char* defaultPixel;
+};
+
+BufferImage::BufferImage( int _width, int _height, GTLCore::Buffer* _buffer, const GTLCore::PixelDescription& _pixelDescription ) : AbstractImage(_pixelDescription), d(new Private)
+{
+  d->buffer = _buffer;
+  d->lineWidth = _width * pixelSize();
+  d->width = _width;
+  d->height = _height;
+  d->defaultPixel = new char[ pixelSize() ];
+  memset( d->defaultPixel, 0, pixelSize() );
+  GTL_DEBUG( d->buffer->size() << " " << d->lineWidth << " " << _height);
+  GTL_ASSERT( d->buffer->size() == d->lineWidth * _height );
+}
+
+BufferImage::~BufferImage()
+{
+  delete[] d->defaultPixel;
+  delete d->buffer;
+  delete d;
+}
+
+char* BufferImage::data( int _x, int _y )
+{
+  if( _x >= 0 and _y >= 0 and _x < d->width and _y < d->height )
+  {
+    return d->buffer->rawData() + (_x * pixelSize() + _y * lineWidth());
+  } else {
+    return d->defaultPixel;
+  }
+}
+
+int BufferImage::lineWidth() const
+{
+  return d->lineWidth;
+}
+
+int BufferImage::width() const
+{
+  return d->width;
+}
+
+int BufferImage::height() const
+{
+  return d->height;
+}
+
+const GTLCore::Buffer* BufferImage::buffer() const
+{
+  return d->buffer;
+}

Copied: trunk/OpenGTL/OpenGTL/GTLCore/BufferImage.h (from rev 267, trunk/OpenGTL/OpenShiva/OpenShiva/BufferImage.h)
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/BufferImage.h	                        (rev 0)
+++ trunk/OpenGTL/OpenGTL/GTLCore/BufferImage.h	2008-06-30 19:58:13 UTC (rev 269)
@@ -0,0 +1,64 @@
+/*
+ *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GTLCORE_BUFFER_IMAGE_H_
+#define _GTLCORE_BUFFER_IMAGE_H_
+
+#include <GTLCore/AbstractImage.h>
+
+namespace GTLCore {
+  class Buffer;
+  /**
+   * This is an implementation of \ref AbstractImage which can be used with any \ref GTLCore::Buffer .
+   *
+   * @ingroup GTLCore
+   */
+  class BufferImage : public AbstractImage {
+    public:
+      /**
+       * @param _width width of the image
+       * @param _height height of the image
+       * @param _buffer the buffer giving access to the image data (\ref BufferImage takes
+       *                ownership of the \ref GTLCore::Buffer )
+       * @param _pixelDescription the description of the pixel stored in the buffer
+       * 
+       * It is expected that (_width * _height * _pixelDescription.bitsSize() / 8) == _buffer->size()
+       */
+      BufferImage( int _width, int _height, GTLCore::Buffer* _buffer, const GTLCore::PixelDescription& _pixelDescription );
+      ~BufferImage();
+    public:
+      virtual char* data( int _x, int _y );
+      /**
+       * @return the width of the image
+       */
+      int width() const;
+      /**
+       * @return the height of the image
+       */
+      int height() const;
+    protected:
+      int lineWidth() const;
+      const GTLCore::Buffer* buffer() const;
+    private:
+      struct Private;
+      Private* const d;
+  };
+}
+
+#endif

Modified: trunk/OpenGTL/OpenGTL/GTLCore/CMakeLists.txt
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/CMakeLists.txt	2008-06-30 19:52:47 UTC (rev 268)
+++ trunk/OpenGTL/OpenGTL/GTLCore/CMakeLists.txt	2008-06-30 19:58:13 UTC (rev 269)
@@ -6,7 +6,10 @@
 ## GTLCore library ##
 
 set(GTLCore_SRCS
+  AbstractImage.cpp
+  BufferImage.cpp
   Array.cpp
+  Image.cpp
   Buffer.cpp
   Debug.cpp
   ErrorMessage.cpp
@@ -65,5 +68,5 @@
 
 # installation
 install(TARGETS GTLCore  DESTINATION ${LIB_INSTALL_DIR} )
-install( FILES Parameter.h Function.h Array.h Buffer.h ErrorMessage.h PixelDescription.h Region.h RegionF.h ScopedName.h String.h Type.h Value.h Version.h Macros.h DESTINATION ${INCLUDE_INSTALL_DIR}/GTLCore )
+install( FILES Parameter.h Function.h Array.h Buffer.h ErrorMessage.h PixelDescription.h Region.h RegionF.h ScopedName.h String.h Type.h Value.h Version.h Macros.h AbstractImage.h BufferImage.h Image.h DESTINATION ${INCLUDE_INSTALL_DIR}/GTLCore )
 

Copied: trunk/OpenGTL/OpenGTL/GTLCore/Image.cpp (from rev 228, trunk/OpenGTL/OpenShiva/OpenShiva/Image.cpp)
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Image.cpp	                        (rev 0)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Image.cpp	2008-06-30 19:58:13 UTC (rev 269)
@@ -0,0 +1,37 @@
+/*
+ *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "Image.h"
+
+#include "GTLCore/Array.h"
+#include "GTLCore/PixelDescription.h"
+
+using namespace GTLCore;
+
+struct Image::Private {
+};
+
+Image::Image(int _width, int _height, const PixelDescription& _pixelDescription) : BufferImage(_width, _height, new Array(_height * _width * _pixelDescription.bitsSize() / 8), _pixelDescription ), d(new Private)
+{
+}
+
+Image::~Image()
+{
+  delete d;
+}

Copied: trunk/OpenGTL/OpenGTL/GTLCore/Image.h (from rev 231, trunk/OpenGTL/OpenShiva/OpenShiva/Image.h)
===================================================================
--- trunk/OpenGTL/OpenGTL/GTLCore/Image.h	                        (rev 0)
+++ trunk/OpenGTL/OpenGTL/GTLCore/Image.h	2008-06-30 19:58:13 UTC (rev 269)
@@ -0,0 +1,46 @@
+/*
+ *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation;
+ * version 2 of the License.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; see the file COPYING.  If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef _GTLCORE_IMAGE_H_
+#define _GTLCORE_IMAGE_H_
+
+#include <GTLCore/BufferImage.h>
+
+namespace GTLCore {
+  class PixelDescription;
+}
+
+namespace GTLCore {
+  /**
+   * \ref Image is a convenient class inheriting \ref BufferImage and using a \ref GTLCore::Array
+   * for the image data.
+   * @ingroup GTLCore
+   */
+  class Image : public BufferImage {
+    public:
+      Image(int _width, int _height, const PixelDescription& _pixelDescription);
+      ~Image();
+    private:
+      struct Private;
+      Private* const d;
+  };
+};
+
+
+#endif

Deleted: trunk/OpenGTL/OpenShiva/OpenShiva/AbstractImage.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/AbstractImage.cpp	2008-06-30 19:52:47 UTC (rev 268)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/AbstractImage.cpp	2008-06-30 19:58:13 UTC (rev 269)
@@ -1,55 +0,0 @@
-/*
- *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "AbstractImage.h"
-
-#include <GTLCore/PixelDescription.h>
-
-#include "Debug.h"
-
-using namespace OpenShiva;
-
-struct AbstractImage::Private {
-  Private( const GTLCore::PixelDescription& _pixelDescription) : pixelDescription(_pixelDescription)
-  {
-  }
-  GTLCore::PixelDescription pixelDescription;
-  int pixelSize;
-};
-
-AbstractImage::AbstractImage( const GTLCore::PixelDescription& _pixelDescription ) : d(new Private(_pixelDescription))
-{
-  SHIVA_ASSERT(d->pixelDescription.bitsSize() % 8 == 0);
-  d->pixelSize = d->pixelDescription.bitsSize() / 8;
-}
-
-AbstractImage::~AbstractImage()
-{
-  delete d;
-}
-
-const GTLCore::PixelDescription& AbstractImage::pixelDescription() const
-{
-  return d->pixelDescription;
-}
-
-int AbstractImage::pixelSize() const
-{
-  return d->pixelSize;
-}

Deleted: trunk/OpenGTL/OpenShiva/OpenShiva/AbstractImage.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/AbstractImage.h	2008-06-30 19:52:47 UTC (rev 268)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/AbstractImage.h	2008-06-30 19:58:13 UTC (rev 269)
@@ -1,67 +0,0 @@
-/*
- *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _OPENSHIVA_ABSTRACT_IMAGE_H_
-#define _OPENSHIVA_ABSTRACT_IMAGE_H_
-
-namespace GTLCore {
-  class PixelDescription;
-}
-
-namespace OpenShiva {
-  /**
-   * Base class of Images. Reimplement the virtual functions to give access to
-   * your own image data.
-   * 
-   * Alternatively you can use \ref BufferImage (with any \ref GTLCore::Buffer ) or
-   * \ref Image .
-   * 
-   * @ingroup OpenShiva
-   */
-  class AbstractImage {
-    public:
-      enum SamplingMode {
-        Nearest,
-        Linear
-      };
-    public:
-      AbstractImage( const GTLCore::PixelDescription& _pixelDescription );
-      virtual ~AbstractImage();
-    public:
-      /**
-       * @param _x
-       * @param _y
-       * @return a pointer to the pixel at coordinates (_x,_y)
-       * 
-       * If coordinates (_x,_y) are outside the image, it is still
-       * expected for the \ref AbstractImage to return a valid pointer
-       * to some default pixel value.
-       */
-      virtual char* data( int _x, int _y ) = 0;
-      const GTLCore::PixelDescription& pixelDescription() const;
-    protected:
-      int pixelSize() const;
-    private:
-      struct Private;
-      Private* const d;
-  };
-};
-
-
-#endif

Deleted: trunk/OpenGTL/OpenShiva/OpenShiva/BufferImage.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/BufferImage.cpp	2008-06-30 19:52:47 UTC (rev 268)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/BufferImage.cpp	2008-06-30 19:58:13 UTC (rev 269)
@@ -1,84 +0,0 @@
-/*
- *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "BufferImage.h"
-
-#include <GTLCore/Buffer.h>
-
-#include "Debug.h"
-
-using namespace OpenShiva;
-
-struct BufferImage::Private
-{
-  GTLCore::Buffer* buffer;
-  int lineWidth;
-  int width;
-  int height;
-  char* defaultPixel;
-};
-
-BufferImage::BufferImage( int _width, int _height, GTLCore::Buffer* _buffer, const GTLCore::PixelDescription& _pixelDescription ) : AbstractImage(_pixelDescription), d(new Private)
-{
-  d->buffer = _buffer;
-  d->lineWidth = _width * pixelSize();
-  d->width = _width;
-  d->height = _height;
-  d->defaultPixel = new char[ pixelSize() ];
-  memset( d->defaultPixel, 0, pixelSize() );
-  SHIVA_DEBUG( d->buffer->size() << " " << d->lineWidth << " " << _height);
-  SHIVA_ASSERT( d->buffer->size() == d->lineWidth * _height );
-}
-
-BufferImage::~BufferImage()
-{
-  delete[] d->defaultPixel;
-  delete d->buffer;
-  delete d;
-}
-
-char* BufferImage::data( int _x, int _y )
-{
-  if( _x >= 0 and _y >= 0 and _x < d->width and _y < d->height )
-  {
-    return d->buffer->rawData() + (_x * pixelSize() + _y * lineWidth());
-  } else {
-    return d->defaultPixel;
-  }
-}
-
-int BufferImage::lineWidth() const
-{
-  return d->lineWidth;
-}
-
-int BufferImage::width() const
-{
-  return d->width;
-}
-
-int BufferImage::height() const
-{
-  return d->height;
-}
-
-const GTLCore::Buffer* BufferImage::buffer() const
-{
-  return d->buffer;
-}

Deleted: trunk/OpenGTL/OpenShiva/OpenShiva/BufferImage.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/BufferImage.h	2008-06-30 19:52:47 UTC (rev 268)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/BufferImage.h	2008-06-30 19:58:13 UTC (rev 269)
@@ -1,67 +0,0 @@
-/*
- *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _OPENSHIVA_BUFFER_IMAGE_H_
-#define _OPENSHIVA_BUFFER_IMAGE_H_
-
-#include <OpenShiva/AbstractImage.h>
-
-namespace GTLCore {
-  class Buffer;
-}
-
-namespace OpenShiva {
-  /**
-   * This is an implementation of \ref AbstractImage which can be used with any \ref GTLCore::Buffer .
-   *
-   * @ingroup OpenShiva
-   */
-  class BufferImage : public AbstractImage {
-    public:
-      /**
-       * @param _width width of the image
-       * @param _height height of the image
-       * @param _buffer the buffer giving access to the image data (\ref BufferImage takes
-       *                ownership of the \ref GTLCore::Buffer )
-       * @param _pixelDescription the description of the pixel stored in the buffer
-       * 
-       * It is expected that (_width * _height * _pixelDescription.bitsSize() / 8) == _buffer->size()
-       */
-      BufferImage( int _width, int _height, GTLCore::Buffer* _buffer, const GTLCore::PixelDescription& _pixelDescription );
-      ~BufferImage();
-    public:
-      virtual char* data( int _x, int _y );
-      /**
-       * @return the width of the image
-       */
-      int width() const;
-      /**
-       * @return the height of the image
-       */
-      int height() const;
-    protected:
-      int lineWidth() const;
-      const GTLCore::Buffer* buffer() const;
-    private:
-      struct Private;
-      Private* const d;
-  };
-}
-
-#endif

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/CMakeLists.txt
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/CMakeLists.txt	2008-06-30 19:52:47 UTC (rev 268)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/CMakeLists.txt	2008-06-30 19:58:13 UTC (rev 269)
@@ -3,9 +3,6 @@
 
 # List of files 
 set(OpenShiva_SRCS
-  AbstractImage.cpp
-  BufferImage.cpp
-  Image.cpp
   Kernel.cpp
 # Internal files
   Compiler_p.cpp
@@ -45,7 +42,7 @@
 
 # Install target
 install(TARGETS OpenShiva  DESTINATION ${LIB_INSTALL_DIR} )
-install( FILES AbstractImage.h BufferImage.h Image.h Kernel.h Version.h DESTINATION ${INCLUDE_INSTALL_DIR}/OpenShiva )
+install( FILES Kernel.h Version.h DESTINATION ${INCLUDE_INSTALL_DIR}/OpenShiva )
 
 # Create and install pc file
 configure_file("OpenShiva.pc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/OpenShiva.pc" @ONLY)

Deleted: trunk/OpenGTL/OpenShiva/OpenShiva/Image.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Image.cpp	2008-06-30 19:52:47 UTC (rev 268)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Image.cpp	2008-06-30 19:58:13 UTC (rev 269)
@@ -1,37 +0,0 @@
-/*
- *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "Image.h"
-
-#include "GTLCore/Array.h"
-#include "GTLCore/PixelDescription.h"
-
-using namespace OpenShiva;
-
-struct Image::Private {
-};
-
-Image::Image(int _width, int _height, const GTLCore::PixelDescription& _pixelDescription) : BufferImage(_width, _height, new GTLCore::Array(_height * _width * _pixelDescription.bitsSize() / 8), _pixelDescription ), d(new Private)
-{
-}
-
-Image::~Image()
-{
-  delete d;
-}

Deleted: trunk/OpenGTL/OpenShiva/OpenShiva/Image.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Image.h	2008-06-30 19:52:47 UTC (rev 268)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Image.h	2008-06-30 19:58:13 UTC (rev 269)
@@ -1,46 +0,0 @@
-/*
- *  Copyright (c) 2008 Cyrille Berger <cberger@xxxxxxxxxxx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation;
- * version 2 of the License.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public License
- * along with this library; see the file COPYING.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#ifndef _OPENSHIVA_IMAGE_H_
-#define _OPENSHIVA_IMAGE_H_
-
-#include <OpenShiva/BufferImage.h>
-
-namespace GTLCore {
-  class PixelDescription;
-}
-
-namespace OpenShiva {
-  /**
-   * \ref Image is a convenient class inheriting \ref BufferImage and using a \ref GTLCore::Array
-   * for the image data.
-   * @ingroup OpenShiva
-   */
-  class Image : public BufferImage {
-    public:
-      Image(int _width, int _height, const GTLCore::PixelDescription& _pixelDescription);
-      ~Image();
-    private:
-      struct Private;
-      Private* const d;
-  };
-};
-
-
-#endif

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp	2008-06-30 19:52:47 UTC (rev 268)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.cpp	2008-06-30 19:58:13 UTC (rev 269)
@@ -148,7 +148,7 @@
   
 }
 
-void Kernel::evaluatePixeles( const GTLCore::Region& _region, const std::list< AbstractImage* >& _inputImages, AbstractImage* _outputImage) const
+void Kernel::evaluatePixeles( const GTLCore::Region& _region, const std::list< GTLCore::AbstractImage* >& _inputImages, GTLCore::AbstractImage* _outputImage) const
 {
   SHIVA_DEBUG( _region.x() << " " << _region.y() << " " << _region.width() << " " << _region.height());
   SHIVA_ASSERT( d->evaluatePixelesFunction );
@@ -157,7 +157,7 @@
   SHIVA_ASSERT( d->wrapper );
   const void** inputImages = new const void*[ _inputImages.size() ];
   int i = 0;
-  for( std::list< AbstractImage* >::const_iterator it = _inputImages.begin();
+  for( std::list< GTLCore::AbstractImage* >::const_iterator it = _inputImages.begin();
        it != _inputImages.end(); ++it)
   {
     inputImages[i] = (const void*)d->wrapper->wrapImage( *it );

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.h	2008-06-30 19:52:47 UTC (rev 268)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Kernel.h	2008-06-30 19:58:13 UTC (rev 269)
@@ -25,12 +25,12 @@
 namespace GTLCore {
   class ErrorMessage;
   class Region;
+  class AbstractImage;
 }
 
 #include <GTLCore/String.h>
 
 namespace OpenShiva {
-  class AbstractImage;
   /**
    * This is the main class in OpenShiva, it is used to compile the kernel, and to apply it on
    * a set of images.
@@ -77,7 +77,7 @@
        */
       GTLCore::String asmSourceCode() const;
     public: // Function call
-      void evaluatePixeles( const GTLCore::Region& _region, const std::list< AbstractImage* >& _inputImages, AbstractImage* _outputImage) const;
+      void evaluatePixeles( const GTLCore::Region& _region, const std::list< GTLCore::AbstractImage* >& _inputImages, GTLCore::AbstractImage* _outputImage) const;
       /**
        * Run the function called "int runTest()" in the Kernel.
        */

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Wrapper_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Wrapper_p.cpp	2008-06-30 19:52:47 UTC (rev 268)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Wrapper_p.cpp	2008-06-30 19:58:13 UTC (rev 269)
@@ -39,7 +39,7 @@
 #include "GTLCore/Value.h"
 #include "GTLCore/VirtualMachine_p.h"
 
-#include "AbstractImage.h"
+#include "GTLCore/AbstractImage.h"
 #include "CodeGenerator_p.h"
 #include "Debug.h"
 #include "PixelVisitor_p.h"
@@ -74,7 +74,7 @@
   delete d;
 }
 
-ImageWrap* Wrapper::wrapImage(AbstractImage* _abstractImage)
+ImageWrap* Wrapper::wrapImage(GTLCore::AbstractImage* _abstractImage)
 {
   ImageWrap* owrap = new ImageWrap;
   owrap->image = _abstractImage;

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/Wrapper_p.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/Wrapper_p.h	2008-06-30 19:52:47 UTC (rev 268)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/Wrapper_p.h	2008-06-30 19:58:13 UTC (rev 269)
@@ -34,10 +34,10 @@
   class ModuleData;
   class PixelDescription;
   class TypeManager;
+  class AbstractImage;
 }
 
 namespace OpenShiva {
-  class AbstractImage;
   class Kernel;
   /**
    * @internal
@@ -49,7 +49,7 @@
     public:
       Wrapper(Kernel* _kernel, GTLCore::ModuleData* _moduleData);
       ~Wrapper();
-      ImageWrap* wrapImage(AbstractImage* _abstractImage);
+      ImageWrap* wrapImage(GTLCore::AbstractImage* _abstractImage);
     private:
       struct Private;
       Private* const d;

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/wrappers/ImageWrap_p.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/wrappers/ImageWrap_p.cpp	2008-06-30 19:52:47 UTC (rev 268)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/wrappers/ImageWrap_p.cpp	2008-06-30 19:58:13 UTC (rev 269)
@@ -19,7 +19,7 @@
 
 #include "ImageWrap_p.h"
 
-#include "AbstractImage.h"
+#include "GTLCore/AbstractImage.h"
 
 #include "../Debug.h"
 

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/wrappers/ImageWrap_p.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/wrappers/ImageWrap_p.h	2008-06-30 19:52:47 UTC (rev 268)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/wrappers/ImageWrap_p.h	2008-06-30 19:58:13 UTC (rev 269)
@@ -20,7 +20,7 @@
 #ifndef _IMAGE_WRAP_P_H_
 #define _IMAGE_WRAP_P_H_
 
-namespace OpenShiva {
+namespace GTLCore {
   class AbstractImage;
 }
 
@@ -30,7 +30,7 @@
 // Wrapper::createImageType !                          //
 //---------------------- WARNING ----------------------//
 struct ImageWrap {
-  OpenShiva::AbstractImage* image;
+  GTLCore::AbstractImage* image;
   void* memToVec;
   void* vecToMem;
   enum ImageIndexes {

Modified: trunk/OpenGTL/OpenShiva/tools/interpreter/Shiva.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/tools/interpreter/Shiva.cpp	2008-06-30 19:52:47 UTC (rev 268)
+++ trunk/OpenGTL/OpenShiva/tools/interpreter/Shiva.cpp	2008-06-30 19:58:13 UTC (rev 269)
@@ -30,7 +30,7 @@
 
 // OpenShiva Headers
 #include <OpenShiva/Debug.h>
-#include <OpenShiva/Image.h>
+#include <GTLCore/Image.h>
 #include <OpenShiva/Kernel.h>
 #include <OpenShiva/Version.h>
 
@@ -119,10 +119,10 @@
       std::cout << "Error: " << std::endl << p.compilationErrorsMessage() << std::endl;
       return EXIT_FAILURE;
     }
-    OpenShiva::Image image(200,300, pixel );
+    GTLCore::Image image(200,300, pixel );
 //     memset( image.data(0, 0), 1, 200 * 300 );
-    std::list<OpenShiva::AbstractImage*> images;
-    images.push_back( new OpenShiva::Image(0,0, pixel ) );
+    std::list<GTLCore::AbstractImage*> images;
+    images.push_back( new GTLCore::Image(0,0, pixel ) );
     p.evaluatePixeles( GTLCore::Region(0,0, 200, 300), images, &image );
     std::cout << *((char*)image.data( 0, 0));
     if( showAssembly )


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/