]> Creatis software - clitk.git/commitdiff
Implemented like option, only the origin is missing
authorsrit <srit>
Wed, 8 Sep 2010 17:48:56 +0000 (17:48 +0000)
committersrit <srit>
Wed, 8 Sep 2010 17:48:56 +0000 (17:48 +0000)
tools/clitkResampleImageGenericFilter.txx

index e1c2d43497c7a68a1cd1ff1e19814525fcd050cb..e05770e0cb6ca5d801762f3c7e80ca1d76c2c103 100644 (file)
@@ -51,8 +51,19 @@ clitk::ResampleImageGenericFilter::UpdateWithInputImageType()
   typename OutputImageType::SizeType size;
 
   if (mArgsInfo.like_given) {
-    DD("like");
-    
+    itk::ImageIOBase::Pointer header = clitk::readImageHeader(mArgsInfo.like_arg);
+    if (header) {
+      for(unsigned int i=0; i<dim; i++){
+        spacing[i] = header->GetSpacing(i);
+        size[i] = header->GetDimensions(i);
+      }
+      filter->SetOutputSpacing(spacing);
+      filter->SetOutputSize(size);
+    }
+    else {
+      std::cerr << "*** Warning : I could not read '" << mArgsInfo.like_arg << "' ***" << std::endl;
+      exit(0);
+    }
   }
   else {
     if (mArgsInfo.spacing_given == 1) {