Skip to content

Commit 199c910

Browse files
committed
fixing the problem of dicom display in some viewers
1 parent b2f310b commit 199c910

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

app/Tomato.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace Ox {
4545
public:
4646
// typedefs primitive data types
4747
typedef MeasureType InputPixelType;
48-
typedef int OutputPixelType;
48+
typedef int16_t OutputPixelType; // int does not work with some dicom viewers, be sure to use short (int16)
4949

5050
// typedefs image data types
5151
typedef itk::Image<InputPixelType, 3> ImageType3D;

app/Tomato_export.hxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@
1212

1313
namespace Ox {
1414

15+
template< typename IType, typename EType >
1516
class CastPixelAccessor
1617
{
1718
public:
18-
typedef double InternalType;
19-
typedef int ExternalType;
19+
20+
typedef IType InternalType;
21+
typedef EType ExternalType;
2022

2123
static void Set(InternalType & output, const ExternalType & input)
2224
{
@@ -276,7 +278,7 @@ namespace Ox {
276278
gdcmImageIO->KeepOriginalUIDOn();
277279

278280
// to cast
279-
typedef itk::AdaptImageFilter<ImageType2D, OutputImageType, CastPixelAccessor> ImageAdaptorType;
281+
typedef itk::AdaptImageFilter < ImageType2D, OutputImageType, CastPixelAccessor< InputPixelType, OutputPixelType > > ImageAdaptorType;
280282
typename ImageAdaptorType::Pointer adaptor = ImageAdaptorType::New();
281283

282284
// get the writer ready before export

tests/Tomato_sameAsShmolli_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ TEST(Tomato, sameAsShmolli) {
2121
bool doVisualise = false; //for debugging
2222

2323
// primitive data types
24-
typedef int PixelType;
24+
typedef int16_t PixelType;
2525

2626
// image data types
2727
typedef itk::Image< PixelType, 2 > ImageType2D;

0 commit comments

Comments
 (0)