Skip to content

Commit

Permalink
Merge pull request #276 from kerautret/FixITK2vol
Browse files Browse the repository at this point in the history
fix itk2vol tools when reading int values
  • Loading branch information
dcoeurjo committed Oct 21, 2016
2 parents 638c60d + bb89533 commit ebd566e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
7 changes: 7 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# DGtalTools 0.9.3

- *converters*:
- fix tool itk2vol which was not able to read and convert int type image.
(Bertrand Kerautret, [#276](https://github.com/DGtal-team/DGtalTools/pull/271))


# DGtalTools 0.9.2

- *global*:
Expand Down
16 changes: 9 additions & 7 deletions converters/itk2vol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ namespace po = boost::program_options;

int main( int argc, char** argv )
{
typedef ImageContainerBySTLVector < Z3i::Domain, unsigned char > Image3D;

typedef ImageContainerBySTLVector < Z3i::Domain, unsigned char > Image3DChar;
typedef ImageContainerBySTLVector < Z3i::Domain, int > Image3D;

// parse command line ----------------------------------------------
po::options_description general_opt("Allowed options are ");
Expand Down Expand Up @@ -103,7 +103,7 @@ int main( int argc, char** argv )
<< "Converts itk file into a volumetric file (.vol, .pgm3d). "
<< general_opt << "\n";
std::cout << "Example:\n"
<< "itk2vol -i image.mhd --dicomMin -500 --dicomMax -100 -o sample.vol \n";
<< "itk2vol -i image.mhd --inputMin -500 --inputMax -100 -o sample.vol \n";
return 0;
}

Expand All @@ -121,12 +121,14 @@ int main( int argc, char** argv )
typedef DGtal::functors::Rescaling<int ,unsigned char > RescalFCT;

trace.info() << "Reading input input file " << inputFilename ;
Image3D inputImage = ITKReader< Image3D, RescalFCT >::importITK(inputFilename,
RescalFCT(inputMin,
inputMax, 0, 255) );
Image3D inputImage = ITKReader< Image3D >::importITK(inputFilename);
trace.info() << " [done] " << std::endl ;
trace.info() << " converting into vol file... " ;
inputImage >> outputFilename;
RescalFCT rescaleCustom(inputMin, inputMax, 0, 255);

DGtal::GenericWriter<Image3D, 3, unsigned char, RescalFCT>::exportFile(outputFilename, inputImage, "UInt8Array3D", rescaleCustom);


trace.info() << " [done] " << std::endl ;


Expand Down

0 comments on commit ebd566e

Please sign in to comment.