X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FmaracasVisuLib%2Fsrc%2Finterface%2FwxWindows%2Fwidgets%2FimageUndoRedo%2FimageInfoUR.cxx;h=69c3811aceebfd4d63d639de64aa977187d2189e;hb=d725af03e25b41e03b212c26068be2c04dacd270;hp=b45e21d920915b8e27a58880380875b090ab85c2;hpb=8185e042f64574ca43bba733ec2158a2aa994220;p=creaMaracasVisu.git diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx index b45e21d..69c3811 100755 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/imageUndoRedo/imageInfoUR.cxx @@ -7,67 +7,76 @@ #include "imageInfoUR.h" ImageInfoUR::ImageInfoUR() { - this->m_Image = NULL; this->m_OnMemory = false; this->m_OnDisk = false; } ImageInfoUR::~ImageInfoUR() { - this->m_Image->Delete(); } -void ImageInfoUR::SetImageName(const std::string &imgName) { +void ImageInfoUR::SetImageName(const StringType &imgName) { this->m_ImageName = imgName; } -void ImageInfoUR::SetRegion(const RegionStructUR ®ion) { - this->m_Region = region; +void ImageInfoUR::SetImageMManager(ImageMManagerType* imMManager) { + this->m_ImageMManager = imMManager; } void ImageInfoUR::SetStatus(const bool& onMemory) { this->m_OnMemory = onMemory; } -void ImageInfoUR::SetImage(vtkImageData* img) { +void ImageInfoUR::SetImage(VTKImageDataPointerType img) { this->m_Image = img; this->SetStatus(true); } -std::string ImageInfoUR::GetImageName() { +ImageInfoUR::StringType ImageInfoUR::GetImageName() { return (this->m_ImageName); } -RegionStructUR ImageInfoUR::GetRegion() { - return (this->m_Region); + +ImageInfoUR::VTKImageDataPointerType ImageInfoUR::GetImage() { + return (this->m_Image); +} + +ImageInfoUR::ImageMManagerType* ImageInfoUR::GetImageMManager() { + return (this->m_ImageMManager); } bool ImageInfoUR::GetStatus() { return (this->m_OnMemory); } -void ImageInfoUR::RemoveImageFromMemory(const std::string& gPath) { +void ImageInfoUR::RemoveImageFromMemory(const StringType& gPath) { if (!this->m_OnDisk) { this->SaveImageAsMHD(gPath); } - this->m_Image->Delete(); + this->m_Image = NULL; this->SetStatus(false); } -void ImageInfoUR::LoadImageMHDToMemory(const std::string& gPath) { - std::string filename = gPath + this->m_ImageName; - vtkSmartPointer reader = vtkSmartPointer< - vtkMetaImageReader>::New(); +void ImageInfoUR::LoadImageMHDToMemory(const StringType& gPath) { + StringType filename = gPath + this->m_ImageName; + filename.append(".mhd"); + VTKMetaImageReaderPointerType reader = VTKMetaImageReaderPointerType::New(); reader->SetFileName(filename.c_str()); this->m_Image = reader->GetOutput(); + this->m_Image->Update(); this->m_OnMemory = true; } -void ImageInfoUR::SaveImageAsMHD(const std::string& gPath) { +void ImageInfoUR::SaveImageAsMHD(const StringType& gPath) { this->m_OnDisk = true; - std::string filename = gPath + this->m_ImageName; - vtkSmartPointer w = - vtkSmartPointer::New(); + StringType filename = gPath + this->m_ImageName; + filename.append(".mhd"); + //managing temporary files +//EED-11/11/2011 mkstemp((char*) filename.c_str()); + VTKMetaImageWriterPointerType w = VTKMetaImageWriterPointerType::New(); w->SetInput(this->m_Image); w->SetCompression(false); w->SetFileDimensionality(this->m_Image->GetDataDimension()); w->SetFileName(filename.c_str()); - w->Update(); w->Write(); - w->Delete(); } -void ImageInfoUR::RemoveImageFromDisk(const std::string& gPath) -{ - +void ImageInfoUR::RemoveImageFromDisk(const StringType& gPath) { + StringType filename = gPath + this->m_ImageName; + filename.append(".mhd"); + StringType filenameRaw = gPath + this->m_ImageName; + filenameRaw.append(".raw"); +//EED-11/11/2011 mkstemp((char*) filenameRaw.c_str()); + unlink((char*) filename.c_str()); + unlink((char*) filenameRaw.c_str()); }