File: NiftiOutputter.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 (90 lines) | stat: -rw-r----- 1,792 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/// NiftiOutputter.cpp
/**
*/

#include "NiftiOutputter.h"

using namespace jcs;


///
/*
*/
NiftiOutputter::NiftiOutputter() : 
NiftiOutputterBase(CreateOptions())
{
}


///
/*
*/
NiftiOutputter::~NiftiOutputter()
{
}


///
/*
*/
Options
NiftiOutputter::CreateOptions()
{
  Options options = Get3DOptions();
  options.pathname = "Nifti";
  return options;
}


///
/* Checks data type (BitsAllocated and PixelRepresentation) 
    and creates a *Conversion instance. Runs the Convert
    method of that instance.
    \param handler The SeriesHandler instance for the data.
    \return 1
*/
int
NiftiOutputter::ConvertSeries(SeriesHandler* handler)
{
  int bits_allocated, pixel_rep = 0;
  handler->Find("BitsAllocated", bits_allocated);
  handler->Find("PixelRepresentation", pixel_rep);

  switch (bits_allocated + pixel_rep) {

  case 8 : {
      NiftiConversion<wxUint8> conversion(this, handler);
      conversion.Convert();
      break;
    }
  case 9 : {
      NiftiConversion<wxInt8> conversion(this, handler);
      conversion.Convert();
      break;
    }
  case 16 : {
      NiftiConversion<wxUint16> conversion(this, handler);
      conversion.Convert();
      break;
    }
  case 17 : {
      NiftiConversion<wxInt16> conversion(this, handler);
      conversion.Convert();
      break;
    }
  case 32 : {
      NiftiConversion<wxUint32> conversion(this, handler);
      conversion.Convert();
      break;
    }
  case 33 : {
      NiftiConversion<wxInt32> conversion(this, handler);
      conversion.Convert();
      break;
    }
  default : {
      wxLogMessage(_("BitsAllocated and PixelRepresentation values (%d, %d) not supported."), bits_allocated, pixel_rep);
    }
  }
  return 1;
}