Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
21 changes: 21 additions & 0 deletions common/vvImageReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,27 @@ void vvImageReader::Update(LoadedImageType type)
//------------------------------------------------------------------------------


//------------------------------------------------------------------------------
void vvImageReader::Update(std::string inputPixelType, LoadedImageType type)
{
itk::ImageIOBase::Pointer reader = itk::ImageIOFactory::CreateImageIO(mInputFilenames[0].c_str(), itk::ImageIOFactory::ReadMode);
if (!reader) {
mLastError="Unable to read file.";
} else {
reader->SetFileName(mInputFilenames[0]);
gdcm::ImageHelper::SetForcePixelSpacing(true);
reader->ReadImageInformation();
if (mInputFilenames.size() > 1)
Update(reader->GetNumberOfDimensions()+1,inputPixelType, type);
else if (reader->GetNumberOfComponents() > 1 && type != VECTORFIELD && type != VECTORFIELDWITHTIME)
Update(reader->GetNumberOfDimensions()+1,inputPixelType,VECTORPIXELIMAGE);
else
Update(reader->GetNumberOfDimensions(),inputPixelType, type);
}
}
//------------------------------------------------------------------------------


//------------------------------------------------------------------------------
void vvImageReader::Update(int dim,std::string inputPixelType, LoadedImageType type)
{
Expand Down
1 change: 1 addition & 0 deletions common/vvImageReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class vvImageReader : public itk::LightObject {
// Main function
void Update();
void Update(LoadedImageType type);
void Update(std::string inputPixelType, LoadedImageType type);
void Update(int dim, std::string InputPixelType, LoadedImageType type);

protected:
Expand Down
6 changes: 5 additions & 1 deletion tools/clitkDicom2Image.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,11 @@ int main(int argc, char * argv[])
vvImageReader::Pointer reader = vvImageReader::New();
reader->SetInputFilenames(sorted_files);
reader->SetPatientCoordinateSystem(args_info.patientSystem_flag);
reader->Update(vvImageReader::DICOM);
if (args_info.setDouble_flag) {
reader->Update("double", vvImageReader::DICOM);
} else {
reader->Update(vvImageReader::DICOM);
}
if (reader->GetLastError().size() != 0) {
std::cerr << reader->GetLastError() << std::endl;
return 1;
Expand Down
1 change: 1 addition & 0 deletions tools/clitkDicom2Image.ggo
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ option "focal_origin" - "Output files with FOCAL-like origin, instead of the o
option "patientSystem" p "Open the image with patient coordinate system" flag off
option "instanceNumber" n "Sort the images regarding instance number in dicom tag" flag off
option "reverse" r "Reverse the slice order" flag off
option "setDouble" d "Read input (and save output) as double pixel type" flag off