PlusLib  2.9.0
Software library for tracked ultrasound image acquisition, calibration, and processing.
vtkPlusSequenceIO.cxx
Go to the documentation of this file.
1 /*=Plus=header=begin======================================================
2  Program: Plus
3  Copyright (c) Laboratory for Percutaneous Surgery. All rights reserved.
4  See License.txt for details.
5 =========================================================Plus=header=end*/
6 
7 #include "PlusConfigure.h"
8 #include "vtkPlusSequenceIO.h"
9 
10 #include <vtkIGSIOSequenceIO.h>
11 
13 #include <vtkNew.h>
14 
15 //----------------------------------------------------------------------------
16 igsioStatus vtkPlusSequenceIO::Write(const std::string& filename, vtkIGSIOTrackedFrameList* frameList, US_IMAGE_ORIENTATION orientationInFile/*=US_IMG_ORIENT_MF*/, bool useCompression/*=true*/, bool enableImageDataWrite/*=true*/)
17 {
18  std::string outputDirectory = "";
19  if (!vtksys::SystemTools::FileIsFullPath(filename))
20  {
21  outputDirectory = vtkPlusConfig::GetInstance()->GetOutputDirectory();
22  }
23  return vtkIGSIOSequenceIO::Write(filename, outputDirectory, frameList, orientationInFile, useCompression, enableImageDataWrite);
24 }
25 
26 //----------------------------------------------------------------------------
27 igsioStatus vtkPlusSequenceIO::Write(const std::string& filename, igsioTrackedFrame* frame, US_IMAGE_ORIENTATION orientationInFile /*= US_IMG_ORIENT_MF*/, bool useCompression /*= true*/, bool enableImageDataWrite /*=true*/)
28 {
29  std::string outputDirectory = "";
30  if (!vtksys::SystemTools::FileIsFullPath(filename))
31  {
32  outputDirectory = vtkPlusConfig::GetInstance()->GetOutputDirectory();
33  }
34  return vtkIGSIOSequenceIO::Write(filename, outputDirectory, frame, orientationInFile, useCompression, enableImageDataWrite);
35 }
36 
37 //----------------------------------------------------------------------------
38 igsioStatus vtkPlusSequenceIO::Read(const std::string& trackedSequenceDataFileName, vtkIGSIOTrackedFrameList* frameList)
39 {
40  std::string trackedSequenceDataFilePath = trackedSequenceDataFileName;
41 
42  // If file is not found in the current directory then try to find it in the image directory, too
43  if (!vtksys::SystemTools::FileExists(trackedSequenceDataFilePath.c_str(), true))
44  {
45  if (vtkPlusConfig::GetInstance()->FindImagePath(trackedSequenceDataFileName, trackedSequenceDataFilePath) == PLUS_FAIL)
46  {
47  LOG_ERROR("Cannot find sequence metafile: " << trackedSequenceDataFileName);
48  return PLUS_FAIL;
49  }
50  }
51  return vtkIGSIOSequenceIO::Read(trackedSequenceDataFilePath, frameList);
52 }
#define PLUS_FAIL
Definition: PlusCommon.h:43
static vtkPlusConfig * GetInstance()
static igsioStatus Write(const std::string &filename, igsioTrackedFrame *frame, US_IMAGE_ORIENTATION orientationInFile=US_IMG_ORIENT_MF, bool useCompression=true, bool EnableImageDataWrite=true)
PlusStatus FindImagePath(const std::string &aImagePath, std::string &aFoundAbsolutePath)
std::string GetOutputDirectory()
static igsioStatus Read(const std::string &filename, vtkIGSIOTrackedFrameList *frameList)