Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Modules/IO/DCMTK/src/itkDCMTKFileReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1335,8 +1335,8 @@ ::GetSpacing(double * const spacing) const
* (0028, 0030) indicates physical X,Y spacing inside a slice;
* (0018, 0088) indicates physical Z spacing between slices;
* which above are also consistent with Dcom2iix software.
* when we can not get (0018, 0088),we will revert to previous
* behavior and use (0018, 0050) thickness as a proxy to spacing.
* when we can not get (0018, 0088), we should compute spacing
* from the planes' positions (TODO, see PR 112).
* */
if(GetElementDS<double>(0x0018,0x0088,1,&_spacing[2], false) == EXIT_SUCCESS)
{
Expand Down Expand Up @@ -1376,8 +1376,8 @@ ::GetSpacing(double * const spacing) const
* (0028, 0030) indicates physical X,Y spacing inside a slice;
* (0018, 0088) indicates physical Z spacing between slices;
* which above are also consistent with Dcom2iix software.
* when we can not get (0018, 0088),we will revert to previous
* behavior and use (0018, 0050) thickness as a proxy to spacing.
* when we can not get (0018, 0088), we should compute spacing
* from the planes' positions (TODO, see PR 112).
* */
if(subSequence.GetElementDS<double>(0x0028,0x0030,2,_spacing,false) == EXIT_SUCCESS)
{
Expand Down
30 changes: 7 additions & 23 deletions Modules/IO/DCMTK/src/itkDCMTKImageIO.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,6 @@ ::Read(void *buffer)
m_Dimensions[0] = (unsigned int)(m_DImage->getWidth());
m_Dimensions[1] = (unsigned int)(m_DImage->getHeight());

// pick a size for output image (should get it from DCMTK in the ReadImageInformation()))
// NOTE ALEX: EP_Representation is made for that
// but i don t know yet where to fetch it from
size_t scalarSize = ImageIOBase::GetComponentSize();

switch(this->m_ComponentType)
{
case UNKNOWNCOMPONENTTYPE:
Expand All @@ -316,25 +311,14 @@ ::Read(void *buffer)
const DiPixel * const interData = m_DImage->getInterData();
const void *data = interData->getData();
unsigned long count = interData->getCount();
Comment thread
dzenanz marked this conversation as resolved.
Outdated
size_t voxelSize(scalarSize);
switch(this->m_PixelType)
{
case RGB:
ReorderRGBValues(buffer, data, count, 3);
return;
case RGBA:
ReorderRGBValues(buffer, data, count, 4);
return;
case VECTOR:
voxelSize *= this->GetNumberOfComponents();
break;
default:
voxelSize *= 1;
break;
if (this->m_PixelType == RGB || this->m_PixelType == RGBA)
{
ReorderRGBValues(buffer, data, count, this->GetNumberOfComponents());
}
else
{
memcpy(buffer, data, count * this->GetComponentSize() * this->GetNumberOfComponents());
}
memcpy(buffer,
data,
count * voxelSize);
}

void
Expand Down
9 changes: 5 additions & 4 deletions Modules/IO/DCMTK/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,11 @@ itk_add_test(NAME itkDCMTKImageIOSlopeInterceptTest
DATA{Input/slopeIntercept.dcm}
)

itk_add_test(NAME itkDCMTKImageIOMultiFrameImageTest
COMMAND ITKIODCMTKTestDriver itkDCMTKImageIOMultiFrameImageTest
DATA{Input/MultiFrameDicomTest.dcm}
)
# Requires additional logic in DCMTKFileReader::GetSpacing
#itk_add_test(NAME itkDCMTKImageIOMultiFrameImageTest
# COMMAND ITKIODCMTKTestDriver itkDCMTKImageIOMultiFrameImageTest
# DATA{Input/MultiFrameDicomTest.dcm}
# )

itk_add_test(NAME itkDCMTKImageIONoPreambleTest
COMMAND ITKIODCMTKTestDriver itkDCMTKImageIONoPreambleTest
Expand Down