File: NiftiOutputterBase.cpp

package info (click to toggle)
mriconvert 1%3A2.1.0-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,488 kB
  • sloc: cpp: 17,029; makefile: 11
file content (57 lines) | stat: -rw-r----- 1,117 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/// NiftiOutputterBase.cpp
/**
*/

#include "NiftiOutputterBase.h"
#include "NiftiVolume.h"

using namespace jcs;

NiftiOutputterBase::NiftiOutputterBase(const Options& options) : 
Basic3DOutputter(options)
{
  saveNii = (rawExtension == _T("")) ? true : false;
}


///
/*
*/
BasicVolumeFormat* 
NiftiOutputterBase::GetOutputVolume(const char* file)
{
  return new NiftiVolume(file, headerExtension.mb_str(wxConvLocal), rawExtension.mb_str(wxConvLocal));
}


///
/**
*/
void
NiftiOutputterBase::SetSaveNii(bool value)
{
  saveNii = value;
  if (saveNii) {
    headerExtension = _T("nii");
    rawExtension = _T("");
  }
  else {
    headerExtension = _T("hdr");
    rawExtension = _T("img");
  }
}


/// Sets a boolean option.
/** Calls parent SetOption and sets "nii" option.
    \param name The name of the option.
    \param value The new value of the option.
*/
void
NiftiOutputterBase::SetOption(const std::string& name, bool value)
{
  Basic3DOutputter::SetOption(name, value);
  if (name.find("nii") != std::string::npos) {
    SetSaveNii(value);
  }
}