How to transfer an image buffer to matlab image matrix

channel sequence from rgbrgbrgb…rgb to rrr…rggg…gbbb…b is called convert from HWC to CHW ryt,
what if i want to do this in pure itk,
i use VectorIndexSelectionCastImageFilter first, then compose them by ComposeImageFilter like this post said, will i get a CHW image, or get the same HWC image just like split the channels before

// PixelType comes from completeMontage template 
// template <unsigned Dimension,
//          typename PixelType,
//          typename AccumulatePixelType>
using ScalarPixelType = typename itk::NumericTraits<PixelType>::ValueType;
using ScalarImageType = itk::Image<ScalarPixelType, Dimension>;
using OriginalImageType = itk::Image<PixelType, Dimension>;
using ImageAdaptorType = itk::VectorIndexSelectionCastImageFilter<OriginalImageType, ScalarImageType>;
using ComposeType = itk::ComposeImageFilter<ScalarImageType, OriginalImageType>;
typename ImageAdaptorType::Pointer  cAdaptor = ImageAdaptorType::New();
cAdaptor->SetInput(resampleF->GetOutput());

std::vector<typename ScalarImageType::Pointer> zImages(PixelType::Length);
for (unsigned c = 0; c < PixelType::Length; c++)
{
  cAdaptor->SetIndex(c);
  zImages[c] = cAdaptor->GetOutput();
  zImages[c]->DisconnectPipeline();
}

// compose an RGB(A) image from the filtered component images
typename ComposeType::Pointer compose = ComposeType::New();
for (unsigned c = 0; c < PixelType::Length; c++)
{
  compose->SetInput(c, zImages[c]);
}
compose->Update();