else if (mExtent[0]>1) mDim=1;
else mDim=0;
}
-
///Clears the extent
void Clear() { mExtent[0] = mExtent[1] = mExtent[2] = mExtent[3] = 1; }
// Anciently started the threads ...
// Threads now automatically start at first image request
//mReader.Start();
-
}
//======================================================================
}
-
//======================================================================
//======================================================================
""));
if(mImageExtent==0)
{
- mImageExtent=ie;
+ mImageExtent=ie;
if((mImageExtent->Get(min_dim-1)<2)||(mImageExtent->Get(max_dim)>1))
{
valid=false;
}
}
else
- {
+ {
if(mImageExtent->IsCompatible(*ie))
{
if(mImageExtent->GetDimension()==max_dim && mImageExtent->Get(max_dim)>2)
}
else if (im.size()>1) // Test inutile ? JPR
{
+ // Read the FIRST image to get info ... about all the other ones. ?!? // JPR
vtkImageData* first = mReader.GetImage( im.front());
+
if (dimension == 2)
{
// n3D
s.push_back(out);
}
}
- else
+ else if (dimension == 3)
{
- // n*2D to 3D
+ // n*2D to 3D :: --> NON ! Ca va tres bien pour du 2D+T (le ZSpacing, on s'en tape)
+ // // ne convient pas pour du n*2D a lire comme un 3D
+ // // Il faut un gdcmSerieHelper !
vtkImageData* out = vtkImageData::New();
out->CopyStructure(first);
out->SetScalarType(first->GetScalarType());
int ext[6];
- //first->GetExtent(ext); // JPR
+ //first->GetExtent(ext); // JPR
first->GetWholeExtent(ext); // renvoie egalement 0,0 en Z // JPR
+ // Normal :
std::cout <<"in GimmickView::ReadImagesNotThreaded GetWholeExtent ext =";
for (int jjj=0;jjj<6;jjj++)
}
out->SetExtent(ext);
- // LG : TODO : Z Spacing ?
+ // LG : TODO : Z Spacing ? // Voir + loin // JPR
out->AllocateScalars();
- //first->Print(std::cout);
- // out->Print(std::cout);
-
int dim[3];
first->GetDimensions(dim);
unsigned long imsize = dim[0] * dim[1];
std::vector<std::string>::iterator it;
for (it=im.begin(); it!=im.end(); ++it)
{
-
- vtkImageData* cur = mReader.GetImage( (*it));
- // void* src = cur->GetScalarPointer(0,0,0);
- // void* dst = out->GetScalarPointer(0,0,slice);
- memcpy(out->GetScalarPointer(0,0,slice), cur->GetScalarPointer(0,0,0), imsize);
+ vtkImageData* cur = mReader.GetImage( (*it));
+ // void* src = cur->GetScalarPointer(0,0,0);
+ // void* dst = out->GetScalarPointer(0,0,slice);
+ memcpy(out->GetScalarPointer(0,0,slice), cur->GetScalarPointer(0,0,0), imsize);
- slice++;
+ slice++;
}
s.push_back(out);
}
if (dimension == 2)
{
// n3D
- std::vector<std::string>::iterator it;
+ std::vector<std::string>::iterator it;
for (it=im.begin(); it!=im.end(); ++it)
{
+ std::cout << "----------------------------------------n3D" << std::endl;
vtkImageData* out = vtkImageData::New();
out->ShallowCopy(mReader.GetImage(*it));
s.push_back(out);
{
// n2D to 3D // NO!
// n *2D + T in a vector :
-
+ std::cout << "---------------------------------------- n *2D + T" << std::endl;
std::vector<std::string>::iterator it;
for (it=im.begin(); it!=im.end(); ++it)
{
- vtkImageData* out = mReader.GetImage( (*it));
+ std::cout << "---------------------------------------- [" << *it << "]" << std::endl;
+ //vtkImageData* out = mReader.GetImage( (*it));
+ //s.push_back(out);
+ vtkImageData* out = vtkImageData::New();
+ out->ShallowCopy(mReader.GetImage(*it));
s.push_back(out);
}
}
void GimmickView::RequestReading(tree::Node* n,
int prio, int selection_index, boost::shared_ptr<ImagePointerHolder> p)
{
- if(!mReaderStarted)
- {
- mReader.Start();
- mReaderStarted=true;
- }
- ImageEventType t(n,selection_index);
- t.pointerHolder = p;
- mImageEventMap[n->GetAttribute("FullFileName")] = t;
- mReader.Request(this,n->GetAttribute("FullFileName"),prio);
+ if(!mReaderStarted)
+ {
+ mReader.Start();
+ mReaderStarted=true;
+ }
+ ImageEventType t(n,selection_index);
+ t.pointerHolder = p;
+ mImageEventMap[n->GetAttribute("FullFileName")] = t;
+ mReader.Request(this,n->GetAttribute("FullFileName"),prio);
}
//======================================================================