예제 #1
0
bool Reader::Read_ICL_NUIM_RGB(QImage & ref, Matrix3D & Rref, Vector3D & tref, const int refn,
                               QVector<QImage> & src, QVector<Matrix3D> & Rsrc, QVector<Vector3D> & tsrc, const QVector<int> & srcn,
                               Matrix3D & K, const QString & directory, const QString & fname, const QString & format, const int digits)
{
    // get image name strings
    QString impos;
    QString imname = ImageName(impos, refn, digits, directory, fname, format);

    // initialize variables for camera parameters
    Vector3D cam_pos, cam_dir, cam_up, cam_lookat,cam_sky, cam_right, cam_fpoint;
    double cam_angle;

    // get camera parameters
    if (!getcamParameters(impos, cam_pos, cam_dir, cam_up, cam_lookat,cam_sky, cam_right, cam_fpoint, cam_angle)) return false;
    getcamK(K, cam_dir, cam_up, cam_right);

    computeRT(Rref, tref, cam_dir, cam_pos, cam_up);

    if (!ref.load(imname)) return false;

    int nsrc = srcn.size();

    // load source views
    int half = (nsrc + 1) / 2;
    int offset;
    int loaded = 0;
    src.resize(nsrc);
    Rsrc.resize(nsrc);
    tsrc.resize(nsrc);

    for (int i = 0; i < nsrc; i++){
        if (i < half) offset = i + 1;
        else offset = half - i - 1;
        imname = ImageName(impos, srcn[loaded], digits, directory, fname, format);
        if (getcamParameters(impos, cam_pos, cam_dir, cam_up, cam_lookat,cam_sky, cam_right, cam_fpoint, cam_angle)){
            computeRT(Rsrc[loaded], tsrc[loaded], cam_dir, cam_pos, cam_up);
            if (src[loaded].load(imname)) loaded++;
        }
    }

    src.resize(loaded);
    Rsrc.resize(loaded);
    tsrc.resize(loaded);

    return true;
}
예제 #2
0
bool Reader::Read_ICL_NUIM_depth(QImage & depth, const int number, const QString & directory,
                                 const QString &fname, const QString &format, const int digits)
{
    QString impos;
    ImageName(impos, number, digits, directory, fname, format);
    QString dp = impos;
    int dot = dp.lastIndexOf('.');
    if (dot != -1) dp.truncate(dot);
    dp += ".depth";
    return depth.load(dp);
}
예제 #3
0
bool RenameDICOMToDir(QString FileName, QString ToDir)
{
    std::string person, sequence, imagename;
    {
        image::io::dicom header;
        if (!header.load_from_file(FileName.toLocal8Bit().begin()))
            return false;

        header.get_patient(person);
        header.get_sequence(sequence);
        header.get_image_name(imagename);
    }
    check_name(person);
    check_name(sequence);
    check_name(imagename);

    QString Person(person.c_str()), Sequence(sequence.c_str()),
    ImageName(imagename.c_str());

    ToDir += "/";
    ToDir += Person;
    if (!QDir(ToDir).exists())
    {
        if(!QDir(ToDir).mkdir(ToDir))
        {
            std::cout << "Cannot create dir " << ToDir.toStdString() << std::endl;
            return false;
        }
    }


    ToDir += "/";
    ToDir += Sequence;
    if (!QDir(ToDir).exists())
    {
        if(!QDir(ToDir).mkdir(ToDir))
        {
            std::cout << "Cannot create dir " << ToDir.toStdString() << std::endl;
            return false;
        }
    }

    ToDir += "/";
    ToDir += ImageName;
    std::cout << FileName.toStdString() << "->" << ToDir.toStdString() << std::endl;
    return QFile(FileName).rename(FileName,ToDir);
}
예제 #4
0
EnumName Image::getName()
{
	return ImageName( (EnumName::Name)this->imageName );
}