Rotating a mapper with euler transform.

Hi guys!
im trying to apply euler 3d transformation matrix, to a mapper (a segmentation archive) that i have in dicom format. but when i apply the resampling filter, it seems to smootj the image instead of rotating it… here is my code…

class CommandIterationUpdate : public itk::Command
{
public:
    using Self = CommandIterationUpdate;
    using Superclass = itk::Command;
    using Pointer = itk::SmartPointer<Self>;
    itkNewMacro(Self);

protected:
    CommandIterationUpdate() = default;

public:
    using OptimizerType = itk::RegularStepGradientDescentOptimizerv4<double>;
    using OptimizerPointer = const OptimizerType*;
    void Execute(itk::Object* caller, const itk::EventObject& event) override
    {
        Execute((const itk::Object*)caller, event);
    }
    void Execute(const itk::Object* object, const itk::EventObject& event) override
    {
        auto optimizer = static_cast<OptimizerPointer>(object);
        if (!itk::IterationEvent().CheckEvent(&event))
        {
            return;
        }
        std::cout << optimizer->GetCurrentIteration() << "   ";
        std::cout << optimizer->GetValue() << "   ";
        std::cout << optimizer->GetCurrentPosition() << std::endl;
    }
};

int main(int argc, char* argv[])
{
    if (argc < 4)
    {
        std::cerr << "Missing Parameters " << std::endl;
        std::cerr << "Usage: " << argv[0];
        std::cerr << " fixedImageFile  movingImageFile ";
        std::cerr << " outputImagefile  [differenceBeforeRegistration] ";
        std::cerr << " [differenceAfterRegistration] ";
        std::cerr << " [sliceBeforeRegistration] ";
        std::cerr << " [sliceDifferenceBeforeRegistration] ";
        std::cerr << " [sliceDifferenceAfterRegistration] ";
        std::cerr << " [sliceAfterRegistration] " << std::endl;
        return EXIT_FAILURE;
    }
    constexpr unsigned int Dimension = 3;
    //using PixelType = float;
   // using ImageType = itk::Image<PixelType, Dimension>;
  //  using FixedImageType = itk::Image< PixelType, Dimension >;
    //using MovingImageType = itk::Image< PixelType, Dimension >;

    using ImageType2 = itk::Image<unsigned short, Dimension>;
    using ReaderType = itk::ImageFileReader <ImageType2>;
    ReaderType::Pointer reader = ReaderType::New();
    using ImageIOType = itk::GDCMImageIO;
    ImageIOType::Pointer dicomIO = ImageIOType::New();
    reader->SetFileName(argv[4]);
    reader->SetImageIO(dicomIO);
    reader->Update();

 using WritePixelType = unsigned short;
    using WriteImageType = itk::Image< WritePixelType, 3 >;
    using WriterType = itk::ImageFileWriter< WriteImageType >;
    using ResampleFilterType2 = itk::ResampleImageFilter<ImageType2, ImageType2>;
    ResampleFilterType2::Pointer resampleFilter = ResampleFilterType2::New();
    using TransformType2 = itk::Euler3DTransform <double>;
    TransformType2::Pointer euler = TransformType2::New();
    TransformType2::ParametersType eulerParameters(6);
    eulerParameters[0] = -0.000386475;
    eulerParameters[1] = -0.00429389;
    eulerParameters[2] = -  0.00356576;
    eulerParameters[3] = -0.223939;
    eulerParameters[4] = 0.0744373;
    eulerParameters[5] = 0.0441257;
    euler->SetParameters(eulerParameters);
    resampleFilter->SetTransform(euler);
    resampleFilter->SetInput(reader->GetOutput());
    ImageType2::RegionType region = reader->GetOutput()->GetLargestPossibleRegion();
    ImageType2::SizeType size=region.GetSize();
    resampleFilter->SetSize(size);
    WriterType::Pointer  writer2 = WriterType::New();
    writer2->SetFileName(argv[5]);
    writer2->SetInput(resampleFilter->GetOutput());
    
    writer2->Update();
    return EXIT_SUCCESS;
}

Shouldn’t this be argv[1]?

Removing unused code (Command class, wrong usage info, commented code) would make it easier to spot an error.

it is a part of the code, argv[0-3] are already being used.

Then this part does not match the rest of the code.

It looks like you have a bug somewhere in your code, but probably not in the part you shared earlier. For someone to debug it, it needs to be short and self contained. If it needs a special image, include it too.