[Gdcm-hackers] gdcm-git:Grassroots DICOM branch master updated. 53d9b1410f1da1926833c167e9ae07aa56b
Cross-platform DICOM implementation
Brought to you by:
malat
|
From: Mathieu M. <ma...@us...> - 2017-01-31 16:02:10
|
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Grassroots DICOM".
The branch, master has been updated
via 53d9b1410f1da1926833c167e9ae07aa56b25950 (commit)
via 654dc4ce421b8e9e6a41acb7750a461a215b3927 (commit)
via c43f95fbad7009c9408ac2f02b398dc12c886241 (commit)
from 71e9cf9ae2c7e1027c698cbff841535d5edf47ed (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://sourceforge.net/p/gdcm/gdcm/ci/53d9b1410f1da1926833c167e9ae07aa56b25950/
commit 53d9b1410f1da1926833c167e9ae07aa56b25950
Author: Mathieu Malaterre <mat...@gm...>
Date: Tue Jan 31 17:01:40 2017 +0100
Remove old RLE implementation
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2fa8708..08fbadd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -518,7 +518,6 @@ if(GDCM_STANDALONE)
option(GDCM_WRAP_CSHARP "build csharp wrapping" OFF)
mark_as_advanced(GDCM_WRAP_PHP)
mark_as_advanced(GDCM_WRAP_PERL)
- mark_as_advanced(GDCM_USE_RLE)
mark_as_advanced(GDCM_USE_ACTIVIZ)
option(GDCM_USE_JPEGLS "Build GDCM with JPEG-LS support" ON)
mark_as_advanced(GDCM_USE_JPEGLS)
diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt
index f779aec..ab685cb 100644
--- a/Utilities/CMakeLists.txt
+++ b/Utilities/CMakeLists.txt
@@ -99,10 +99,6 @@ if(GDCM_USE_PVRG)
endif()
endif()
-if(GDCM_USE_RLE)
- subdirs(rle)
-endif()
-
# Do C99
APPEND_COPYRIGHT(${CMAKE_CURRENT_SOURCE_DIR}/C99/COPYING)
diff --git a/Utilities/rle/CMakeLists.txt b/Utilities/rle/CMakeLists.txt
deleted file mode 100644
index be28eba..0000000
--- a/Utilities/rle/CMakeLists.txt
+++ /dev/null
@@ -1,16 +0,0 @@
-project(RLE)
-
-add_library(rle rle.c rlelib.c)
-#set_target_properties(rle PROPERTIES ${GDCM_LIBRARY_PROPERTIES})
-
-add_executable(example example.c)
-target_link_libraries(example rle)
-install(TARGETS rle example
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib/static
- ${CPACK_NAMELINK_TYPE}
- )
-
-add_executable(rledump rledump.c)
-target_link_libraries(rledump rle)
diff --git a/Utilities/rle/example.c b/Utilities/rle/example.c
deleted file mode 100644
index 90d2ff5..0000000
--- a/Utilities/rle/example.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/*=========================================================================
-
- Program: GDCM (Grassroots DICOM). A DICOM library
-
- Copyright (c) 2006-2011 Mathieu Malaterre
- All rights reserved.
- See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-#include <stdio.h>
-#include <stdlib.h> // abort
-
-#include "rlelib.h"
-
-void std_print_header(rle_compressed_frame * frame)
-{
- rle_header *header = frame->header;
- unsigned long ns = header->num_segments;
- printf("%lu\n", ns);
-}
-
-
-int write_RLE_file(const char *filename)
-{
- assert(0);
- return 0;
-}
-
-
-int fill_input_buffer(rle_decompressed_frame * frame)
-{
- return 1;
-}
-
-int read_RLE_file(const char *filename)
-{
- assert(0);
- return 1;
-}
-
-int main(int argc, char *argv[])
-{
- rle_decompress_struct cinfo;
- FILE * infile;
-
- const char *filename;
- if( argc < 2 )
- {
- return 1;
- }
- filename = argv[1];
-
- if ((infile = fopen(filename, "rb")) == NULL) {
- fprintf(stderr, "can't open %s\n", filename);
- return 0;
- }
-
- rle_create_decompress(&cinfo);
-
- int i;
- int dims[2] = { 1760,1760 };
- int bpp = 16;
- rle_stdio_src(&cinfo, infile, dims);
-
- printf("num segment: %d\n", cinfo.header->num_segments );
- printf("offsets table:\n");
- for(i = 0; i < 16; ++i)
- printf("offset: %d\n", cinfo.header->offset[i] );
-
- (void) rle_start_decompress(&cinfo);
-
- char *buffer = (char*)malloc( dims[0] * (bpp / 8) );
- while( cinfo.current_segment < cinfo.header->num_segments ) {
- while (cinfo.output_scanline < cinfo.output_height) {
- (void) rle_read_scanlines(&cinfo, buffer, 1);
- /*put_scanline_someplace(buffer[0], row_stride);*/
- }
- }
- free(buffer);
-
- (void) rle_finish_decompress(&cinfo);
-
- rle_destroy_decompress(&cinfo);
-
- fclose(infile);
-
- return 0;
-}
diff --git a/Utilities/rle/rle.c b/Utilities/rle/rle.c
deleted file mode 100644
index e549fd6..0000000
--- a/Utilities/rle/rle.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/*=========================================================================
-
- Program: GDCM (Grassroots DICOM). A DICOM library
-
- Copyright (c) 2006-2011 Mathieu Malaterre
- All rights reserved.
- See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-#include "rlelib.h"
-
-
-int rle_decode_init(rle_compressed_frame * frame)
-{
- return 0;
-}
-
-int rle_decode_segment(rle_compressed_frame * frame)
-{
- return 0;
-}
-
-int rle_decode_frame(rle_compressed_frame * frame)
-{
- return 0;
-}
-
-int rle_decode_end()
-{
- return 0;
-}
diff --git a/Utilities/rle/rledump.c b/Utilities/rle/rledump.c
deleted file mode 100644
index ded020b..0000000
--- a/Utilities/rle/rledump.c
+++ /dev/null
@@ -1,53 +0,0 @@
-/*=========================================================================
-
- Program: GDCM (Grassroots DICOM). A DICOM library
-
- Copyright (c) 2006-2011 Mathieu Malaterre
- All rights reserved.
- See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-#include "rlelib.h"
-
-int main(int argc, char *argv[])
-{
- rle_decompress_struct cinfo;
- FILE * infile;
- int i;
-
- const char *filename;
- if( argc < 2 )
- {
- return 1;
- }
- filename = argv[1];
-
- if ((infile = fopen(filename, "rb")) == NULL) {
- fprintf(stderr, "can't open %s\n", filename);
- return 0;
- }
-
- rle_create_decompress(&cinfo);
-
- /* Dimensions: (1760,1760,1)*/
- int dims[2] = { 1760,1760 };
- rle_stdio_src(&cinfo, infile, dims);
-
- /*rle_header *h = cinfo.header;*/
- printf("num segment: %d\n", cinfo.header->num_segments );
- printf("offsets table:\n");
- for(i = 0; i < 16; ++i)
- printf("offset: %d\n", cinfo.header->offset[i] );
-
- /* Simply dump the file info:*/
-
- rle_destroy_decompress(&cinfo);
-
- fclose(infile);
-
- return 0;
-}
diff --git a/Utilities/rle/rlelib.c b/Utilities/rle/rlelib.c
deleted file mode 100644
index 876557b..0000000
--- a/Utilities/rle/rlelib.c
+++ /dev/null
@@ -1,162 +0,0 @@
-/*=========================================================================
-
- Program: GDCM (Grassroots DICOM). A DICOM library
-
- Copyright (c) 2006-2011 Mathieu Malaterre
- All rights reserved.
- See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-#include "rlelib.h"
-
-void rle_stdio_src(rle_decompress_struct *cinfo, FILE *infile, int *dims)
-{
- int i;
- /*is.read((char*)(&Header), sizeof(uint32_t)*16);*/
- size_t len = fread(cinfo->header, sizeof(uint32_t), 16, infile);
- cinfo->row = dims[0];
- cinfo->col = dims[1];
- if( cinfo->header->num_segments > 16 || cinfo->header->num_segments < 1 )
- {
- /* Need to throw something here*/
- assert(0);
- }
- if( cinfo->header->offset[0] != 64 )
- {
- /* Need to throw something here*/
- assert(0);
- }
- for(i=1; i < cinfo->header->num_segments; ++i)
- {
- if( cinfo->header->offset[i-1] > cinfo->header->offset[i] )
- {
- /* Need to throw something here*/
- assert(0);
- }
- }
- for(i=cinfo->header->num_segments; i < 16; ++i)
- {
- if( cinfo->header->offset[i] != 0 )
- {
- /* Need to throw something here*/
- /*assert(0);*/
- fprintf(stderr, "Impossible : %d for offset # %d\n", cinfo->header->offset[i], i );
- }
- }
- cinfo->stream = infile;
-
- cinfo->output_height = dims[1];
-}
-
-/*
- * G.3.2 The RLE decoder
- * Pseudo code for the RLE decoder is shown below:
- * Loop until the number of output bytes equals the uncompressed segment size
- * Read the next source byte into n
- * If n> =0 and n <= 127 then
- * output the next n+1 bytes literally
- * Elseif n <= - 1 and n >= -127 then
- * output the next byte -n+1 times
- * Elseif n = - 128 then
- * output nothing
- * Endif
- * Endloop
- */
-
-int rle_start_decompress(rle_decompress_struct *cinfo)
-{
- fseek(cinfo->stream, cinfo->header->offset[0], SEEK_SET );
- cinfo->current_pos = 0;
- return 1;
-}
-
-void rle_create_decompress(rle_decompress_struct *cinfo)
-{
- int i;
- cinfo->output_scanline = 0;
- cinfo->output_height = 0;
- cinfo->current_segment = 0;
- cinfo->header = (rle_header*)malloc(sizeof(rle_header));
- cinfo->header->num_segments = 0;
- for(i = 0; i < 16; ++i)
- cinfo->header->offset[i] = 0;
-}
-
-int rle_read_scanlines(rle_decompress_struct *cinfo, char *buffer, int f)
-{
- signed char byte;
- signed char nextbyte;
- unsigned long length = cinfo->row * cinfo->col;
- /* read too much ! */
- printf("%d vs %d \n", cinfo->current_pos, length ) ;
- printf("scan %d \n", cinfo->output_scanline ) ;
- if( cinfo->current_segment > cinfo->header->num_segments )
- {
- return 0;
- }
-
- unsigned long noutbytes = 0;
- char * p = buffer;
- int c;
- while( noutbytes < cinfo->row )
- {
- size_t s1 = fread(&byte, 1, 1, cinfo->stream);
- if( byte >= 0 )
- {
- fread(p, (int)byte+1, 1, cinfo->stream);
- p+=(int)byte+1;
- noutbytes += (int)byte+1;
- }
- else if( byte < 0 && byte > -128 )
- {
- size_t s2 = fread(&nextbyte, 1, 1, cinfo->stream);
- for( c = 0; c < (int)-byte + 1; ++c )
- {
- *p++ = nextbyte;
- noutbytes++;
- }
- }
- else
- {
- assert( byte == -128 );
- }
- }
- assert( p - buffer == cinfo->row );
- assert( noutbytes == cinfo->row );
- cinfo->current_pos += cinfo->row;
- long pos = ftell(cinfo->stream);
- /*printf("pos: %d\n",pos);*/
- cinfo->output_scanline++;
-
- assert( cinfo->current_pos <= length );
- if( cinfo->current_pos >= length )
- {
- /* if( cinfo->current_segment > cinfo->header->num_segments )
- {
- return 0;
- }
- else*/
- {
- cinfo->current_segment++;
- cinfo->output_scanline = 0;
- }
- }
-
- return 1;
-}
-
-int rle_finish_decompress(rle_decompress_struct *cinfo)
-{
- return 1;
-}
-
-void rle_destroy_decompress(rle_decompress_struct *cinfo)
-{
- cinfo->output_scanline = 0; /* why not*/
- cinfo->output_height = 0; /* why not*/
- free(cinfo->header);
-}
diff --git a/Utilities/rle/rlelib.h b/Utilities/rle/rlelib.h
deleted file mode 100644
index 401c93b..0000000
--- a/Utilities/rle/rlelib.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/*=========================================================================
-
- Program: GDCM (Grassroots DICOM). A DICOM library
-
- Copyright (c) 2006-2011 Mathieu Malaterre
- All rights reserved.
- See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-#ifndef RLELIB_H
-#define RLELIB_H
-
-#include <stdint.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-
-#define RLE_LIB_VERSION 0.0.1
-
-typedef struct
-{
- uint32_t num_segments;
- uint32_t offset[15];
- void (*print_header) (void);
-} rle_header;
-
-typedef struct
-{
- rle_header * header;
-} rle_compressed_frame;
-
-typedef struct
-{
- rle_header * header;
-} rle_decompressed_frame;
-
-typedef struct
-{
- int (*fill_input_buffer) (rle_decompressed_frame*);
-} source_mgr;
-
-typedef struct
-{
- int output_scanline;
- int output_height;
- /*int bits_allocated; // 8 or 16, when 16 need to do padded composite*/
- int row;
- int col;
- FILE *stream;
- int current_segment;
- unsigned long current_pos;
- rle_header *header;
-} rle_decompress_struct;
-
-
-void rle_stdio_src(rle_decompress_struct *cinfo, FILE *infile, int *dims);
-int rle_start_decompress(rle_decompress_struct *cinfo);
-void rle_create_decompress(rle_decompress_struct *cinfo);
-int rle_read_scanlines(rle_decompress_struct *cinfo, char *buffer, int f);
-int rle_finish_decompress(rle_decompress_struct *cinfo);
-void rle_destroy_decompress(rle_decompress_struct *cinfo);
-
-#endif /* RLELIB_H */
https://sourceforge.net/p/gdcm/gdcm/ci/654dc4ce421b8e9e6a41acb7750a461a215b3927/
commit 654dc4ce421b8e9e6a41acb7750a461a215b3927
Author: Mathieu Malaterre <mat...@gm...>
Date: Tue Jan 31 16:59:54 2017 +0100
Remove a dummy tool
diff --git a/Utilities/Tools/CMakeLists.txt b/Utilities/Tools/CMakeLists.txt
deleted file mode 100644
index 0c8d7f4..0000000
--- a/Utilities/Tools/CMakeLists.txt
+++ /dev/null
@@ -1,3 +0,0 @@
-project(TOOLS)
-
-add_executable(upsidedown upsidedown.c)
diff --git a/Utilities/Tools/upsidedown.c b/Utilities/Tools/upsidedown.c
deleted file mode 100644
index 66f1a9d..0000000
--- a/Utilities/Tools/upsidedown.c
+++ /dev/null
@@ -1,46 +0,0 @@
-/*=========================================================================
-
- Program: GDCM (Grassroots DICOM). A DICOM library
-
- Copyright (c) 2006-2011 Mathieu Malaterre
- All rights reserved.
- See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-
-#include <stdio.h>
-#include <assert.h>
-#include <stdlib.h>
-
-int main(int argc, char *argv[])
-{
- const unsigned int x = 420;
- const unsigned int y = 608;
- const unsigned int bit = 1;
- char *buffer = malloc(x*y*bit);
- int i = 1;
- size_t len;
- const char *filename, *outfilename;
- FILE *in, *out;
- if( argc < 3 )
- return 1;
- filename = argv[1];
- outfilename = argv[2];
- in = fopen(filename, "rb" );
- out = fopen(outfilename, "wb" );
- len = fread(buffer,1,bit*x*y,in);
- assert( len == x*y*bit );
-
- for(i = y; i > 0; --i)
- {
- fwrite(buffer+bit*x*(i-1),1,bit*x,out);
- }
- fclose(in);
- fclose(out);
- free(buffer);
- return 0;
-}
https://sourceforge.net/p/gdcm/gdcm/ci/c43f95fbad7009c9408ac2f02b398dc12c886241/
commit c43f95fbad7009c9408ac2f02b398dc12c886241
Author: Mathieu Malaterre <mat...@gm...>
Date: Tue Jan 31 16:59:08 2017 +0100
Cleanup some very old stuff
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9c8188f..2fa8708 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -657,12 +657,6 @@ if(GDCM_STANDALONE)
subdirs(Utilities/VTK)
endif()
endif()
-#-----------------------------------------------------------------------------
-option(GDCM_USE_WXWIDGETS "wxWidgets bridge ?" OFF)
-mark_as_advanced(GDCM_USE_WXWIDGETS)
-if(GDCM_USE_WXWIDGETS)
- subdirs(Utilities/wxWidgets)
-endif()
#-----------------------------------------------------------------------------
if(GDCM_STANDALONE)
diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt
index 0ddd3fc..f779aec 100644
--- a/Utilities/CMakeLists.txt
+++ b/Utilities/CMakeLists.txt
@@ -106,9 +106,6 @@ endif()
# Do C99
APPEND_COPYRIGHT(${CMAKE_CURRENT_SOURCE_DIR}/C99/COPYING)
-# Do wxVTK
-APPEND_COPYRIGHT(${CMAKE_CURRENT_SOURCE_DIR}/wxWidgets/Copyright.txt)
-
#if(NOT GDCM_INSTALL_NO_DEVELOPMENT)
## file(GLOB header_files "*.h" "*.txx")
# install(FILES
diff --git a/Utilities/wxWidgets/CMakeLists.txt b/Utilities/wxWidgets/CMakeLists.txt
deleted file mode 100644
index b6562fc..0000000
--- a/Utilities/wxWidgets/CMakeLists.txt
+++ /dev/null
@@ -1,67 +0,0 @@
-cmake_minimum_required(VERSION 2.8.7)
-
-project(WXGDCM)
-# wxWidgets stuff changed a lot within the 2.4.2 to 2.4.3
-# I wonder if this has something to do with adding features on a stable branch?
-
-#-----------------------------------------------------------------------------
-find_package(VTK REQUIRED)
-include(${VTK_USE_FILE})
-
-if(WIN32)
- set(GUI_EXECUTABLE WIN32)
-else()
- if(APPLE)
- set(GUI_EXECUTABLE MACOSX_BUNDLE)
- if(VTK_USE_COCOA)
- set_source_files_properties(
- wxVTKRenderWindowInteractor.cxx
- PROPERTIES COMPILE_FLAGS "-ObjC++")
- endif()
- else()
- # Ok X11 for sure, but just check:
- if(NOT VTK_USE_X)
- message(FATAL_ERROR "You need to have VTK_USE_X")
- endif()
- # See also:
- # FindGTK.cmake update
- # http://www.cmake.org/Bug/bug.php?op=show&bugid=3582
- #find_package(GTK REQUIRED)
- #include_directories(${GTK_INCLUDE_DIR}
- # #/usr/lib/wx/include/gtk-2.4/
- #)
- find_package(PkgConfig)
- pkg_check_modules (GTK2 gtk+-2.0)
- #message("${GTK2_INCLUDE_DIRS}")
- include_directories(${GTK2_INCLUDE_DIRS})
- link_libraries(${GTK2_LIBRARIES})
-
- # Can I require all my user to have the gl lib on linux, even if they do not really need it...
- set(WXGLCANVASLIBS "gl")
- endif()
-endif()
-
-# wxWidgets is required to build the project
-# For GTK we need a couple of stuff:
-# gl: GLCanvas
-# adv: wxSashLayoutWindow and such...
-find_package(wxWidgets COMPONENTS base core adv ${WXGLCANVASLIBS})
-
-if(wxWidgets_FOUND)
- include( ${wxWidgets_USE_FILE} )
-endif()
-
-include_directories(
- ${GDCM_BINARY_DIR}/Source/Common # gdcmConfigure.h
- ${GDCM_SOURCE_DIR}/Source/Common
- ${GDCM_SOURCE_DIR}/Utilities/VTK
-)
-
-add_executable(wxGDCM main.cpp wxGDCMFrame.cpp wxGDCMFrameBase.cpp wxVTKRenderWindowInteractor.cxx)
-target_link_libraries(wxGDCM vtkRendering ${wxWidgets_LIBRARIES} vtkgdcm)
-install(TARGETS wxGDCM
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib
- ARCHIVE DESTINATION lib/static
- ${CPACK_NAMELINK_TYPE}
- )
diff --git a/Utilities/wxWidgets/Copyright.txt b/Utilities/wxWidgets/Copyright.txt
deleted file mode 100644
index a4c072b..0000000
--- a/Utilities/wxWidgets/Copyright.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: wxVTKRenderWindowInteractor.h,v $
- Language: C++
- Date: $Date: 2008/08/10 22:58:28 $
- Version: $Revision: 1.21 $
-
- Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
diff --git a/Utilities/wxWidgets/MyDialog.cpp b/Utilities/wxWidgets/MyDialog.cpp
deleted file mode 100644
index 52d6d14..0000000
--- a/Utilities/wxWidgets/MyDialog.cpp
+++ /dev/null
@@ -1,30 +0,0 @@
-// -*- C++ -*- generated by wxGlade 0.4.1 on Mon Aug 28 23:13:14 2006
-
-#include "MyDialog.h"
-
-
-MyDialog::MyDialog(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style):
- wxDialog(parent, id, title, pos, size, wxDEFAULT_DIALOG_STYLE)
-{
- // begin wxGlade: MyDialog::MyDialog
-
- set_properties();
- do_layout();
- // end wxGlade
-}
-
-
-void MyDialog::set_properties()
-{
- // begin wxGlade: MyDialog::set_properties
- SetTitle(wxT("About Dialog"));
- // end wxGlade
-}
-
-
-void MyDialog::do_layout()
-{
- // begin wxGlade: MyDialog::do_layout
- Layout();
- // end wxGlade
-}
diff --git a/Utilities/wxWidgets/MyDialog.h b/Utilities/wxWidgets/MyDialog.h
deleted file mode 100644
index 4aad2ed..0000000
--- a/Utilities/wxWidgets/MyDialog.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// -*- C++ -*- generated by wxGlade 0.4.1 on Mon Aug 28 23:13:14 2006
-
-#include <wx/wx.h>
-#include <wx/image.h>
-
-#ifndef MYDIALOG_H
-#define MYDIALOG_H
-
-// begin wxGlade: ::dependencies
-// end wxGlade
-
-
-class MyDialog: public wxDialog {
-public:
- // begin wxGlade: MyDialog::ids
- // end wxGlade
-
- MyDialog(wxWindow* parent, int id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE);
-
-private:
- // begin wxGlade: MyDialog::methods
- void set_properties();
- void do_layout();
- // end wxGlade
-
-protected:
- // begin wxGlade: MyDialog::attributes
- // end wxGlade
-}; // wxGlade: end class
-
-
-#endif // MYDIALOG_H
diff --git a/Utilities/wxWidgets/main.cpp b/Utilities/wxWidgets/main.cpp
deleted file mode 100644
index 9247e03..0000000
--- a/Utilities/wxWidgets/main.cpp
+++ /dev/null
@@ -1,23 +0,0 @@
-// -*- C++ -*- generated by wxGlade 0.4.1 on Sat Aug 19 15:23:11 2006
-
-#include <wx/wx.h>
-#include <wx/image.h>
-#include "wxGDCMFrame.h"
-
-
-
-class wxGDCMApp: public wxApp {
-public:
- bool OnInit();
-};
-
-IMPLEMENT_APP(wxGDCMApp)
-
-bool wxGDCMApp::OnInit()
-{
- wxInitAllImageHandlers();
- wxGDCMFrame* TopFrame = new wxGDCMFrame(0, -1, wxT(""));
- SetTopWindow(TopFrame);
- TopFrame->Show();
- return true;
-}
diff --git a/Utilities/wxWidgets/wxGDCMFrame.cpp b/Utilities/wxWidgets/wxGDCMFrame.cpp
deleted file mode 100644
index f7e4376..0000000
--- a/Utilities/wxWidgets/wxGDCMFrame.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-// -*- C++ -*- generated by wxGlade 0.4.1 on Sat Aug 19 15:28:55 2006
-
-#include "wxGDCMFrame.h"
-#include "wxVTKRenderWindowInteractor.h"
-#include "vtkImageViewer2.h"
-#include "vtkImageViewer.h"
-#include "vtkGDCMImageReader.h"
-#include "vtkImageColorViewer.h"
-#include "vtkImageData.h"
-#include "vtkTesting.h"
-#include "vtkTestUtilities.h"
-#include "vtkPNGReader.h"
-#include "vtkRenderer.h"
-
-BEGIN_EVENT_TABLE( wxGDCMFrame, wxGDCMFrameBase )
- EVT_MENU(wxID_OPEN, wxGDCMFrame::OnOpen)
- EVT_MENU(wxID_HELP, wxGDCMFrame::OnAbout)
- EVT_MENU(wxID_EXIT, wxGDCMFrame::OnQuit)
- EVT_CLOSE( wxGDCMFrame::OnCloseFrame)
-END_EVENT_TABLE( );
-
-
-wxGDCMFrame::wxGDCMFrame(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style):
- wxGDCMFrameBase(parent, id, title, pos, size, wxDEFAULT_FRAME_STYLE)
-{
-
- imageViewer = vtkImageColorViewer::New();
- //imageViewer = vtkImageViewer::New();
- //imageViewer->SetupInteractor( NULL );
- //imageViewer->SetRenderWindow( VTKWindow->GetRenderWindow() );
- //imageViewer->SetInput( vtkImageData::New() );
- char* fname = vtkTestUtilities::ExpandDataFileName(0, 0, "Data/fullhead15.png");
-
- //# Image pipeline
-vtkPNGReader*
- reader = vtkPNGReader::New();
- reader->SetDataSpacing (0.8, 0.8, 1.5);
- reader->SetFileName ( fname );
- delete[] fname;
- imageViewer->SetInput ( reader->GetOutput());
-
- imageViewer->SetupInteractor( VTKWindow );
- int s[2]={200,200};
- imageViewer->SetSize( s );
- Reader = vtkGDCMImageReader::New();
- directory = wxT( "" );
-}
-
-wxGDCMFrame::~wxGDCMFrame()
-{
- //VTKWindow->Delete();
- imageViewer->Delete();
- Reader->Delete();
-}
-
-
-void wxGDCMFrame::OnCloseFrame( wxCloseEvent& event )
-{
- std::cerr << "Close" << std::endl;
- Destroy();
-}
-
-void wxGDCMFrame::OnOpen(wxCommandEvent& event)
-{
- std::cerr << "Open" << std::endl;
- wxString filemask = wxT("DICOM files (*.dcm)|*.dcm");
- wxFileDialog* dialog = new wxFileDialog( this, wxT("Open DICOM"), directory,
- filename, filemask, wxOPEN );
- dialog->CentreOnParent();
- if ( dialog->ShowModal() == wxID_OK )
- {
- directory = dialog->GetDirectory();
- filename = dialog->GetFilename();
- std::cerr << "Dir: " << directory.fn_str() << std::endl;
- std::cerr << "File: " << filename.fn_str() << std::endl;
- //wxString fn = dialog->GetFilename();
- //std::cerr << "fn: " << fn.fn_str() << std::endl;
- std::string fn = (const char*)directory.fn_str();
- fn += "/";
- fn += (const char *)filename.fn_str();
- Reader->SetFileName( fn.c_str() );
- Reader->Update();
- Reader->GetOutput()->Print( std::cout );
- //imageViewer->SetInputConnection( Reader->GetOutputPort(0) );
- imageViewer->SetInput( Reader->GetOutput(0) );
- imageViewer->Modified();
- imageViewer->GetRenderer()->ResetCameraClippingRange();
-
- imageViewer->Render();
- }
- dialog->Close();
- dialog->Destroy();
-}
-
-void wxGDCMFrame::OnQuit( wxCommandEvent& event )
-{
- std::cerr << "Quit" << std::endl;
- Close(true);
-}
-
-void wxGDCMFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
-{
- wxMessageBox( _T("This is the about box for wxGDCM"), _T("About wxGDCM"));
-/*
- wxMessageDialog* msgDialog = new wxMessageDialog( this, wxString(
- text.c_str(), wxConvUTF8 ), wxString( title.c_str(), wxConvUTF8 ), wxOK );
- msgDialog->ShowModal();
- msgDialog->Close();
- msgDialog->Destroy();
-*/
-
-}
diff --git a/Utilities/wxWidgets/wxGDCMFrame.h b/Utilities/wxWidgets/wxGDCMFrame.h
deleted file mode 100644
index ac72d97..0000000
--- a/Utilities/wxWidgets/wxGDCMFrame.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef WXGDCMFRAME_H
-#define WXGDCMFRAME_H
-
-#include "wxGDCMFrameBase.h"
-class vtkImageColorViewer;
-class vtkImageViewer;
-class vtkGDCMImageReader;
-class wxGDCMFrame: public wxGDCMFrameBase
-{
-public:
- wxGDCMFrame(wxWindow* parent, int id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE);
- ~wxGDCMFrame();
-
-
- void OnQuit( wxCommandEvent& event );
- void OnOpen(wxCommandEvent& event);
- void OnAbout(wxCommandEvent& event);
- void OnCloseFrame( wxCloseEvent& event );
-
-private:
- wxString directory;
- wxString filename;
- vtkImageColorViewer *imageViewer;
- //vtkImageViewer *imageViewer;
- vtkGDCMImageReader *Reader;
-
- DECLARE_EVENT_TABLE( );
-}; // wxGlade: end class
-
-
-#endif // WXGDCMFRAME_H
diff --git a/Utilities/wxWidgets/wxGDCMFrameBase.cpp b/Utilities/wxWidgets/wxGDCMFrameBase.cpp
deleted file mode 100644
index a7efc74..0000000
--- a/Utilities/wxWidgets/wxGDCMFrameBase.cpp
+++ /dev/null
@@ -1,79 +0,0 @@
-// -*- C++ -*- generated by wxGlade 0.4.1 on Mon Aug 28 23:13:14 2006
-
-#include "wxGDCMFrameBase.h"
-#include "wxVTKRenderWindowInteractor.h"
-
-
-wxGDCMFrameBase::wxGDCMFrameBase(wxWindow* parent, int id, const wxString& title, const wxPoint& pos, const wxSize& size, long style):
- wxFrame(parent, id, title, pos, size, wxDEFAULT_FRAME_STYLE)
-{
- // begin wxGlade: wxGDCMFrameBase::wxGDCMFrameBase
- Notebook = new wxNotebook(this, -1, wxDefaultPosition, wxDefaultSize, 0);
- TopFrameMenubar = new wxMenuBar();
- SetMenuBar(TopFrameMenubar);
- wxMenu* wxglade_tmp_menu_1 = new wxMenu();
- wxglade_tmp_menu_1->Append(wxID_OPEN, wxT("&Open...\tCtrl+o"), wxT("Open DICOM file"), wxITEM_NORMAL);
- wxglade_tmp_menu_1->Append(wxNewId(), wxT("&Rewrite...\tCtrl+r"), wxT("Rewrite DICOM file"), wxITEM_NORMAL);
- wxglade_tmp_menu_1->Append(wxNewId(), wxT("&Save...\tCtrl+s"), wxT("Save DICOM File"), wxITEM_NORMAL);
- wxglade_tmp_menu_1->AppendSeparator();
- wxglade_tmp_menu_1->Append(wxID_EXIT, wxT("E&xit...\tCtrl+x"), wxT("Exit app"), wxITEM_NORMAL);
- TopFrameMenubar->Append(wxglade_tmp_menu_1, wxT("File"));
- wxMenu* wxglade_tmp_menu_2 = new wxMenu();
- TopFrameMenubar->Append(wxglade_tmp_menu_2, wxT("Tools"));
- wxMenu* wxglade_tmp_menu_3 = new wxMenu();
- wxglade_tmp_menu_3->Append(wxID_HELP, wxT("&About...\tCtrl+a"), wxT("About Dialog"), wxITEM_NORMAL);
- TopFrameMenubar->Append(wxglade_tmp_menu_3, wxT("Help"));
- TopFrameStatusbar = CreateStatusBar(1, 0);
- TopFrameToolbar = new wxToolBar(this, -1, wxDefaultPosition, wxDefaultSize, wxTB_HORIZONTAL|wxTB_TEXT);
- SetToolBar(TopFrameToolbar);
- TopFrameToolbar->AddTool(wxNewId(), wxT("tool"), wxNullBitmap, wxNullBitmap, wxITEM_NORMAL, wxT(""), wxT(""));
- TopFrameToolbar->AddSeparator();
- TopFrameToolbar->AddTool(wxNewId(), wxT("tool"), wxNullBitmap, wxNullBitmap, wxITEM_NORMAL, wxT(""), wxT(""));
- TopFrameToolbar->AddSeparator();
- TopFrameToolbar->AddTool(wxNewId(), wxT("tool"), wxNullBitmap, wxNullBitmap, wxITEM_NORMAL, wxT(""), wxT(""));
- TopFrameToolbar->Realize();
- TreeCtrl = new wxTreeCtrl(this, -1, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS|wxTR_NO_LINES|wxTR_DEFAULT_STYLE|wxSUNKEN_BORDER);
- ListCtrl = new wxListCtrl(this, -1, wxDefaultPosition, wxDefaultSize, wxLC_REPORT|wxSUNKEN_BORDER);
- VTKWindow = new wxVTKRenderWindowInteractor(Notebook, -1);
- Grid = new wxGrid(Notebook, -1);
-
- set_properties();
- do_layout();
- // end wxGlade
-}
-
-
-void wxGDCMFrameBase::set_properties()
-{
- // begin wxGlade: wxGDCMFrameBase::set_properties
- SetTitle(wxT("wxGDCM"));
- SetSize(wxSize(725, 565));
- int TopFrameStatusbar_widths[] = { -1 };
- TopFrameStatusbar->SetStatusWidths(1, TopFrameStatusbar_widths);
- const wxString TopFrameStatusbar_fields[] = {
- wxT("frame_1_statusbar")
- };
- for(int i = 0; i < TopFrameStatusbar->GetFieldsCount(); ++i) {
- TopFrameStatusbar->SetStatusText(TopFrameStatusbar_fields[i], i);
- }
- Grid->CreateGrid(10, 3);
- // end wxGlade
-}
-
-
-void wxGDCMFrameBase::do_layout()
-{
- // begin wxGlade: wxGDCMFrameBase::do_layout
- wxBoxSizer* Sizer = new wxBoxSizer(wxHORIZONTAL);
- wxBoxSizer* sizer_1 = new wxBoxSizer(wxVERTICAL);
- sizer_1->Add(TreeCtrl, 1, wxEXPAND, 0);
- sizer_1->Add(ListCtrl, 1, wxEXPAND, 0);
- Sizer->Add(sizer_1, 1, wxEXPAND, 0);
- Notebook->AddPage(VTKWindow, wxT("View"));
- Notebook->AddPage(Grid, wxT("DICOM Tags"));
- Sizer->Add(Notebook, 1, wxEXPAND, 0);
- SetAutoLayout(true);
- SetSizer(Sizer);
- Layout();
- // end wxGlade
-}
diff --git a/Utilities/wxWidgets/wxGDCMFrameBase.h b/Utilities/wxWidgets/wxGDCMFrameBase.h
deleted file mode 100644
index 3f303b5..0000000
--- a/Utilities/wxWidgets/wxGDCMFrameBase.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// -*- C++ -*- generated by wxGlade 0.4.1 on Mon Aug 28 23:13:14 2006
-
-#include <wx/wx.h>
-#include <wx/image.h>
-
-#ifndef WXGDCMFRAMEBASE_H
-#define WXGDCMFRAMEBASE_H
-
-// begin wxGlade: ::dependencies
-#include <wx/treectrl.h>
-#include <wx/listctrl.h>
-#include <wx/notebook.h>
-#include <wx/grid.h>
-// end wxGlade
-
-
-class wxVTKRenderWindowInteractor;
-class wxGDCMFrameBase: public wxFrame {
-public:
- // begin wxGlade: wxGDCMFrameBase::ids
- // end wxGlade
-
- wxGDCMFrameBase(wxWindow* parent, int id, const wxString& title, const wxPoint& pos=wxDefaultPosition, const wxSize& size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE);
-
-private:
- // begin wxGlade: wxGDCMFrameBase::methods
- void set_properties();
- void do_layout();
- // end wxGlade
-
-protected:
- // begin wxGlade: wxGDCMFrameBase::attributes
- wxMenuBar* TopFrameMenubar;
- wxStatusBar* TopFrameStatusbar;
- wxToolBar* TopFrameToolbar;
- wxTreeCtrl* TreeCtrl;
- wxListCtrl* ListCtrl;
- wxVTKRenderWindowInteractor* VTKWindow;
- wxGrid* Grid;
- wxNotebook* Notebook;
- // end wxGlade
-}; // wxGlade: end class
-
-
-#endif // WXGDCMFRAMEBASE_H
diff --git a/Utilities/wxWidgets/wxVTKRenderWindowInteractor.cxx b/Utilities/wxWidgets/wxVTKRenderWindowInteractor.cxx
deleted file mode 100644
index 44e17e3..0000000
--- a/Utilities/wxWidgets/wxVTKRenderWindowInteractor.cxx
+++ /dev/null
@@ -1,811 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: wxVTKRenderWindowInteractor.cxx,v $
- Language: C++
- Date: $Date: 2008/08/25 00:27:39 $
- Version: $Revision: 1.42 $
-
- Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
- All rights reserved.
- See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
-
- This software is distributed WITHOUT ANY WARRANTY; without even
- the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the above copyright notice for more information.
-
-=========================================================================*/
-
-#include <assert.h>
-
-#include "wxVTKRenderWindowInteractor.h"
-
-//This is needed for vtk 3.1 :
-#ifndef VTK_MAJOR_VERSION
-# include "vtkVersion.h"
-#endif
-
-#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
-# include "vtkCommand.h"
-#else
-# include "vtkInteractorStyle.h"
-#endif
-#include "vtkDebugLeaks.h"
-
-#ifdef __WXMAC__
-#ifdef __WXCOCOA__
-#include "vtkCocoaRenderWindow.h"
-#else
-#include "vtkCarbonRenderWindow.h"
-#endif
-#endif
-
-//Keep this for compatibilty reason, this was introduced in wxGTK 2.4.0
-#if (!wxCHECK_VERSION(2, 4, 0))
-wxWindow* wxGetTopLevelParent(wxWindow *win)
-{
- while ( win && !win->IsTopLevel() )
- win = win->GetParent();
- return win;
-}
-#endif
-
-// To access objc calls on cocoa
-#ifdef __WXCOCOA__
-#ifdef VTK_USE_COCOA
-#import <Cocoa/Cocoa.h>
-// This trick is no longer need in VTK CVS, should get rid of that:
-#define id Id
-#else
-#error Build mismatch you need both wxWidgets and VTK to be configure against Cocoa to work
-#endif //VTK_USE_COCOA
-#endif //__WXCOCOA__
-
-#ifdef __WXGTK__
-# include <gdk/gdkx.h> // GDK_WINDOW_XWINDOW is found here in wxWidgets 2.8.0
-# include "gdk/gdkprivate.h"
-#if wxCHECK_VERSION(2, 8, 0)
-#ifdef __WXGTK20__
-#include <wx/gtk/win_gtk.h>
-#else
-#include <wx/gtk1/win_gtk.h>
-#endif
-#else
-#include <wx/gtk/win_gtk.h>
-#endif
-#define GetXWindow(wxwin) (wxwin)->m_wxwindow ? \
- GDK_WINDOW_XWINDOW(GTK_PIZZA((wxwin)->m_wxwindow)->bin_window) : \
- GDK_WINDOW_XWINDOW((wxwin)->m_widget->window)
-#endif
-
-#ifdef __WXX11__
-#include "wx/x11/privx.h"
-#define GetXWindow(wxwin) ((Window)(wxwin)->GetHandle())
-#endif
-
-
-//For more info on this class please go to:
-//http://wxvtk.sf.net
-//This hack is for some buggy wxGTK version:
-#if wxCHECK_VERSION(2, 3, 2) && !wxCHECK_VERSION(2, 4, 1) && defined(__WXGTK__)
-# define WX_USE_X_CAPTURE 0
-#else
-# define WX_USE_X_CAPTURE 1
-#endif
-
-#define ID_wxVTKRenderWindowInteractor_TIMER 1001
-
-#if defined(__WXGTK__) && defined(USE_WXGLCANVAS)
-IMPLEMENT_DYNAMIC_CLASS(wxVTKRenderWindowInteractor, wxGLCanvas)
-#else
-IMPLEMENT_DYNAMIC_CLASS(wxVTKRenderWindowInteractor, wxWindow)
-#endif //__WXGTK__
-
-//---------------------------------------------------------------------------
-#if defined(__WXGTK__) && defined(USE_WXGLCANVAS)
-BEGIN_EVENT_TABLE(wxVTKRenderWindowInteractor, wxGLCanvas)
-#else
-BEGIN_EVENT_TABLE(wxVTKRenderWindowInteractor, wxWindow)
-#endif //__WXGTK__
- //refresh window by doing a Render
- EVT_PAINT (wxVTKRenderWindowInteractor::OnPaint)
- EVT_ERASE_BACKGROUND(wxVTKRenderWindowInteractor::OnEraseBackground)
- EVT_MOTION (wxVTKRenderWindowInteractor::OnMotion)
-
- //Bind the events to the event converters
- EVT_LEFT_DOWN (wxVTKRenderWindowInteractor::OnButtonDown)
- EVT_MIDDLE_DOWN (wxVTKRenderWindowInteractor::OnButtonDown)
- EVT_RIGHT_DOWN (wxVTKRenderWindowInteractor::OnButtonDown)
- EVT_LEFT_UP (wxVTKRenderWindowInteractor::OnButtonUp)
- EVT_MIDDLE_UP (wxVTKRenderWindowInteractor::OnButtonUp)
- EVT_RIGHT_UP (wxVTKRenderWindowInteractor::OnButtonUp)
-#if !(VTK_MAJOR_VERSION == 3 && VTK_MINOR_VERSION == 1)
- EVT_ENTER_WINDOW(wxVTKRenderWindowInteractor::OnEnter)
- EVT_LEAVE_WINDOW(wxVTKRenderWindowInteractor::OnLeave)
- EVT_MOUSEWHEEL (wxVTKRenderWindowInteractor::OnMouseWheel)
-#if wxCHECK_VERSION(2, 8, 0)
- EVT_MOUSE_CAPTURE_LOST(wxVTKRenderWindowInteractor::OnMouseCaptureLost)
-#endif
- EVT_KEY_DOWN (wxVTKRenderWindowInteractor::OnKeyDown)
- EVT_KEY_UP (wxVTKRenderWindowInteractor::OnKeyUp)
- EVT_CHAR (wxVTKRenderWindowInteractor::OnChar)
-#endif
- EVT_TIMER (ID_wxVTKRenderWindowInteractor_TIMER, wxVTKRenderWindowInteractor::OnTimer)
- EVT_SIZE (wxVTKRenderWindowInteractor::OnSize)
-END_EVENT_TABLE()
-
-//vtkCxxRevisionMacro(wxVTKRenderWindowInteractor, "$Revision: 1.42 $")
-vtkInstantiatorNewMacro(wxVTKRenderWindowInteractor)
-
-//---------------------------------------------------------------------------
-#if defined(__WXGTK__) && defined(USE_WXGLCANVAS)
-#if (wxCHECK_VERSION(2, 8, 0))
-wxVTKRenderWindowInteractor::wxVTKRenderWindowInteractor() : wxGLCanvas(0, -1, wxDefaultPosition), vtkRenderWindowInteractor()
-#else
-wxVTKRenderWindowInteractor::wxVTKRenderWindowInteractor() : wxGLCanvas(), vtkRenderWindowInteractor()
-#endif
-#else
-wxVTKRenderWindowInteractor::wxVTKRenderWindowInteractor() : wxWindow(), vtkRenderWindowInteractor()
-#endif //__WXGTK__
- , timer(this, ID_wxVTKRenderWindowInteractor_TIMER)
- , ActiveButton(wxEVT_NULL)
- , RenderAllowed(0)
- , Stereo(0)
- , Handle(0)
- , Created(true)
- , RenderWhenDisabled(1)
- , UseCaptureMouse(0)
-{
-#ifdef VTK_DEBUG_LEAKS
- vtkDebugLeaks::ConstructClass("wxVTKRenderWindowInteractor");
-#endif
- this->RenderWindow = NULL;
- this->SetRenderWindow(vtkRenderWindow::New());
- this->RenderWindow->Delete();
-}
-//---------------------------------------------------------------------------
-wxVTKRenderWindowInteractor::wxVTKRenderWindowInteractor(wxWindow *parent,
- wxWindowID id,
- const wxPoint &pos,
- const wxSize &size,
- long style,
- const wxString &name)
-#if defined(__WXGTK__) && defined(USE_WXGLCANVAS)
- : wxGLCanvas(parent, id, pos, size, style, name), vtkRenderWindowInteractor()
-#else
- : wxWindow(parent, id, pos, size, style, name), vtkRenderWindowInteractor()
-#endif //__WXGTK__
- , timer(this, ID_wxVTKRenderWindowInteractor_TIMER)
- , ActiveButton(wxEVT_NULL)
- , RenderAllowed(0)
- , Stereo(0)
- , Handle(0)
- , Created(true)
- , RenderWhenDisabled(1)
- , UseCaptureMouse(0)
-{
-#ifdef VTK_DEBUG_LEAKS
- vtkDebugLeaks::ConstructClass("wxVTKRenderWindowInteractor");
-#endif
- this->RenderWindow = NULL;
- this->SetRenderWindow(vtkRenderWindow::New());
- this->RenderWindow->Delete();
-#ifdef __WXMAC__
- // On Mac (Carbon) we don't get notified of the initial window size with an EVT_SIZE event,
- // so we update the size information of the interactor/renderwindow here
- this->UpdateSize(size.x, size.y);
-#endif
-}
-//---------------------------------------------------------------------------
-wxVTKRenderWindowInteractor::~wxVTKRenderWindowInteractor()
-{
- SetRenderWindow(NULL);
- SetInteractorStyle(NULL);
-}
-//---------------------------------------------------------------------------
-wxVTKRenderWindowInteractor * wxVTKRenderWindowInteractor::New()
-{
- // we don't make use of the objectfactory, because we're not registered
- return new wxVTKRenderWindowInteractor;
-}
-//---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::Initialize()
-{
- int *size = RenderWindow->GetSize();
- // enable everything and start rendering
- Enable();
- //RenderWindow->Start();
-
- // set the size in the render window interactor
- Size[0] = size[0];
- Size[1] = size[1];
-
- // this is initialized
- Initialized = 1;
-}
-//---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::Enable()
-{
- // if already enabled then done
- if (Enabled)
- return;
-
- // that's it
- Enabled = 1;
-#if defined(__WXGTK__) && defined(USE_WXGLCANVAS)
- SetCurrent();
-#endif
- Modified();
-}
-//---------------------------------------------------------------------------
-bool wxVTKRenderWindowInteractor::Enable(bool enable)
-{
-#if defined(__WXGTK__) && defined(USE_WXGLCANVAS)
- return wxGLCanvas::Enable(enable);
-#else
- return wxWindow::Enable(enable);
-#endif
-}
-//---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::Disable()
-{
- // if already disabled then done
- if (!Enabled)
- return;
-
- // that's it (we can't remove the event handler like it should be...)
- Enabled = 0;
- Modified();
-}
-//---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::Start()
-{
- // the interactor cannot control the event loop
- vtkErrorMacro( << "wxVTKRenderWindowInteractor::Start() "
- "interactor cannot control event loop.");
-}
-//---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::UpdateSize(int x, int y)
-{
- if( RenderWindow )
- {
- // if the size changed tell render window
- if ( x != Size[0] || y != Size[1] )
- {
- // adjust our (vtkRenderWindowInteractor size)
- Size[0] = x;
- Size[1] = y;
- // and our RenderWindow's size
- RenderWindow->SetSize(x, y);
- }
- }
-}
-//---------------------------------------------------------------------------
-int wxVTKRenderWindowInteractor::CreateTimer(int WXUNUSED(timertype))
-{
- // it's a one shot timer
- if (!timer.Start(10, TRUE))
- assert(false);
-
- return 1;
-
-}
-//---------------------------------------------------------------------------
-int wxVTKRenderWindowInteractor::DestroyTimer()
-{
- // do nothing
- return 1;
-}
-//---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::OnTimer(wxTimerEvent& WXUNUSED(event))
-{
- if (!Enabled)
- return;
-
-#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
- // new style
- InvokeEvent(vtkCommand::TimerEvent, NULL);
-#else
- // old style
- InteractorStyle->OnTimer();
-#endif
-}
-
-//---------------------------------------------------------------------------
-// NOTE on implementation:
-// Bad luck you ended up in the only tricky place of this code.
-// A few note, wxWidgets still refuse to provide such convenient method
-// so I have to maintain it myself, eventhough this is completely integrated
-// in wxPython...
-// Anyway if this happen to break for you then compare to a recent version of wxPython
-// and look for the function long wxPyGetWinHandle(wxWindow* win)
-// in wxPython/src/helpers.cpp
-long wxVTKRenderWindowInteractor::GetHandleHack()
-{
- //helper function to hide the MSW vs GTK stuff
- long handle_tmp = 0;
-
-// __WXMSW__ is for Win32
-//__WXMAC__ stands for using Carbon C-headers, using either the CarbonLib/CFM or the native Mach-O builds (which then also use the latest features available)
-// __WXGTK__ is for both gtk 1.2.x and gtk 2.x
-#if defined(__WXMSW__) || defined(__WXMAC__)
- handle_tmp = (long)this->GetHandle();
-#endif //__WXMSW__
-
-//__WXCOCOA__ stands for using the objective-c Cocoa API
-#ifdef __WXCOCOA__
- // Here is how to find the NSWindow
- wxTopLevelWindow* toplevel = dynamic_cast<wxTopLevelWindow*>(
- wxGetTopLevelParent( this ) );
- if (toplevel != NULL )
- {
- handle_tmp = (long)toplevel->GetNSWindow();
- }
- // The NSView will be deducted from
- // [(NSWindow*)Handle contentView]
- // if only I knew how to write that in c++
-#endif //__WXCOCOA__
-
- // Find and return the actual X-Window.
-#if defined(__WXGTK__) || defined(__WXX11__)
- return (long)GetXWindow(this);
-#endif
-
-//#ifdef __WXMOTIF__
-// handle_tmp = (long)this->GetXWindow();
-//#endif
-
- return handle_tmp;
-}
-//---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::OnPaint(wxPaintEvent& WXUNUSED(event))
-{
- //must always be here
- wxPaintDC pDC(this);
-
- //do it here rather than in the cstor: this is safer.
- if(!Handle)
- {
- Handle = GetHandleHack();
- RenderWindow->SetWindowId(reinterpret_cast<void *>(Handle));
-// Cocoa
-// this->GetNSView() <-> DisplayId
-// this->GetTopLevel()->GetNSWindow() <-> WindowId
-#ifdef __WXMSW__
- RenderWindow->SetParentId(reinterpret_cast<void *>(this->GetParent()->GetHWND()));
-#endif //__WXMSW__
- }
- // get vtk to render to the wxWindows
- Render();
-#ifdef __WXMAC__
- // This solves a problem with repainting after a window resize
- // See also: http://sourceforge.net/mailarchive/forum.php?thread_id=31690967&forum_id=41789
-#ifdef __WXCOCOA__
- vtkCocoaRenderWindow * rwin = vtkCocoaRenderWindow::SafeDownCast(RenderWindow);
- if( rwin )
- {
- rwin->UpdateContext();
- }
-#else
- vtkCarbonRenderWindow* rwin = vtkCarbonRenderWindow::SafeDownCast(RenderWindow);
- if( rwin )
- {
- rwin->UpdateGLRegion();
- }
-#endif
-#endif
-}
-//---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::OnEraseBackground(wxEraseEvent &event)
-{
- //turn off background erase to reduce flickering on MSW
- event.Skip(false);
-}
-//---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::OnSize(wxSizeEvent& WXUNUSED(event))
-{
- int w, h;
- GetClientSize(&w, &h);
- UpdateSize(w, h);
-
- if (!Enabled)
- {
- return;
- }
-
-#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
- InvokeEvent(vtkCommand::ConfigureEvent, NULL);
-#endif
- //this will check for Handle
- //Render();
-}
-//---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::OnMotion(wxMouseEvent &event)
-{
- if (!Enabled)
- {
- return;
- }
-#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
- SetEventInformationFlipY(event.GetX(), event.GetY(),
- event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
-
- InvokeEvent(vtkCommand::MouseMoveEvent, NULL);
-#else
- InteractorStyle->OnMouseMove(event.ControlDown(), event.ShiftDown(),
- event.GetX(), Size[1] - event.GetY() - 1);
-#endif
-}
-//---------------------------------------------------------------------------
-#if !(VTK_MAJOR_VERSION == 3 && VTK_MINOR_VERSION == 1)
-void wxVTKRenderWindowInteractor::OnEnter(wxMouseEvent &event)
-{
- if (!Enabled)
- {
- return;
- }
-
-#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
- // new style
- SetEventInformationFlipY(event.GetX(), event.GetY(),
- event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
-
- InvokeEvent(vtkCommand::EnterEvent, NULL);
-#else
- // old style
- InteractorStyle->OnEnter(event.ControlDown(), event.ShiftDown(),
- event.GetX(), Size[1] - event.GetY() - 1);
-#endif
-}
-//---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::OnLeave(wxMouseEvent &event)
-{
- if (!Enabled)
- {
- return;
- }
-
-#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
- // new style
- SetEventInformationFlipY(event.GetX(), event.GetY(),
- event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
-
- InvokeEvent(vtkCommand::LeaveEvent, NULL);
-#else
- // old style
- InteractorStyle->OnLeave(event.ControlDown(), event.ShiftDown(),
- event.GetX(), Size[1] - event.GetY() - 1);
-#endif
-}
-//---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::OnKeyDown(wxKeyEvent &event)
-{
- if (!Enabled)
- {
- return;
- }
-
-#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
- // new style
- int keycode = event.GetKeyCode();
- char key = '\0';
- if (((unsigned int)keycode) < 256)
- {
- // TODO: Unicode in non-Unicode mode ??
- key = (char)keycode;
- }
-
- // we don't get a valid mouse position inside the key event on every platform
- // so we retrieve the mouse position explicitly and pass it along
- wxPoint mousePos = ScreenToClient(wxGetMousePosition());
- SetEventInformationFlipY(mousePos.x, mousePos.y,
- event.ControlDown(), event.ShiftDown(), key, 0, NULL);
- InvokeEvent(vtkCommand::KeyPressEvent, NULL);
-#else
- InteractorStyle->OnKeyDown(event.ControlDown(), event.ShiftDown(),
- event.GetKeyCode(), 1);
-#endif
- event.Skip();
-}
-//---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::OnKeyUp(wxKeyEvent &event)
-{
- if (!Enabled)
- {
- return;
- }
-
-#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
- // new style
- int keycode = event.GetKeyCode();
- char key = '\0';
- if (((unsigned int)keycode) < 256)
- {
- // TODO: Unicode in non-Unicode mode ??
- key = (char)keycode;
- }
-
- // we don't get a valid mouse position inside the key event on every platform
- // so we retrieve the mouse position explicitly and pass it along
- wxPoint mousePos = ScreenToClient(wxGetMousePosition());
- SetEventInformationFlipY(mousePos.x, mousePos.y,
- event.ControlDown(), event.ShiftDown(), key, 0, NULL);
- InvokeEvent(vtkCommand::KeyReleaseEvent, NULL);
-#else
- InteractorStyle->OnKeyUp(event.ControlDown(), event.ShiftDown(),
- event.GetKeyCode(), 1);
-#endif
- event.Skip();
-}
-#endif //!(VTK_MAJOR_VERSION == 3 && VTK_MINOR_VERSION == 1)
- //---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::OnChar(wxKeyEvent &event)
-{
- if (!Enabled)
- {
- return;
- }
-
-#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
- // new style
- int keycode = event.GetKeyCode();
- char key = '\0';
- if (((unsigned int)keycode) < 256)
- {
- // TODO: Unicode in non-Unicode mode ??
- key = (char)keycode;
- }
-
- // we don't get a valid mouse position inside the key event on every platform
- // so we retrieve the mouse position explicitly and pass it along
- wxPoint mousePos = ScreenToClient(wxGetMousePosition());
- SetEventInformationFlipY(mousePos.x, mousePos.y,
- event.ControlDown(), event.ShiftDown(), key, 0, NULL);
- InvokeEvent(vtkCommand::CharEvent, NULL);
-#endif
- event.Skip();
-}
-//---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::OnButtonDown(wxMouseEvent &event)
-{
- if (!Enabled || (ActiveButton != wxEVT_NULL))
- {
- return;
- }
- ActiveButton = event.GetEventType();
-
- // On Mac (Carbon) and Windows we don't automatically get the focus when
- // you click inside the window
- // we therefore set the focus explicitly
- // Apparently we need that on linux (GTK) too:
- this->SetFocus();
-
-#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
- SetEventInformationFlipY(event.GetX(), event.GetY(),
- event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
-#endif
-
- if(event.RightDown())
- {
-#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
- // new style
- InvokeEvent(vtkCommand::RightButtonPressEvent, NULL);
-#else
- // old style
- InteractorStyle->OnRightButtonDown(event.ControlDown(), event.ShiftDown(),
- event.GetX(), Size[1] - event.GetY() - 1);
-#endif
- }
- else if(event.LeftDown())
- {
-#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
- // new style
- InvokeEvent(vtkCommand::LeftButtonPressEvent, NULL);
-#else
- // old style
- InteractorStyle->OnLeftButtonDown(event.ControlDown(), event.ShiftDown(),
- event.GetX(), Size[1] - event.GetY() - 1);
-#endif
- }
- else if(event.MiddleDown())
- {
-#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
- // new style
- InvokeEvent(vtkCommand::MiddleButtonPressEvent, NULL);
-#else
- // old style
- InteractorStyle->OnMiddleButtonDown(event.ControlDown(), event.ShiftDown(),
- event.GetX(), Size[1] - event.GetY() - 1);
-#endif
- }
- //save the button and capture mouse until the button is released
- //Only if :
- //1. it is possible (WX_USE_X_CAPTURE)
- //2. user decided to.
- if ((ActiveButton != wxEVT_NULL) && WX_USE_X_CAPTURE && UseCaptureMouse)
- {
- CaptureMouse();
- }
-}
-//---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::OnButtonUp(wxMouseEvent &event)
-{
- //EVT_xxx_DOWN == EVT_xxx_UP - 1
- //This is only needed if two mouse buttons are pressed at the same time.
- //In wxWindows 2.4 and later: better use of wxMOUSE_BTN_RIGHT or
- //wxEVT_COMMAND_RIGHT_CLICK
- if (!Enabled || (ActiveButton != (event.GetEventType()-1)))
- {
- return;
- }
-
- // See report by Shang Mu / Kerry Loux on wxVTK mailing list
- this->SetFocus();
-
-#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
- SetEventInformationFlipY(event.GetX(), event.GetY(),
- event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
-#endif
-
- if(ActiveButton == wxEVT_RIGHT_DOWN)
- {
-#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
- // new style
- InvokeEvent(vtkCommand::RightButtonReleaseEvent, NULL);
-#else
- // old style
- InteractorStyle->OnRightButtonUp(event.ControlDown(), event.ShiftDown(),
- event.GetX(), Size[1] - event.GetY() - 1);
-#endif
- }
- else if(ActiveButton == wxEVT_LEFT_DOWN)
- {
-#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
- // new style
- InvokeEvent(vtkCommand::LeftButtonReleaseEvent, NULL);
-#else
- // old style
- InteractorStyle->OnLeftButtonUp(event.ControlDown(), event.ShiftDown(),
- event.GetX(), Size[1] - event.GetY() - 1);
-#endif
- }
- else if(ActiveButton == wxEVT_MIDDLE_DOWN)
- {
-#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 0)
- // new style
- InvokeEvent(vtkCommand::MiddleButtonReleaseEvent, NULL);
-#else
- // old style
- InteractorStyle->OnMiddleButtonUp(event.ControlDown(), event.ShiftDown(),
- event.GetX(), Size[1] - event.GetY() - 1);
-#endif
- }
- //if the ActiveButton is realeased, then release mouse capture
- if ((ActiveButton != wxEVT_NULL) && WX_USE_X_CAPTURE && UseCaptureMouse)
- {
- ReleaseMouse();
- }
- ActiveButton = wxEVT_NULL;
-}
-//---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::OnMouseWheel(wxMouseEvent& event)
-{
-// Mouse wheel was only added after VTK 4.4 (I think...)
-#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 2)
- // new style
- //Set vtk event information ... The numebr of wheel rotations is stored in
- //the x varible. y varible is zero
- SetEventInformationFlipY(event.GetX() , event.GetY(),
- event.ControlDown(), event.ShiftDown(), '\0', 0, NULL);
- if(event.GetWheelRotation() > 0)
- {
- //Send event to VTK
- InvokeEvent(vtkCommand::MouseWheelForwardEvent, NULL);
- }
- else
- {
- //Send event to VTK
- InvokeEvent(vtkCommand::MouseWheelBackwardEvent, NULL);
- }
-#endif
-
-}
-
-//---------------------------------------------------------------------------
-#if wxCHECK_VERSION(2, 8, 0)
-void wxVTKRenderWindowInteractor::OnMouseCaptureLost(wxMouseCaptureLostEvent& event)
-{
- if (ActiveButton != wxEVT_NULL)
- {
- //Maybe also invoke the button release event here
- }
- // Reset ActiveButton so that
- // 1. we do not process mouse button up events any more,
- // 2. the next button down event will be processed and call CaptureMouse().
- // Otherwise ReleaseMouse() will be called
- // without a previous CaptureMouse().
- ActiveButton = wxEVT_NULL;
-}
-#endif
-
-//---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::Render()
-{
- RenderAllowed = 1;
- if (!RenderWhenDisabled)
- {
- //the user doesn't want us to render when the toplevel frame
- //is disabled - first find the top level parent
- wxWindow *topParent = wxGetTopLevelParent(this);
- if (topParent)
- {
- //if it exists, check whether it's enabled
- //if it's not enabeld, RenderAllowed will be false
- RenderAllowed = topParent->IsEnabled();
- }
- }
-
- if (RenderAllowed)
- {
- if(Handle && (Handle == GetHandleHack()) )
- {
- RenderWindow->Render();
- }
-#if VTK_MAJOR_VERSION > 4 || (VTK_MAJOR_VERSION == 4 && VTK_MINOR_VERSION > 2)
- else if(GetHandleHack())
- {
- //this means the user has reparented us; let's adapt to the
- //new situation by doing the WindowRemap dance
- //store the new situation
- Handle = GetHandleHack();
- RenderWindow->SetNextWindowId(reinterpret_cast<void *>(Handle));
- RenderWindow->WindowRemap();
- RenderWindow->Render();
- }
-#endif
- }
-}
-//---------------------------------------------------------------------------
-void wxVTKRenderWindowInteractor::SetRenderWhenDisabled(int newValue)
-{
- //Change value of __RenderWhenDisabled ivar.
- //If __RenderWhenDisabled is false (the default), this widget will not
- //call Render() on the RenderWindow if the top level frame (i.e. the
- //containing frame) has been disabled.
-
- //This prevents recursive rendering during wxSafeYield() calls.
- //wxSafeYield() can be called during the ProgressMethod() callback of
- //a VTK object to have progress bars and other GUI elements updated -
- //it does this by disabling all windows (disallowing user-input to
- //prevent re-entrancy of code) and then handling all outstanding
- //GUI events.
-
- //However, this often triggers an OnPaint() method for wxVTKRWIs,
- //resulting in a Render(), resulting in Update() being called whilst
- //still in progress.
-
- RenderWhenDisabled = (bool)newValue;
-}
-//---------------------------------------------------------------------------
-//
-// Set the variable that indicates that we want a stereo capable window
-// be created. This method can only be called before a window is realized.
-//
-void wxVTKRenderWindowInteractor::SetStereo(int capable)
-{
- if (Stereo != capable)
- {
- Stereo = capable;
- RenderWindow->StereoCapableWindowOn();
- RenderWindow->SetStereoTypeToCrystalEyes();
- Modified();
- }
-}
-
-//---------------------------------------------------------------------------
-//
-//
-void wxVTKRenderWindowInteractor::PrintSelf(ostream& os, vtkIndent indent)
-{
- this->Superclass::PrintSelf(os, indent);
-}
diff --git a/Utilities/wxWidgets/wxVTKRenderWindowInteractor.h b/Utilities/wxWidgets/wxVTKRenderWindowInteractor.h
deleted file mode 100644
index 0652395..0000000
--- a/Utilities/wxWidgets/wxVTKRenderWindowInteractor.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/*=========================================================================
-
- Program: Visualization Toolkit
- Module: $RCSfile: wxVTKRenderWindowInteractor.h,v $
- Language: C++
- Date: $Date: 2008/08/10 22:58:28 $
- Version: $Revision: 1.21 $
-
- Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
- All ri...
[truncated message content] |