1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
/* Copyright (c) 2008-2022 the MRtrix3 contributors.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* Covered Software is provided under this License on an "as is"
* basis, without warranty of any kind, either expressed, implied, or
* statutory, including, without limitation, warranties that the
* Covered Software is free of defects, merchantable, fit for a
* particular purpose or non-infringing.
* See the Mozilla Public License v. 2.0 for more details.
*
* For more details, see http://www.mrtrix.org/.
*/
#include <memory>
#include "file/path.h"
#include "file/config.h"
#include "file/dicom/mapper.h"
#include "file/dicom/tree.h"
#include "formats/list.h"
#include "header.h"
#include "image_io/base.h"
namespace MR
{
namespace Formats
{
std::unique_ptr<ImageIO::Base> DICOM::read (Header& H) const
{
if (!Path::is_dir (H.name()))
if (!Path::has_suffix (H.name(), ".dcm"))
return std::unique_ptr<ImageIO::Base>();
File::Dicom::Tree dicom;
dicom.read (H.name());
dicom.sort();
auto series = File::Dicom::select_func (dicom);
if (series.empty())
throw Exception ("no DICOM series selected");
return dicom_to_mapper (H, series);
}
bool DICOM::check (Header& H, size_t num_axes) const
{
return false;
}
std::unique_ptr<ImageIO::Base> DICOM::create (Header& H) const
{
assert (0);
return std::unique_ptr<ImageIO::Base>();
}
}
}
|