From: srit Date: Mon, 25 Oct 2010 16:21:29 +0000 (+0000) Subject: Removed vc2010 warnings X-Git-Tag: v1.2.0~307 X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=4d98c6119c03a33d32830d6c13707600a047a32c;p=clitk.git Removed vc2010 warnings --- diff --git a/vv/vvImageReader.cxx b/vv/vvImageReader.cxx index 8bbdf25..1f33fc7 100644 --- a/vv/vvImageReader.cxx +++ b/vv/vvImageReader.cxx @@ -124,28 +124,34 @@ void vvImageReader::SetInputFilenames(const std::vector & filenames //Read transformation in NKI format (Xdr, transposed, cm) void vvImageReader::ReadNkiImageTransform() { - bool bRead=true; - typedef itk::ImageFileReader< itk::Image< double, 2 > > MatrixReaderType; - MatrixReaderType::Pointer readerTransfo = MatrixReaderType::New(); - readerTransfo->SetFileName(mInputFilenames[0]+".MACHINEORIENTATION"); - try { - readerTransfo->Update(); - } catch( itk::ExceptionObject & err ) { - bRead=false; - } - - if (bRead) { - //Transpose matrix (NKI format) - for(int j=0; j<4; j++) - for(int i=0; i<4; i++) - mImage->GetTransform()->GetMatrix()->SetElement(j,i,readerTransfo->GetOutput()->GetBufferPointer()[4*i+j]); - - //From cm to mm - for(int i=0; i<3; i++) - mImage->GetTransform()->GetMatrix()->SetElement(i,3,10*mImage->GetTransform()->GetMatrix()->GetElement(i,3)); - - mImage->GetTransform()->Inverse(); - mImage->UpdateReslice(); + bool bRead=false; + std::string filename = mInputFilenames[0]+".MACHINEORIENTATION"; + if(itksys::SystemTools::FileExists(filename.c_str())){ + typedef itk::ImageFileReader< itk::Image< double, 2 > > MatrixReaderType; + MatrixReaderType::Pointer readerTransfo = MatrixReaderType::New(); + readerTransfo->SetFileName(filename); + try { + bRead = true; + readerTransfo->Update(); + } catch( itk::ExceptionObject & err ) { + bRead=false; + std::cerr << "Cannot read " << filename << std::endl + << "The error is: " << err << std::endl; + } + + if (bRead) { + //Transpose matrix (NKI format) + for(int j=0; j<4; j++) + for(int i=0; i<4; i++) + mImage->GetTransform()->GetMatrix()->SetElement(j,i,readerTransfo->GetOutput()->GetBufferPointer()[4*i+j]); + + //From cm to mm + for(int i=0; i<3; i++) + mImage->GetTransform()->GetMatrix()->SetElement(i,3,10*mImage->GetTransform()->GetMatrix()->GetElement(i,3)); + + mImage->GetTransform()->Inverse(); + mImage->UpdateReslice(); + } } } //------------------------------------------------------------------------------ diff --git a/vv/vvLabelImageLoaderWidget.cxx b/vv/vvLabelImageLoaderWidget.cxx index 96636fa..482d86b 100644 --- a/vv/vvLabelImageLoaderWidget.cxx +++ b/vv/vvLabelImageLoaderWidget.cxx @@ -114,7 +114,8 @@ void vvLabelImageLoaderWidget::OpenImage() m_Output->AddItkImage( reader->GetOutput() ); } catch ( itk::ExceptionObject & err ) { - std::cerr << "Error while reading " << filename.toStdString() << std::endl; + std::cerr << "Error while reading " << filename.toStdString() << std::endl + << "The error is " << err << std::endl; QString error; error = QString("Cannot open file %1\n").arg(filename); QMessageBox::information(this,tr("Reading problem"),error); diff --git a/vv/vvLandmarks.h b/vv/vvLandmarks.h index 7204452..eecf312 100644 --- a/vv/vvLandmarks.h +++ b/vv/vvLandmarks.h @@ -47,9 +47,7 @@ public : float* GetCoordinates(int index); double GetPixelValue(int index); std::string GetComments(int index); - int GetNumberOfPoints() { - return mLandmarks.size(); - } + unsigned int GetNumberOfPoints() { return (unsigned int) mLandmarks.size(); } //int GetNumberOfSources(){return mText.size();} vtkPolyData* GetOutput() { diff --git a/vv/vvMesh.h b/vv/vvMesh.h index 9e4d16c..27546d9 100644 --- a/vv/vvMesh.h +++ b/vv/vvMesh.h @@ -47,12 +47,12 @@ public: void AddMesh(vtkPolyData* p); ///Removes all meshes in the object void RemoveMeshes(); - unsigned int GetNumberOfMeshes() { return meshes.size(); } + unsigned int GetNumberOfMeshes() { return (unsigned int)meshes.size(); } vtkImageData* GetMask(unsigned int i) const {return masks[i];} void AddMask(vtkImageData* im); void RemoveMasks(); - unsigned int GetNumberOfMasks() { return masks.size(); } + unsigned int GetNumberOfMasks() { return (unsigned int)masks.size(); } ///Pretty-print information about the mesh void Print() const; diff --git a/vv/vvSlicer.h b/vv/vvSlicer.h index 3ccf8ef..d4ac4dc 100644 --- a/vv/vvSlicer.h +++ b/vv/vvSlicer.h @@ -97,7 +97,7 @@ public: ///Reimplemented from vtkImageViewer2 to add polydata support void SetSlice(int s); int GetTMax() { - return mImage->GetVTKImages().size() - 1; + return (unsigned int)mImage->GetVTKImages().size() - 1; } void SetOpacity(double s); diff --git a/vv/vvSurfaceViewerDialog.cxx b/vv/vvSurfaceViewerDialog.cxx index d39ad25..638e8f2 100644 --- a/vv/vvSurfaceViewerDialog.cxx +++ b/vv/vvSurfaceViewerDialog.cxx @@ -149,7 +149,7 @@ void vvSurfaceViewerDialog::PreviousTime() { mCurrentTime--; if (mCurrentTime < 0) - mCurrentTime = mReaders.size() - 1; + mCurrentTime = (unsigned int) mReaders.size() - 1; mMapper->SetInput(mReaders[mCurrentTime]->GetOutput()); mMapper->Modified(); renderWidget->GetRenderWindow()->Render();