File: FslNiftiOutputter.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 (94 lines) | stat: -rwxr-x--- 1,944 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
91
92
93
94
/// FslNiftiOutputter.cpp
/**
 */

#include <string>
#include <vector>

#include "SeriesHandler.h"
#include "NiftiOutputterBase.h"
#include "FslNiftiOutputter.h"

using namespace jcs;

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


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


///
/**
 */
void
FslNiftiOutputter::UpdateOutputForSeries(SeriesHandler* handler)
{
  Basic3DOutputter::UpdateOutputForSeries(handler);
}


///
/** Perform the conversion on the given series.
 *    \param handler A pointer to a SeriesHandler.
 *    \return Status code.
 */
int
FslNiftiOutputter::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 : {
      FslNiftiConversion<wxUint8> conversion(this, handler);
      conversion.Convert();
      break;
    }
    case 9 : {
      FslNiftiConversion<wxInt8> conversion(this, handler);
      conversion.Convert();
      break;
    }
    case 16 : {
      FslNiftiConversion<wxUint16> conversion(this, handler);
      conversion.Convert();
      break;
    }
    case 17 : {
      FslNiftiConversion<wxInt16> conversion(this, handler);
      conversion.Convert();
      break;
    }
    case 32 : {
      FslNiftiConversion<wxUint32> conversion(this, handler);
      conversion.Convert();
      break;
    }
    case 33 : {
      FslNiftiConversion<wxInt32> conversion(this, handler);
      conversion.Convert();
      break;
    }
    default : {
      wxLogMessage(_("BitsAllocated and PixelRepresentation values (%d, %d) not supported."), bits_allocated, pixel_rep);
    }
  }
  return 1;
}