1 // VISU OBJECT : interactive object for VISU entities implementation
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File: VISU_img2vti.cxx
24 // Author: Oleg UVAROV
27 #include <vtkImageData.h>
28 #include <vtkBMPReader.h>
29 #include <vtkPNGReader.h>
30 #include <vtkJPEGReader.h>
31 #include <vtkXMLImageDataWriter.h>
34 static int MYDEBUG = 0;
36 static int MYDEBUG = 0;
39 int main( int argc, char** argv )
41 if(MYDEBUG) std::cout << "Converting the image to VTI format" << std::endl;
45 std::cout << "Usage : VISU_img2vti ImageFormat InputFileName OutputFileName" << std::endl;
50 std::cout << argv[1] << std::endl;
51 std::cout << argv[2] << std::endl;
52 std::cout << argv[3] << std::endl;
55 vtkImageReader2* aReader = NULL;
56 if( !strcmp( argv[1], "BMP" ) || !strcmp( argv[1], "bmp" ) )
58 if(MYDEBUG) std::cout << "Input image format - BMP" << std::endl;
59 aReader = vtkBMPReader::New();
61 else if( !strcmp( argv[1], "PNG" ) || !strcmp( argv[1], "png" ) )
63 if(MYDEBUG) std::cout << "Input image format - PNG" << std::endl;
64 aReader = vtkPNGReader::New();
66 else if( !strcmp( argv[1], "JPG" ) || !strcmp( argv[1], "jpg" ) )
68 if(MYDEBUG) std::cout << "Input image format - JPG" << std::endl;
69 aReader = vtkJPEGReader::New();
73 std::cout << "Unknown input image format... Must be BMP, PNG or JPG." << std::endl;
76 aReader->SetFileName( argv[2] );
79 vtkXMLImageDataWriter* aWriter = vtkXMLImageDataWriter::New();
80 aWriter->SetInput( aReader->GetOutput() );
81 aWriter->SetFileName( argv[3] );